From e8731c5d013e67ee0153d5a49b38b0e914d14aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 28 Jun 2014 17:07:08 +0200 Subject: Turn screenshot management into a page. --- gui/dialogs/ScreenshotDialog.cpp | 78 --------------------------- gui/dialogs/ScreenshotDialog.h | 40 -------------- gui/dialogs/ScreenshotDialog.ui | 110 --------------------------------------- 3 files changed, 228 deletions(-) delete mode 100644 gui/dialogs/ScreenshotDialog.cpp delete mode 100644 gui/dialogs/ScreenshotDialog.h delete mode 100644 gui/dialogs/ScreenshotDialog.ui (limited to 'gui/dialogs') diff --git a/gui/dialogs/ScreenshotDialog.cpp b/gui/dialogs/ScreenshotDialog.cpp deleted file mode 100644 index a88c8dfd..00000000 --- a/gui/dialogs/ScreenshotDialog.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "ScreenshotDialog.h" -#include "ui_ScreenshotDialog.h" - -#include -#include - -#include "ProgressDialog.h" -#include "CustomMessageBox.h" -#include "logic/net/NetJob.h" -#include "logic/screenshots/ImgurUpload.h" -#include "logic/screenshots/ImgurAlbumCreation.h" -#include "logic/tasks/SequentialTask.h" - -ScreenshotDialog::ScreenshotDialog(ScreenshotList *list, QWidget *parent) - : QDialog(parent), ui(new Ui::ScreenshotDialog), m_list(list) -{ - ui->setupUi(this); - ui->listView->setModel(m_list); -} - -ScreenshotDialog::~ScreenshotDialog() -{ - delete ui; -} - -QString ScreenshotDialog::message() const -{ - return tr("Visit album
Delete hash: %2 (save " - "this if you want to be able to edit/delete the album)") - .arg(m_imgurAlbum->id(), m_imgurAlbum->deleteHash()); -} - -QList ScreenshotDialog::selected() const -{ - QList list; - QList first = m_list->screenshots(); - for (QModelIndex index : ui->listView->selectionModel()->selectedRows()) - { - list.append(first.at(index.row())); - } - return list; -} - -void ScreenshotDialog::on_uploadBtn_clicked() -{ - m_uploaded = selected(); - if (m_uploaded.isEmpty()) - { - done(NothingDone); - return; - } - SequentialTask *task = new SequentialTask(this); - NetJob *job = new NetJob("Screenshot Upload"); - for (auto shot : m_uploaded) - { - job->addNetAction(ImgurUpload::make(shot)); - } - NetJob *albumTask = new NetJob("Imgur Album Creation"); - albumTask->addNetAction(m_imgurAlbum = ImgurAlbumCreation::make(m_uploaded)); - task->addTask(NetJobPtr(job)); - task->addTask(NetJobPtr(albumTask)); - ProgressDialog prog(this); - if (prog.exec(task) == QDialog::Accepted) - { - accept(); - } - else - { - CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"), - tr("Unknown error"), QMessageBox::Warning)->exec(); - reject(); - } -} - -void ScreenshotDialog::on_deleteBtn_clicked() -{ - m_list->deleteSelected(this); -} diff --git a/gui/dialogs/ScreenshotDialog.h b/gui/dialogs/ScreenshotDialog.h deleted file mode 100644 index 29dd6765..00000000 --- a/gui/dialogs/ScreenshotDialog.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include -#include "logic/screenshots/ScreenshotList.h" - -class ImgurAlbumCreation; - -namespace Ui -{ -class ScreenshotDialog; -} - -class ScreenshotDialog : public QDialog -{ - Q_OBJECT - -public: - explicit ScreenshotDialog(ScreenshotList *list, QWidget *parent = 0); - ~ScreenshotDialog(); - - enum - { - NothingDone = 0x42 - }; - - QString message() const; - QList selected() const; - -private -slots: - void on_uploadBtn_clicked(); - - void on_deleteBtn_clicked(); - -private: - Ui::ScreenshotDialog *ui; - ScreenshotList *m_list; - QList m_uploaded; - std::shared_ptr m_imgurAlbum; -}; diff --git a/gui/dialogs/ScreenshotDialog.ui b/gui/dialogs/ScreenshotDialog.ui deleted file mode 100644 index eb3dafba..00000000 --- a/gui/dialogs/ScreenshotDialog.ui +++ /dev/null @@ -1,110 +0,0 @@ - - - ScreenshotDialog - - - - 0 - 0 - 470 - 300 - - - - Screenshot Manager - - - - :/icons/multimc/scalable/apps/multimc.svg:/icons/multimc/scalable/apps/multimc.svg - - - - - - QAbstractItemView::ExtendedSelection - - - QAbstractItemView::SelectItems - - - - 120 - 90 - - - - QListView::LeftToRight - - - true - - - QListView::Adjust - - - QListView::IconMode - - - - - - - - - Upload - - - - - - - Delete - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Close - - - - - - - - - - - - - closeBtn - clicked() - ScreenshotDialog - reject() - - - 315 - 272 - - - 271 - 258 - - - - - -- cgit v1.2.3