mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-10-04 17:09:25 +00:00
GH-1053 move launch process UI to a separate class
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
|
Reference in New Issue
Block a user