Respect console options (opening a console at all, automatically closing)
This commit is contained in:
parent
1d2183ea29
commit
c65bab6efe
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public slots:
|
||||
private slots:
|
||||
void on_closeButton_clicked();
|
||||
void on_btnKillMinecraft_clicked();
|
||||
void onEnded();
|
||||
void onEnded(BaseInstance *instance);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
|
@ -630,11 +630,18 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response)
|
||||
this->hide();
|
||||
}
|
||||
|
||||
|
||||
console = new ConsoleWindow(proc);
|
||||
console->show();
|
||||
|
||||
connect(proc, SIGNAL(log(QString, MessageLevel::Enum)), console,
|
||||
SLOT(write(QString, MessageLevel::Enum)));
|
||||
connect(proc, SIGNAL(ended()), this, SLOT(instanceEnded()));
|
||||
connect(proc, SIGNAL(ended(BaseInstance*)), this, SLOT(instanceEnded(BaseInstance*)));
|
||||
|
||||
if (instance->settings().get("ShowConsole").toBool())
|
||||
{
|
||||
console->show();
|
||||
}
|
||||
|
||||
proc->setLogin(response.username, response.session_id);
|
||||
proc->launch();
|
||||
}
|
||||
@ -784,10 +791,15 @@ void MainWindow::on_actionEditInstNotes_triggered()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::instanceEnded()
|
||||
void MainWindow::instanceEnded(BaseInstance *instance)
|
||||
{
|
||||
this->show();
|
||||
ui->actionLaunchInstance->setEnabled(m_selectedInstance);
|
||||
|
||||
if (instance->settings().get("AutoCloseConsole").toBool())
|
||||
{
|
||||
console->close();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::checkSetDefaultJava()
|
||||
|
@ -112,7 +112,7 @@ private slots:
|
||||
|
||||
void on_actionChangeInstLWJGLVersion_triggered();
|
||||
|
||||
void instanceEnded();
|
||||
void instanceEnded(BaseInstance *instance);
|
||||
|
||||
void on_actionInstanceSettings_triggered();
|
||||
|
||||
|
@ -138,7 +138,7 @@ void MinecraftProcess::finish(int code, ExitStatus status)
|
||||
}
|
||||
}
|
||||
m_instance->cleanupAfterRun();
|
||||
emit ended();
|
||||
emit ended(m_instance);
|
||||
}
|
||||
|
||||
void MinecraftProcess::killMinecraft()
|
||||
|
@ -67,7 +67,7 @@ signals:
|
||||
/**
|
||||
* @brief emitted when mc has finished and the PostLaunchCommand was run
|
||||
*/
|
||||
void ended();
|
||||
void ended(BaseInstance*);
|
||||
|
||||
/**
|
||||
* @brief emitted when we want to log something
|
||||
|
Loading…
Reference in New Issue
Block a user