From fe68d5946073d92bc585b2b5372c420218807c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 1 Nov 2016 01:25:04 +0100 Subject: GH-1645 reimplement open/close instance window based on settings --- application/LaunchController.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'application/LaunchController.cpp') diff --git a/application/LaunchController.cpp b/application/LaunchController.cpp index 4dce6708..13f453ef 100644 --- a/application/LaunchController.cpp +++ b/application/LaunchController.cpp @@ -206,11 +206,15 @@ void LaunchController::launchInstance() } auto console = qobject_cast(m_parentWidget); - if(!console) + if(!console && m_showConsole) { MMC->showInstanceWindow(m_instance); } connect(m_launcher.get(), &LaunchTask::readyForLaunch, this, &LaunchController::readyForLaunch); + connect(m_launcher.get(), &LaunchTask::succeeded, this, &LaunchController::onSucceeded); + connect(m_launcher.get(), &LaunchTask::failed, this, &LaunchController::onFailed); + connect(m_launcher.get(), &LaunchTask::requestProgress, this, &LaunchController::onProgressRequested); + m_launcher->prependStep(std::make_shared(m_launcher.get(), "MultiMC version: " + BuildConfig.printableVersionString() + "\n\n", MessageLevel::MultiMC)); m_launcher->start(); @@ -221,7 +225,6 @@ void LaunchController::readyForLaunch() if (!m_profiler) { m_launcher->proceed(); - emitSucceeded(); return; } @@ -247,7 +250,6 @@ void LaunchController::readyForLaunch() msg.setModal(true); msg.exec(); m_launcher->proceed(); - emitSucceeded(); }); connect(profilerInstance, &BaseProfiler::abortLaunch, [this](const QString & message) { @@ -263,3 +265,21 @@ void LaunchController::readyForLaunch() }); profilerInstance->beginProfiling(m_launcher); } + +void LaunchController::onSucceeded() +{ + emitSucceeded(); +} + +void LaunchController::onFailed(QString reason) +{ + emitFailed(reason); +} + +void LaunchController::onProgressRequested(Task* task) +{ + ProgressDialog progDialog(m_parentWidget); + progDialog.setSkipButton(true, tr("Abort")); + m_launcher->proceed(); + progDialog.execWithTask(task); +} -- cgit v1.2.3