summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorSky <git@bunnies.cc>2013-10-22 18:25:10 +0100
committerSky <git@bunnies.cc>2013-10-22 18:25:10 +0100
commitc65bab6efec27d7b0654609798f77dd617d33d2d (patch)
tree70a7cd21909ed15717f612ab69a14dd5a0541d7f /gui
parent1d2183ea29a0a5d65348700d4e043dbdb22b3632 (diff)
downloadMultiMC-c65bab6efec27d7b0654609798f77dd617d33d2d.tar
MultiMC-c65bab6efec27d7b0654609798f77dd617d33d2d.tar.gz
MultiMC-c65bab6efec27d7b0654609798f77dd617d33d2d.tar.lz
MultiMC-c65bab6efec27d7b0654609798f77dd617d33d2d.tar.xz
MultiMC-c65bab6efec27d7b0654609798f77dd617d33d2d.zip
Respect console options (opening a console at all, automatically closing)
Diffstat (limited to 'gui')
-rw-r--r--gui/consolewindow.cpp13
-rw-r--r--gui/consolewindow.h2
-rw-r--r--gui/mainwindow.cpp18
-rw-r--r--gui/mainwindow.h2
4 files changed, 26 insertions, 9 deletions
diff --git a/gui/consolewindow.cpp b/gui/consolewindow.cpp
index deeedd65..6ed4a0ec 100644
--- a/gui/consolewindow.cpp
+++ b/gui/consolewindow.cpp
@@ -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();
+ }
}
diff --git a/gui/consolewindow.h b/gui/consolewindow.h
index 6a6c9e50..e8790c92 100644
--- a/gui/consolewindow.h
+++ b/gui/consolewindow.h
@@ -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 *);
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index cce16a93..608dacd5 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -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()
diff --git a/gui/mainwindow.h b/gui/mainwindow.h
index 4490d474..941fbcca 100644
--- a/gui/mainwindow.h
+++ b/gui/mainwindow.h
@@ -112,7 +112,7 @@ private slots:
void on_actionChangeInstLWJGLVersion_triggered();
- void instanceEnded();
+ void instanceEnded(BaseInstance *instance);
void on_actionInstanceSettings_triggered();