From 3780a25d27ae5c803ce9ed075928fff365104987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 4 Nov 2016 00:19:32 +0100 Subject: NOISSUE add an option to show console on error and default other options to false --- application/LaunchController.cpp | 7 ++++++- application/LaunchController.h | 5 ----- application/MultiMC.cpp | 6 +++--- application/pages/InstanceSettingsPage.cpp | 3 +++ application/pages/InstanceSettingsPage.ui | 10 +++++++++- application/pages/global/MultiMCPage.cpp | 2 ++ application/pages/global/MultiMCPage.ui | 10 +++++++++- 7 files changed, 32 insertions(+), 11 deletions(-) (limited to 'application') diff --git a/application/LaunchController.cpp b/application/LaunchController.cpp index 13f453ef..eaeb9b28 100644 --- a/application/LaunchController.cpp +++ b/application/LaunchController.cpp @@ -206,7 +206,8 @@ void LaunchController::launchInstance() } auto console = qobject_cast(m_parentWidget); - if(!console && m_showConsole) + auto showConsole = m_instance->settings()->get("ShowConsole").toBool(); + if(!console && showConsole) { MMC->showInstanceWindow(m_instance); } @@ -273,6 +274,10 @@ void LaunchController::onSucceeded() void LaunchController::onFailed(QString reason) { + if(m_instance->settings()->get("ShowConsoleOnError").toBool()) + { + MMC->showInstanceWindow(m_instance, "console"); + } emitFailed(reason); } diff --git a/application/LaunchController.h b/application/LaunchController.h index 4cc240e8..81f3a0ab 100644 --- a/application/LaunchController.h +++ b/application/LaunchController.h @@ -33,10 +33,6 @@ public: { m_parentWidget = widget; } - void setShowConsole(bool showConsole) - { - m_showConsole = showConsole; - } QString id() { return m_instance->id(); @@ -56,7 +52,6 @@ private slots: private: BaseProfilerFactory *m_profiler = nullptr; bool m_online = true; - bool m_showConsole = false; InstancePtr m_instance; QWidget * m_parentWidget = nullptr; InstanceWindow *m_console = nullptr; diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp index b3615580..969e54e5 100644 --- a/application/MultiMC.cpp +++ b/application/MultiMC.cpp @@ -542,8 +542,9 @@ void MultiMC::initGlobalSettings() m_settings->registerSetting("Language", QLocale(QLocale::system().language()).bcp47Name()); // Console - m_settings->registerSetting("ShowConsole", true); - m_settings->registerSetting("AutoCloseConsole", true); + m_settings->registerSetting("ShowConsole", false); + m_settings->registerSetting("AutoCloseConsole", false); + m_settings->registerSetting("ShowConsoleOnError", true); m_settings->registerSetting("LogPrePostOutput", true); // Console Colors @@ -1087,7 +1088,6 @@ void MultiMC::launch(InstancePtr instance, bool online, BaseProfilerFactory *pro controller->setInstance(instance); controller->setOnline(online); controller->setProfiler(profiler); - controller->setShowConsole(instance->settings()->get("ShowConsole").toBool()); if(window) { controller->setParentWidget(window); diff --git a/application/pages/InstanceSettingsPage.cpp b/application/pages/InstanceSettingsPage.cpp index 2922e469..82438583 100644 --- a/application/pages/InstanceSettingsPage.cpp +++ b/application/pages/InstanceSettingsPage.cpp @@ -47,11 +47,13 @@ void InstanceSettingsPage::applySettings() { m_settings->set("ShowConsole", ui->showConsoleCheck->isChecked()); m_settings->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked()); + m_settings->set("ShowConsoleOnError", ui->showConsoleErrorCheck->isChecked()); } else { m_settings->reset("ShowConsole"); m_settings->reset("AutoCloseConsole"); + m_settings->reset("ShowConsoleOnError"); } // Window Size @@ -137,6 +139,7 @@ void InstanceSettingsPage::loadSettings() ui->consoleSettingsBox->setChecked(m_settings->get("OverrideConsole").toBool()); ui->showConsoleCheck->setChecked(m_settings->get("ShowConsole").toBool()); ui->autoCloseConsoleCheck->setChecked(m_settings->get("AutoCloseConsole").toBool()); + ui->showConsoleErrorCheck->setChecked(m_settings->get("ShowConsoleOnError").toBool()); // Window Size ui->windowSizeGroupBox->setChecked(m_settings->get("OverrideWindow").toBool()); diff --git a/application/pages/InstanceSettingsPage.ui b/application/pages/InstanceSettingsPage.ui index bcc5f9a8..d1ad0c60 100644 --- a/application/pages/InstanceSettingsPage.ui +++ b/application/pages/InstanceSettingsPage.ui @@ -7,7 +7,7 @@ 0 0 458 - 426 + 508 @@ -332,6 +332,13 @@ + + + + Show console when the game crashes? + + + @@ -458,6 +465,7 @@ consoleSettingsBox showConsoleCheck autoCloseConsoleCheck + showConsoleErrorCheck customCommandsGroupBox preLaunchCmdTextBox wrapperCmdTextBox diff --git a/application/pages/global/MultiMCPage.cpp b/application/pages/global/MultiMCPage.cpp index 9694fab5..e9b19ac6 100644 --- a/application/pages/global/MultiMCPage.cpp +++ b/application/pages/global/MultiMCPage.cpp @@ -317,6 +317,7 @@ void MultiMCPage::applySettings() // Console settings s->set("ShowConsole", ui->showConsoleCheck->isChecked()); s->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked()); + s->set("ShowConsoleOnError", ui->showConsoleErrorCheck->isChecked()); QString consoleFontFamily = ui->consoleFont->currentFont().family(); s->set("ConsoleFont", consoleFontFamily); s->set("ConsoleFontSize", ui->fontSizeBox->value()); @@ -413,6 +414,7 @@ void MultiMCPage::loadSettings() // Console settings ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool()); ui->autoCloseConsoleCheck->setChecked(s->get("AutoCloseConsole").toBool()); + ui->showConsoleErrorCheck->setChecked(s->get("ShowConsoleOnError").toBool()); QString fontFamily = MMC->settings()->get("ConsoleFont").toString(); QFont consoleFont(fontFamily); ui->consoleFont->setCurrentFont(consoleFont); diff --git a/application/pages/global/MultiMCPage.ui b/application/pages/global/MultiMCPage.ui index 2d6f45f0..5336afdb 100644 --- a/application/pages/global/MultiMCPage.ui +++ b/application/pages/global/MultiMCPage.ui @@ -7,7 +7,7 @@ 0 0 487 - 557 + 614 @@ -456,6 +456,13 @@ + + + + Show console when the game crashes? + + + @@ -588,6 +595,7 @@ themeComboBoxColors showConsoleCheck autoCloseConsoleCheck + showConsoleErrorCheck lineLimitSpinBox checkStopLogging consoleFont -- cgit v1.2.3