aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/launch/LauncherPartLaunch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/minecraft/launch/LauncherPartLaunch.cpp')
-rw-r--r--launcher/minecraft/launch/LauncherPartLaunch.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/launcher/minecraft/launch/LauncherPartLaunch.cpp b/launcher/minecraft/launch/LauncherPartLaunch.cpp
index 8fd11eca..f461b847 100644
--- a/launcher/minecraft/launch/LauncherPartLaunch.cpp
+++ b/launcher/minecraft/launch/LauncherPartLaunch.cpp
@@ -25,6 +25,19 @@
LauncherPartLaunch::LauncherPartLaunch(LaunchTask *parent) : LaunchStep(parent)
{
+ if (APPLICATION->settings()->get("CloseAfterLaunch").toBool())
+ {
+ std::shared_ptr<QMetaObject::Connection> connection{new QMetaObject::Connection};
+ *connection = connect(&m_process, &LoggedProcess::log, this, [=](QStringList lines, MessageLevel::Enum level) {
+ qDebug() << lines;
+ if (lines.filter(QRegularExpression(".*Setting user.+", QRegularExpression::CaseInsensitiveOption)).length() != 0)
+ {
+ APPLICATION->closeAllWindows();
+ disconnect(*connection);
+ }
+ });
+ }
+
connect(&m_process, &LoggedProcess::log, this, &LauncherPartLaunch::logLines);
connect(&m_process, &LoggedProcess::stateChanged, this, &LauncherPartLaunch::on_state);
}
@@ -155,6 +168,8 @@ void LauncherPartLaunch::on_state(LoggedProcess::State state)
}
case LoggedProcess::Finished:
{
+ if (APPLICATION->settings()->get("CloseAfterLaunch").toBool())
+ APPLICATION->showMainWindow();
m_parent->setPid(-1);
// if the exit code wasn't 0, report this as a crash
auto exitCode = m_process.exitCode();