make closeAfterLaunch good
This commit is contained in:
parent
0065a29901
commit
3d3f9a8609
@ -25,12 +25,12 @@
|
|||||||
|
|
||||||
LauncherPartLaunch::LauncherPartLaunch(LaunchTask *parent) : LaunchStep(parent)
|
LauncherPartLaunch::LauncherPartLaunch(LaunchTask *parent) : LaunchStep(parent)
|
||||||
{
|
{
|
||||||
if (APPLICATION->settings()->get("CloseAfterLaunch").toBoolean())
|
if (APPLICATION->settings()->get("CloseAfterLaunch").toBool())
|
||||||
{
|
{
|
||||||
std::shared_ptr<QMetaObject::Connection> connection{new QMetaObject::Connection};
|
std::shared_ptr<QMetaObject::Connection> connection{new QMetaObject::Connection};
|
||||||
*connection = connect(&m_process, &LoggedProcess::log, this, [=](QStringList lines, MessageLevel::Enum level) {
|
*connection = connect(&m_process, &LoggedProcess::log, this, [=](QStringList lines, MessageLevel::Enum level) {
|
||||||
qDebug() << lines;
|
qDebug() << lines;
|
||||||
if (lines.filter(QRegularExpression(".+Backend library: LWJGL version.+")).length() != 0)
|
if (lines.filter(QRegularExpression(".*Setting user.+", QRegularExpression::CaseInsensitiveOption)).length() != 0)
|
||||||
{
|
{
|
||||||
APPLICATION->closeAllWindows();
|
APPLICATION->closeAllWindows();
|
||||||
disconnect(*connection);
|
disconnect(*connection);
|
||||||
@ -168,7 +168,7 @@ void LauncherPartLaunch::on_state(LoggedProcess::State state)
|
|||||||
}
|
}
|
||||||
case LoggedProcess::Finished:
|
case LoggedProcess::Finished:
|
||||||
{
|
{
|
||||||
if (APPLICATION->settings()->get("CloseAfterLaunch").toBoolean())
|
if (APPLICATION->settings()->get("CloseAfterLaunch").toBool())
|
||||||
APPLICATION->showMainWindow();
|
APPLICATION->showMainWindow();
|
||||||
m_parent->setPid(-1);
|
m_parent->setPid(-1);
|
||||||
// if the exit code wasn't 0, report this as a crash
|
// if the exit code wasn't 0, report this as a crash
|
||||||
|
@ -292,7 +292,6 @@ void LauncherPage::applySettings()
|
|||||||
s->set("ShowConsole", ui->showConsoleCheck->isChecked());
|
s->set("ShowConsole", ui->showConsoleCheck->isChecked());
|
||||||
s->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked());
|
s->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked());
|
||||||
s->set("ShowConsoleOnError", ui->showConsoleErrorCheck->isChecked());
|
s->set("ShowConsoleOnError", ui->showConsoleErrorCheck->isChecked());
|
||||||
s->set("CloseAfterLaunch", ui->closeAfterLaunchCheck->isChecked());
|
|
||||||
QString consoleFontFamily = ui->consoleFont->currentFont().family();
|
QString consoleFontFamily = ui->consoleFont->currentFont().family();
|
||||||
s->set("ConsoleFont", consoleFontFamily);
|
s->set("ConsoleFont", consoleFontFamily);
|
||||||
s->set("ConsoleFontSize", ui->fontSizeBox->value());
|
s->set("ConsoleFontSize", ui->fontSizeBox->value());
|
||||||
@ -381,7 +380,6 @@ void LauncherPage::loadSettings()
|
|||||||
ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool());
|
ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool());
|
||||||
ui->autoCloseConsoleCheck->setChecked(s->get("AutoCloseConsole").toBool());
|
ui->autoCloseConsoleCheck->setChecked(s->get("AutoCloseConsole").toBool());
|
||||||
ui->showConsoleErrorCheck->setChecked(s->get("ShowConsoleOnError").toBool());
|
ui->showConsoleErrorCheck->setChecked(s->get("ShowConsoleOnError").toBool());
|
||||||
ui->closeAfterLaunchCheck->setChecked(s->get("CloseAfterLaunch").toBool());
|
|
||||||
QString fontFamily = APPLICATION->settings()->get("ConsoleFont").toString();
|
QString fontFamily = APPLICATION->settings()->get("ConsoleFont").toString();
|
||||||
QFont consoleFont(fontFamily);
|
QFont consoleFont(fontFamily);
|
||||||
ui->consoleFont->setCurrentFont(consoleFont);
|
ui->consoleFont->setCurrentFont(consoleFont);
|
||||||
|
@ -382,13 +382,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="closeAfterLaunchCheck">
|
|
||||||
<property name="text">
|
|
||||||
<string>Hide console when game window opens?</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -71,6 +71,9 @@ void MinecraftPage::applySettings()
|
|||||||
s->set("ShowGameTime", ui->showGameTime->isChecked());
|
s->set("ShowGameTime", ui->showGameTime->isChecked());
|
||||||
s->set("ShowGlobalGameTime", ui->showGlobalGameTime->isChecked());
|
s->set("ShowGlobalGameTime", ui->showGlobalGameTime->isChecked());
|
||||||
s->set("RecordGameTime", ui->recordGameTime->isChecked());
|
s->set("RecordGameTime", ui->recordGameTime->isChecked());
|
||||||
|
|
||||||
|
// Miscellaneous
|
||||||
|
s->set("CloseAfterLaunch", ui->closeAfterLaunchCheck->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinecraftPage::loadSettings()
|
void MinecraftPage::loadSettings()
|
||||||
@ -88,4 +91,6 @@ void MinecraftPage::loadSettings()
|
|||||||
ui->showGameTime->setChecked(s->get("ShowGameTime").toBool());
|
ui->showGameTime->setChecked(s->get("ShowGameTime").toBool());
|
||||||
ui->showGlobalGameTime->setChecked(s->get("ShowGlobalGameTime").toBool());
|
ui->showGlobalGameTime->setChecked(s->get("ShowGlobalGameTime").toBool());
|
||||||
ui->recordGameTime->setChecked(s->get("RecordGameTime").toBool());
|
ui->recordGameTime->setChecked(s->get("RecordGameTime").toBool());
|
||||||
|
|
||||||
|
ui->closeAfterLaunchCheck->setChecked(s->get("CloseAfterLaunch").toBool());
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,25 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Miscellaneous</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="closeAfterLaunchCheck">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>PolyMC will automatically reopen when the game crashes or exits.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Close PolyMC after game window opens</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacerMinecraft">
|
<spacer name="verticalSpacerMinecraft">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -184,7 +203,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>tabWidget</tabstop>
|
|
||||||
<tabstop>maximizedCheckBox</tabstop>
|
<tabstop>maximizedCheckBox</tabstop>
|
||||||
<tabstop>windowWidthSpinBox</tabstop>
|
<tabstop>windowWidthSpinBox</tabstop>
|
||||||
<tabstop>windowHeightSpinBox</tabstop>
|
<tabstop>windowHeightSpinBox</tabstop>
|
||||||
|
@ -73,14 +73,12 @@ void InstanceSettingsPage::applySettings()
|
|||||||
m_settings->set("ShowConsole", ui->showConsoleCheck->isChecked());
|
m_settings->set("ShowConsole", ui->showConsoleCheck->isChecked());
|
||||||
m_settings->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked());
|
m_settings->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked());
|
||||||
m_settings->set("ShowConsoleOnError", ui->showConsoleErrorCheck->isChecked());
|
m_settings->set("ShowConsoleOnError", ui->showConsoleErrorCheck->isChecked());
|
||||||
m_settings->set("CloseAfterLaunch", ui->closeAfterLaunchCheck->isChecked());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_settings->reset("ShowConsole");
|
m_settings->reset("ShowConsole");
|
||||||
m_settings->reset("AutoCloseConsole");
|
m_settings->reset("AutoCloseConsole");
|
||||||
m_settings->reset("ShowConsoleOnError");
|
m_settings->reset("ShowConsoleOnError");
|
||||||
m_settings->reset("CloseAfterLaunch");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Window Size
|
// Window Size
|
||||||
@ -217,7 +215,6 @@ void InstanceSettingsPage::loadSettings()
|
|||||||
ui->showConsoleCheck->setChecked(m_settings->get("ShowConsole").toBool());
|
ui->showConsoleCheck->setChecked(m_settings->get("ShowConsole").toBool());
|
||||||
ui->autoCloseConsoleCheck->setChecked(m_settings->get("AutoCloseConsole").toBool());
|
ui->autoCloseConsoleCheck->setChecked(m_settings->get("AutoCloseConsole").toBool());
|
||||||
ui->showConsoleErrorCheck->setChecked(m_settings->get("ShowConsoleOnError").toBool());
|
ui->showConsoleErrorCheck->setChecked(m_settings->get("ShowConsoleOnError").toBool());
|
||||||
ui->closeAfterLaunchCheck->setChecked(m_settings->get("CloseAfterLaunch").toBool());
|
|
||||||
|
|
||||||
// Window Size
|
// Window Size
|
||||||
ui->windowSizeGroupBox->setChecked(m_settings->get("OverrideWindow").toBool());
|
ui->windowSizeGroupBox->setChecked(m_settings->get("OverrideWindow").toBool());
|
||||||
|
@ -336,13 +336,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="closeAfterLaunchCheck">
|
|
||||||
<property name="text">
|
|
||||||
<string>Hide console when game window opens?</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user