summaryrefslogtreecommitdiffstats
path: root/application/ConsoleWindow.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-07-05 01:54:30 +0200
committerPetr Mrázek <peterix@gmail.com>2015-07-05 01:54:30 +0200
commit7f1320390c55e408a4b0081b2606eab3892a8148 (patch)
treee08183b17e551e6807939c5ad2932ae68e14f49b /application/ConsoleWindow.cpp
parent526a511f455234152ca9b5bc8c60d3c82cbfa417 (diff)
downloadMultiMC-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.cpp27
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()
{