Respect console options (opening a console at all, automatically closing)

This commit is contained in:
Sky
2013-10-22 18:25:10 +01:00
parent 1d2183ea29
commit c65bab6efe
6 changed files with 29 additions and 12 deletions

View File

@ -14,7 +14,7 @@ ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent) :
{
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
connect(mcproc, SIGNAL(ended()), this, SLOT(onEnded()));
connect(mcproc, SIGNAL(ended(BaseInstance*)), this, SLOT(onEnded(BaseInstance*)));
}
ConsoleWindow::~ConsoleWindow()
@ -109,9 +109,14 @@ void ConsoleWindow::on_btnKillMinecraft_clicked()
r_u_sure.close();
}
void ConsoleWindow::onEnded()
void ConsoleWindow::onEnded(BaseInstance *instance)
{
ui->btnKillMinecraft->setEnabled(false);
// TODO: Check why this doesn't work
if (!proc->exitCode()) this->close();
// TODO: Might need an option to forcefully close, even on an error
if(instance->settings().get("AutoCloseConsole").toBool())
{
// TODO: Check why this doesn't work
if (!proc->exitCode()) this->close();
}
}