diff options
| author | swirl <swurl@swurl.xyz> | 2022-02-03 13:44:09 -0500 |
|---|---|---|
| committer | swirl <swurl@swurl.xyz> | 2022-02-03 13:44:09 -0500 |
| commit | fcc4420cfec3fcd970ff1f35b8848559c7b5b6ef (patch) | |
| tree | 0f916be4404c7cf0908f89128e4ab40f55ffd8f0 /launcher/minecraft/launch | |
| parent | 1f176fcb7b2cf9281ac95880d85c1cf7597618e6 (diff) | |
| parent | f5358aa1ca4b7d44dfe75d8e55e26d4b22e09dc6 (diff) | |
| download | PrismLauncher-fcc4420cfec3fcd970ff1f35b8848559c7b5b6ef.tar.gz PrismLauncher-fcc4420cfec3fcd970ff1f35b8848559c7b5b6ef.tar.bz2 PrismLauncher-fcc4420cfec3fcd970ff1f35b8848559c7b5b6ef.zip | |
Merge branch 'feature/close_after_launch' into develop
Diffstat (limited to 'launcher/minecraft/launch')
| -rw-r--r-- | launcher/minecraft/launch/LauncherPartLaunch.cpp | 15 |
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(); |
