summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AppSettings.cpp5
-rw-r--r--gui/consolewindow.cpp8
-rw-r--r--gui/consolewindow.h1
-rw-r--r--gui/mainwindow.cpp17
-rw-r--r--gui/mainwindow.h3
5 files changed, 31 insertions, 3 deletions
diff --git a/AppSettings.cpp b/AppSettings.cpp
index 403af1dc..8b0265eb 100644
--- a/AppSettings.cpp
+++ b/AppSettings.cpp
@@ -67,6 +67,7 @@ AppSettings::AppSettings(QObject *parent) :
registerSetting(new Setting("PreLaunchCommand", ""));
registerSetting(new Setting("PostExitCommand", ""));
- // The cat
- registerSetting(new Setting("TheCat", false));
+ // Misc
+ registerSetting(new Setting("TheCat", false)); // The Cat
+ registerSetting(new Setting("NoHide", false)); // Shall the main window hide on instance launch
}
diff --git a/gui/consolewindow.cpp b/gui/consolewindow.cpp
index f2bc662a..f95d2742 100644
--- a/gui/consolewindow.cpp
+++ b/gui/consolewindow.cpp
@@ -11,6 +11,7 @@ ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent) :
proc(mcproc)
{
ui->setupUi(this);
+ connect(mcproc, SIGNAL(ended()), this, SLOT(onEnded()));
}
ConsoleWindow::~ConsoleWindow()
@@ -91,4 +92,9 @@ void ConsoleWindow::on_btnKillMinecraft_clicked()
else
ui->btnKillMinecraft->setEnabled(true);
r_u_sure.close();
-} \ No newline at end of file
+}
+
+void ConsoleWindow::onEnded()
+{
+ ui->btnKillMinecraft->setEnabled(false);
+}
diff --git a/gui/consolewindow.h b/gui/consolewindow.h
index d4485a45..6a6c9e50 100644
--- a/gui/consolewindow.h
+++ b/gui/consolewindow.h
@@ -49,6 +49,7 @@ public slots:
private slots:
void on_closeButton_clicked();
void on_btnKillMinecraft_clicked();
+ void onEnded();
protected:
void closeEvent(QCloseEvent *);
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index 7d1e1510..82ae41d9 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -541,10 +541,21 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response)
if(!proc)
return;
+ // Prepare GUI: If it shall stay open disable the required parts
+ if (globalSettings->get("NoHide").toBool())
+ {
+ ui->actionLaunchInstance->setEnabled(false);
+ }
+ else
+ {
+ 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()));
proc->launch();
}
@@ -673,3 +684,9 @@ void MainWindow::on_actionEditInstNotes_triggered()
linst->setNotes(noteedit.getText());
}
}
+
+void MainWindow::instanceEnded()
+{
+ this->show();
+ ui->actionLaunchInstance->setEnabled(m_selectedInstance);
+}
diff --git a/gui/mainwindow.h b/gui/mainwindow.h
index 42f118b1..e8a6cbcf 100644
--- a/gui/mainwindow.h
+++ b/gui/mainwindow.h
@@ -111,6 +111,8 @@ private slots:
void on_actionChangeInstLWJGLVersion_triggered();
+ void instanceEnded();
+
void on_actionInstanceSettings_triggered();
public slots:
@@ -128,6 +130,7 @@ protected:
bool eventFilter(QObject *obj, QEvent *ev);
void setCatBackground(bool enabled);
private:
+
Ui::MainWindow *ui;
KCategoryDrawer * drawer;
KCategorizedView * view;