diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-07-05 01:54:30 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-07-05 01:54:30 +0200 |
commit | 7f1320390c55e408a4b0081b2606eab3892a8148 (patch) | |
tree | e08183b17e551e6807939c5ad2932ae68e14f49b /application/ConsoleWindow.cpp | |
parent | 526a511f455234152ca9b5bc8c60d3c82cbfa417 (diff) | |
download | MultiMC-7f1320390c55e408a4b0081b2606eab3892a8148.tar MultiMC-7f1320390c55e408a4b0081b2606eab3892a8148.tar.gz MultiMC-7f1320390c55e408a4b0081b2606eab3892a8148.tar.lz MultiMC-7f1320390c55e408a4b0081b2606eab3892a8148.tar.xz MultiMC-7f1320390c55e408a4b0081b2606eab3892a8148.zip |
GH-1053 move launch process UI to a separate class
Diffstat (limited to 'application/ConsoleWindow.cpp')
-rw-r--r-- | application/ConsoleWindow.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/application/ConsoleWindow.cpp b/application/ConsoleWindow.cpp index 98492414..84140516 100644 --- a/application/ConsoleWindow.cpp +++ b/application/ConsoleWindow.cpp @@ -129,12 +129,8 @@ ConsoleWindow::ConsoleWindow(std::shared_ptr<BaseLauncher> process, QWidget *par } // Set up signal connections - connect(m_proc.get(), SIGNAL(ended(InstancePtr, int, QProcess::ExitStatus)), this, - SLOT(onEnded(InstancePtr, int, QProcess::ExitStatus))); - connect(m_proc.get(), SIGNAL(prelaunch_failed(InstancePtr, int, QProcess::ExitStatus)), this, - SLOT(onEnded(InstancePtr, int, QProcess::ExitStatus))); - connect(m_proc.get(), SIGNAL(launch_failed(InstancePtr)), this, - SLOT(onLaunchFailed(InstancePtr))); + connect(m_proc.get(), &BaseLauncher::succeeded, this, &ConsoleWindow::onSucceeded); + connect(m_proc.get(), &BaseLauncher::failed, this, &ConsoleWindow::onFailed); setMayClose(false); @@ -220,18 +216,14 @@ void ConsoleWindow::on_btnKillMinecraft_clicked() m_killButton->setEnabled(true); } -void ConsoleWindow::onEnded(InstancePtr instance, int code, QProcess::ExitStatus status) +void ConsoleWindow::onSucceeded() { - bool peacefulExit = code == 0 && status != QProcess::CrashExit; m_killButton->setEnabled(false); setMayClose(true); - if (instance->settings()->get("AutoCloseConsole").toBool()) + if (m_proc->instance()->settings()->get("AutoCloseConsole").toBool()) { - if (peacefulExit) - { - this->close(); - return; - } + this->close(); + return; } if (!isVisible()) { @@ -245,15 +237,16 @@ void ConsoleWindow::onEnded(InstancePtr instance, int code, QProcess::ExitStatus } } -void ConsoleWindow::onLaunchFailed(InstancePtr instance) +void ConsoleWindow::onFailed(QString reason) { m_killButton->setEnabled(false); - setMayClose(true); - if (!isVisible()) + { show(); + } } + ConsoleWindow::~ConsoleWindow() { |