diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-05-18 19:07:01 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-05-18 19:07:01 +0200 |
commit | 911ac19a56fa1a5f8dd4798385022813cd0b9d07 (patch) | |
tree | 607971d32b1c6e18bb5d6570800fa7e3bd11878d /gui/MainWindow.cpp | |
parent | 7f2a16917e347db2ffcdd5a148feda71f6f3a47e (diff) | |
download | MultiMC-911ac19a56fa1a5f8dd4798385022813cd0b9d07.tar MultiMC-911ac19a56fa1a5f8dd4798385022813cd0b9d07.tar.gz MultiMC-911ac19a56fa1a5f8dd4798385022813cd0b9d07.tar.lz MultiMC-911ac19a56fa1a5f8dd4798385022813cd0b9d07.tar.xz MultiMC-911ac19a56fa1a5f8dd4798385022813cd0b9d07.zip |
Screenshot upload dialog(s) now have the console window as parent.
Diffstat (limited to 'gui/MainWindow.cpp')
-rw-r--r-- | gui/MainWindow.cpp | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index 725bf175..9661537a 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -64,7 +64,6 @@ #include "gui/dialogs/AccountSelectDialog.h" #include "gui/dialogs/UpdateDialog.h" #include "gui/dialogs/EditAccountDialog.h" -#include "gui/dialogs/ScreenshotDialog.h" #include "gui/dialogs/NotificationDialog.h" #include "gui/ConsoleWindow.h" @@ -1239,15 +1238,19 @@ void MainWindow::launchInstance(InstancePtr instance, AuthSessionPtr session, Ba Q_ASSERT_X(instance != NULL, "launchInstance", "instance is NULL"); Q_ASSERT_X(session.get() != nullptr, "launchInstance", "session is NULL"); - proc = instance->prepareForLaunch(session); - if (!proc) + QString launchScript; + + if(!instance->prepareForLaunch(session, launchScript)) return; + MinecraftProcess *proc = new MinecraftProcess(instance); + proc->setLaunchScript(launchScript); + proc->setWorkdir(instance->minecraftRoot()); + this->hide(); console = new ConsoleWindow(proc); connect(console, SIGNAL(isClosing()), this, SLOT(instanceEnded())); - connect(console, &ConsoleWindow::uploadScreenshots, this, &MainWindow::on_actionScreenshots_triggered); proc->setLogin(session); proc->arm(); @@ -1269,7 +1272,7 @@ void MainWindow::launchInstance(InstancePtr instance, AuthSessionPtr session, Ba dialog.setLabelText(tr("Waiting for profiler...")); connect(&dialog, &QProgressDialog::canceled, profilerInstance, &BaseProfiler::abortProfiling); dialog.show(); - connect(profilerInstance, &BaseProfiler::readyToLaunch, [&dialog, this](const QString &message) + connect(profilerInstance, &BaseProfiler::readyToLaunch, [&dialog, this, proc](const QString &message) { dialog.accept(); QMessageBox msg; @@ -1282,7 +1285,7 @@ void MainWindow::launchInstance(InstancePtr instance, AuthSessionPtr session, Ba msg.exec(); proc->launch(); }); - connect(profilerInstance, &BaseProfiler::abortLaunch, [&dialog, this](const QString &message) + connect(profilerInstance, &BaseProfiler::abortLaunch, [&dialog, this, proc](const QString &message) { dialog.accept(); QMessageBox msg; @@ -1569,25 +1572,3 @@ void MainWindow::checkSetDefaultJava() MMC->settings()->set("JavaPath", QString("java")); } } - -void MainWindow::on_actionScreenshots_triggered() -{ - if (!m_selectedInstance) - return; - ScreenshotList *list = new ScreenshotList(m_selectedInstance); - Task *task = list->load(); - ProgressDialog prog(this); - prog.exec(task); - if (!task->successful()) - { - CustomMessageBox::selectable(this, tr("Failed to load screenshots!"), - task->failReason(), QMessageBox::Warning)->exec(); - return; - } - ScreenshotDialog dialog(list, this); - if (dialog.exec() == ScreenshotDialog::Accepted) - { - CustomMessageBox::selectable(this, tr("Done uploading!"), dialog.message(), - QMessageBox::Information)->exec(); - } -} |