diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2017-12-09 23:44:21 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-09 23:44:21 -0600 |
| commit | b2d7181ca77980622f27a5e2a27c636d25a0a598 (patch) | |
| tree | c3e2280cf8e2caa025a0856d4f8a7165149e76ac /src/settings.cpp | |
| parent | 0aaece55d8b5bb392523db4ee96029d0567294e8 (diff) | |
| parent | 689248619ada12eb9e50ea40963a04c946cb3e13 (diff) | |
Merge pull request #139 from erasmux/better_diagnostics_and_shortcuts_fix
Better diagnostics and shortcuts fix
Diffstat (limited to 'src/settings.cpp')
| -rw-r--r-- | src/settings.cpp | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index fc740302..05a62591 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -28,6 +28,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <iplugin.h> #include <iplugingame.h> #include <questionboxmemory.h> +#include <usvfsparameters.h> #include <QCheckBox> #include <QCoreApplication> @@ -38,6 +39,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <QDirIterator> #include <QFileInfo> #include <QLineEdit> +#include <QSpinBox> #include <QListWidgetItem> #include <QLocale> #include <QMessageBox> @@ -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<int>(LogLevel::Info)).toInt(); } +int Settings::crashDumpsType() const +{ + return m_Settings.value("Settings/crash_dumps_type", static_cast<int>(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<SettingsTab>(new GeneralTab(this, dialog))); tabs.push_back(std::unique_ptr<SettingsTab>(new PathsTab(this, dialog))); + tabs.push_back(std::unique_ptr<SettingsTab>(new DiagnosticsTab(this, dialog))); tabs.push_back(std::unique_ptr<SettingsTab>(new NexusTab(this, dialog))); tabs.push_back(std::unique_ptr<SettingsTab>(new SteamTab(this, dialog))); tabs.push_back(std::unique_ptr<SettingsTab>(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<QComboBox *>("languageBox")) , m_styleBox(m_dialog.findChild<QComboBox *>("styleBox")) - , m_logLevelBox(m_dialog.findChild<QComboBox *>("logLevelBox")) , m_compactBox(m_dialog.findChild<QCheckBox *>("compactBox")) , m_showMetaBox(m_dialog.findChild<QCheckBox *>("showMetaBox")) , m_usePrereleaseBox(m_dialog.findChild<QCheckBox *>("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<QComboBox *>("logLevelBox")) + , m_dumpsTypeBox(m_dialog.findChild<QComboBox *>("dumpsTypeBox")) + , m_dumpsMaxEdit(m_dialog.findChild<QSpinBox *>("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<QCheckBox *>("loginCheckBox")) |
