diff options
author | Jan Dalheimer <jan@dalheimer.de> | 2014-02-24 09:34:21 +0100 |
---|---|---|
committer | Jan Dalheimer <jan@dalheimer.de> | 2014-02-24 09:34:21 +0100 |
commit | 226c1bdae5ec615381965b6731f6496dffa3299e (patch) | |
tree | 6d437bf3aea4b3954d705f3fa11b78b3e3b42f99 /gui/MainWindow.cpp | |
parent | 5e33da258c3b5159dba854eb4792d0852a1ca363 (diff) | |
download | MultiMC-226c1bdae5ec615381965b6731f6496dffa3299e.tar MultiMC-226c1bdae5ec615381965b6731f6496dffa3299e.tar.gz MultiMC-226c1bdae5ec615381965b6731f6496dffa3299e.tar.lz MultiMC-226c1bdae5ec615381965b6731f6496dffa3299e.tar.xz MultiMC-226c1bdae5ec615381965b6731f6496dffa3299e.zip |
Screenshot fixes, move some code around, fix some stuff
Diffstat (limited to 'gui/MainWindow.cpp')
-rw-r--r-- | gui/MainWindow.cpp | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index 87c65601..f79b981a 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -1235,6 +1235,7 @@ void MainWindow::launchInstance(BaseInstance *instance, AuthSessionPtr session) console = new ConsoleWindow(proc); connect(console, SIGNAL(isClosing()), this, SLOT(instanceEnded())); + connect(console, &ConsoleWindow::uploadScreenshots, this, &MainWindow::on_actionScreenshots_triggered); proc->setLogin(session); proc->launch(); @@ -1516,34 +1517,15 @@ void MainWindow::on_actionScreenshots_triggered() return; } ScreenshotDialog dialog(list, this); - if (dialog.exec() == QDialog::Accepted) + if (dialog.exec() == ScreenshotDialog::Accepted) { - QList<ScreenShot *> screenshots = dialog.selected(); - if (screenshots.size() == 0) - return; - NetJob *job = new NetJob("Screenshot Upload"); - for (ScreenShot *shot : screenshots) - job->addNetAction(ScreenShotUpload::make(shot)); - ProgressDialog prog2(this); - prog2.exec(job); - connect(job, &NetJob::failed, [this] + QStringList urls; + for (ScreenShot *shot : dialog.uploaded()) { - CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"), - tr("Unknown error"), QMessageBox::Warning)->exec(); - }); - connect(job, &NetJob::succeeded, [this, screenshots] - { screenshotsUploaded(screenshots); }); - } -} - -void MainWindow::screenshotsUploaded(QList<ScreenShot *> screenshots) -{ - QStringList urls; - for (ScreenShot *shot : screenshots) - { - urls << QString("<a href=\"" + shot->url + "\">Image %s</a>") - .arg(QString::number(shot->imgurIndex)); + urls << QString("<a href=\"" + shot->url + "\">Image %s</a>") + .arg(QString::number(shot->imgurIndex)); + } + CustomMessageBox::selectable(this, tr("Done uploading!"), urls.join("\n"), + QMessageBox::Information)->exec(); } - CustomMessageBox::selectable(this, tr("Done uploading!"), urls.join("\n"), - QMessageBox::Information)->exec(); } |