summaryrefslogtreecommitdiffstats
path: root/gui/mainwindow.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-09-08 16:21:49 +0200
committerPetr Mrázek <peterix@gmail.com>2013-09-08 16:21:49 +0200
commit499ee1e36569fca73bdb809183242b03da69f3ef (patch)
tree8d29f00958da54ade7e560b98e43fae89dfff0d4 /gui/mainwindow.cpp
parent7e1cf22ce61e8a5450e5dc74993e471c20b2742f (diff)
parentdab2bbe4e79cfd8b3b72b8d2fd0e5bd66e0281a9 (diff)
downloadMultiMC-499ee1e36569fca73bdb809183242b03da69f3ef.tar
MultiMC-499ee1e36569fca73bdb809183242b03da69f3ef.tar.gz
MultiMC-499ee1e36569fca73bdb809183242b03da69f3ef.tar.lz
MultiMC-499ee1e36569fca73bdb809183242b03da69f3ef.tar.xz
MultiMC-499ee1e36569fca73bdb809183242b03da69f3ef.zip
Merge branch 'master' of https://github.com/Stiepen22/MultiMC5 into develop
Conflicts: AppSettings.cpp MultiMC.pro main.cpp
Diffstat (limited to 'gui/mainwindow.cpp')
-rw-r--r--gui/mainwindow.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index c0b79108..7ddc66a9 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -488,7 +488,10 @@ void MainWindow::doLogin(const QString& errorMsg)
}
else
{
- m_activeLogin = {loginDlg->getUsername(), QString("Offline"), qint64(-1)};
+ QString user = loginDlg->getUsername();
+ if (user.length() == 0)
+ user = QString("Offline");
+ m_activeLogin = {user, QString("Offline"), qint64(-1)};
m_activeInst = m_selectedInstance;
launchInstance(m_activeInst, m_activeLogin);
}
@@ -534,10 +537,22 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response)
if(!proc)
return;
- console = new ConsoleWindow();
+ // Prepare GUI: If it shall stay open disable the required parts
+ if (MMC->settings()->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->setLogin(m_activeLogin.username, m_activeLogin.sessionID);
proc->launch();
}
@@ -664,3 +679,9 @@ void MainWindow::on_actionEditInstNotes_triggered()
linst->setNotes(noteedit.getText());
}
}
+
+void MainWindow::instanceEnded()
+{
+ this->show();
+ ui->actionLaunchInstance->setEnabled(m_selectedInstance);
+}