Made main window hide on instace exit

This commit is contained in:
Stiepen22 2013-09-06 23:52:17 +02:00
parent 0990a1103c
commit 3fd2d025a1
5 changed files with 31 additions and 3 deletions

View File

@ -67,6 +67,7 @@ AppSettings::AppSettings(QObject *parent) :
registerSetting(new Setting("PreLaunchCommand", "")); registerSetting(new Setting("PreLaunchCommand", ""));
registerSetting(new Setting("PostExitCommand", "")); registerSetting(new Setting("PostExitCommand", ""));
// The cat // Misc
registerSetting(new Setting("TheCat", false)); registerSetting(new Setting("TheCat", false)); // The Cat
registerSetting(new Setting("NoHide", false)); // Shall the main window hide on instance launch
} }

View File

@ -11,6 +11,7 @@ ConsoleWindow::ConsoleWindow(MinecraftProcess *mcproc, QWidget *parent) :
proc(mcproc) proc(mcproc)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(mcproc, SIGNAL(ended()), this, SLOT(onEnded()));
} }
ConsoleWindow::~ConsoleWindow() ConsoleWindow::~ConsoleWindow()
@ -92,3 +93,8 @@ void ConsoleWindow::on_btnKillMinecraft_clicked()
ui->btnKillMinecraft->setEnabled(true); ui->btnKillMinecraft->setEnabled(true);
r_u_sure.close(); r_u_sure.close();
} }
void ConsoleWindow::onEnded()
{
ui->btnKillMinecraft->setEnabled(false);
}

View File

@ -49,6 +49,7 @@ public slots:
private slots: private slots:
void on_closeButton_clicked(); void on_closeButton_clicked();
void on_btnKillMinecraft_clicked(); void on_btnKillMinecraft_clicked();
void onEnded();
protected: protected:
void closeEvent(QCloseEvent *); void closeEvent(QCloseEvent *);

View File

@ -541,10 +541,21 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response)
if(!proc) if(!proc)
return; 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 = new ConsoleWindow(proc);
console->show(); console->show();
connect(proc, SIGNAL(log(QString, MessageLevel::Enum)), connect(proc, SIGNAL(log(QString, MessageLevel::Enum)),
console, SLOT(write(QString, MessageLevel::Enum))); console, SLOT(write(QString, MessageLevel::Enum)));
connect(proc, SIGNAL(ended()), this, SLOT(instanceEnded()));
proc->launch(); proc->launch();
} }
@ -673,3 +684,9 @@ void MainWindow::on_actionEditInstNotes_triggered()
linst->setNotes(noteedit.getText()); linst->setNotes(noteedit.getText());
} }
} }
void MainWindow::instanceEnded()
{
this->show();
ui->actionLaunchInstance->setEnabled(m_selectedInstance);
}

View File

@ -111,6 +111,8 @@ private slots:
void on_actionChangeInstLWJGLVersion_triggered(); void on_actionChangeInstLWJGLVersion_triggered();
void instanceEnded();
void on_actionInstanceSettings_triggered(); void on_actionInstanceSettings_triggered();
public slots: public slots:
@ -128,6 +130,7 @@ protected:
bool eventFilter(QObject *obj, QEvent *ev); bool eventFilter(QObject *obj, QEvent *ev);
void setCatBackground(bool enabled); void setCatBackground(bool enabled);
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
KCategoryDrawer * drawer; KCategoryDrawer * drawer;
KCategorizedView * view; KCategorizedView * view;