From 54fd26fee15c320c363a4be355c80e4b7ce38164 Mon Sep 17 00:00:00 2001 From: Eran Mizrahi Date: Fri, 8 Dec 2017 11:00:57 +0200 Subject: new diagnostics settings dialog tab --- src/settings.cpp | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'src/settings.cpp') diff --git a/src/settings.cpp b/src/settings.cpp index fc740302..7d90d861 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -28,6 +28,7 @@ along with Mod Organizer. If not, see . #include #include #include +#include #include #include @@ -38,6 +39,7 @@ along with Mod Organizer. If not, see . #include #include #include +#include #include #include #include @@ -334,9 +336,18 @@ bool Settings::offlineMode() const int Settings::logLevel() const { - return m_Settings.value("Settings/log_level", 0).toInt(); + return m_Settings.value("Settings/log_level", static_cast(LogLevel::Info)).toInt(); } +int Settings::crashDumpsType() const +{ + return m_Settings.value("Settings/crash_dumps_type", static_cast(CrashDumpsType::Mini)).toInt(); +} + +int Settings::crashDumpsMax() const +{ + return m_Settings.value("Settings/crash_dumps_max", 5).toInt(); +} void Settings::setNexusLogin(QString username, QString password) { @@ -581,6 +592,7 @@ void Settings::query(QWidget *parent) tabs.push_back(std::unique_ptr(new GeneralTab(this, dialog))); tabs.push_back(std::unique_ptr(new PathsTab(this, dialog))); + tabs.push_back(std::unique_ptr(new DiagnosticsTab(this, dialog))); tabs.push_back(std::unique_ptr(new NexusTab(this, dialog))); tabs.push_back(std::unique_ptr(new SteamTab(this, dialog))); tabs.push_back(std::unique_ptr(new PluginsTab(this, dialog))); @@ -608,7 +620,6 @@ Settings::GeneralTab::GeneralTab(Settings *m_parent, SettingsDialog &m_dialog) : Settings::SettingsTab(m_parent, m_dialog) , m_languageBox(m_dialog.findChild("languageBox")) , m_styleBox(m_dialog.findChild("styleBox")) - , m_logLevelBox(m_dialog.findChild("logLevelBox")) , m_compactBox(m_dialog.findChild("compactBox")) , m_showMetaBox(m_dialog.findChild("showMetaBox")) , m_usePrereleaseBox(m_dialog.findChild("usePrereleaseBox")) @@ -640,7 +651,6 @@ Settings::GeneralTab::GeneralTab(Settings *m_parent, SettingsDialog &m_dialog) } } - m_logLevelBox->setCurrentIndex(m_parent->logLevel()); m_compactBox->setChecked(m_parent->compactDownloads()); m_showMetaBox->setChecked(m_parent->metaDownloads()); m_usePrereleaseBox->setChecked(m_parent->usePrereleases()); @@ -662,9 +672,6 @@ void Settings::GeneralTab::update() emit m_parent->styleChanged(newStyle); } - m_Settings.setValue("Settings/log_level", m_logLevelBox->currentIndex()); - - m_Settings.setValue("Settings/compact_downloads", m_compactBox->isChecked()); m_Settings.setValue("Settings/meta_downloads", m_showMetaBox->isChecked()); m_Settings.setValue("Settings/use_prereleases", m_usePrereleaseBox->isChecked()); @@ -743,6 +750,24 @@ void Settings::PathsTab::update() } } +Settings::DiagnosticsTab::DiagnosticsTab(Settings *m_parent, SettingsDialog &m_dialog) + : Settings::SettingsTab(m_parent, m_dialog) + , m_logLevelBox(m_dialog.findChild("logLevelBox")) + , m_dumpsTypeBox(m_dialog.findChild("dumpsTypeBox")) + , m_dumpsMaxEdit(m_dialog.findChild("dumpsMaxEdit")) +{ + m_logLevelBox->setCurrentIndex(m_parent->logLevel()); + m_dumpsTypeBox->setCurrentIndex(m_parent->crashDumpsType()); + m_dumpsMaxEdit->setValue(m_parent->crashDumpsMax()); +} + +void Settings::DiagnosticsTab::update() +{ + m_Settings.setValue("Settings/log_level", m_logLevelBox->currentIndex()); + m_Settings.setValue("Settings/crash_dumps_type", m_dumpsTypeBox->currentIndex()); + m_Settings.setValue("Settings/crash_dumps_max", m_dumpsMaxEdit->value()); +} + Settings::NexusTab::NexusTab(Settings *parent, SettingsDialog &dialog) : Settings::SettingsTab(parent, dialog) , m_loginCheckBox(dialog.findChild("loginCheckBox")) -- cgit v1.3.1