Fix signal derp from previous commit

Console should now properly close/not close based on minecraft return code/signal.
This commit is contained in:
Petr Mrázek 2013-11-13 00:24:49 +01:00
parent fdc58bb913
commit 9693a5e6e9
3 changed files with 24 additions and 24 deletions

View File

@ -22,16 +22,14 @@
#include <gui/Platform.h> #include <gui/Platform.h>
#include <gui/dialogs/CustomMessageBox.h> #include <gui/dialogs/CustomMessageBox.h>
ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent) : ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent)
QDialog(parent), : QDialog(parent), ui(new Ui::ConsoleWindow), m_mayclose(true), proc(mcproc)
ui(new Ui::ConsoleWindow),
m_mayclose(true),
proc(mcproc)
{ {
MultiMCPlatform::fixWM_CLASS(this); MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this); ui->setupUi(this);
this->setWindowFlags(Qt::Window); this->setWindowFlags(Qt::Window);
connect(mcproc, SIGNAL(ended(BaseInstance*)), this, SLOT(onEnded(BaseInstance*))); connect(mcproc, SIGNAL(ended(BaseInstance *, int, ExitStatus)), this,
SLOT(onEnded(BaseInstance *, int, QProcess::ExitStatus)));
} }
ConsoleWindow::~ConsoleWindow() ConsoleWindow::~ConsoleWindow()
@ -113,8 +111,10 @@ void ConsoleWindow::closeEvent(QCloseEvent * event)
void ConsoleWindow::on_btnKillMinecraft_clicked() void ConsoleWindow::on_btnKillMinecraft_clicked()
{ {
ui->btnKillMinecraft->setEnabled(false); ui->btnKillMinecraft->setEnabled(false);
auto response = CustomMessageBox::selectable(this, tr("Kill Minecraft?"), auto response = CustomMessageBox::selectable(
tr("This can cause the instance to get corrupted and should only be used if Minecraft is frozen for some reason"), this, tr("Kill Minecraft?"),
tr("This can cause the instance to get corrupted and should only be used if Minecraft "
"is frozen for some reason"),
QMessageBox::Question, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)->exec(); QMessageBox::Question, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)->exec();
if (response == QMessageBox::Yes) if (response == QMessageBox::Yes)
proc->killMinecraft(); proc->killMinecraft();

View File

@ -725,8 +725,8 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response)
connect(proc, SIGNAL(log(QString, MessageLevel::Enum)), console, connect(proc, SIGNAL(log(QString, MessageLevel::Enum)), console,
SLOT(write(QString, MessageLevel::Enum))); SLOT(write(QString, MessageLevel::Enum)));
connect(proc, SIGNAL(ended(BaseInstance *, int, ExitStatus)), this, connect(proc, SIGNAL(ended(BaseInstance*,int,QProcess::ExitStatus)), this,
SLOT(instanceEnded(BaseInstance *, int, ExitStatus))); SLOT(instanceEnded(BaseInstance*,int,QProcess::ExitStatus)));
if (instance->settings().get("ShowConsole").toBool()) if (instance->settings().get("ShowConsole").toBool())
{ {

View File

@ -74,7 +74,7 @@ signals:
/** /**
* @brief emitted when mc has finished and the PostLaunchCommand was run * @brief emitted when mc has finished and the PostLaunchCommand was run
*/ */
void ended(BaseInstance *, int code, ExitStatus status); void ended(BaseInstance *, int code, QProcess::ExitStatus status);
/** /**
* @brief emitted when we want to log something * @brief emitted when we want to log something