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 +++++++-- src/settings.h | 25 +++++- src/settingsdialog.ui | 225 ++++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 237 insertions(+), 50 deletions(-) (limited to 'src') 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")) diff --git a/src/settings.h b/src/settings.h index d316c82d..9ee29ba3 100644 --- a/src/settings.h +++ b/src/settings.h @@ -38,6 +38,7 @@ along with Mod Organizer. If not, see . class QCheckBox; class QComboBox; class QLineEdit; +class QSpinBox; class QListWidget; class QWidget; @@ -204,6 +205,16 @@ public: */ int logLevel() const; + /** + * @return the configured crash dumps type + */ + int crashDumpsType() const; + + /** + * @return the configured crash dumps max + */ + int crashDumpsMax() const; + /** * @brief set the nexus login information * @@ -371,7 +382,6 @@ private: private: QComboBox *m_languageBox; QComboBox *m_styleBox; - QComboBox *m_logLevelBox; QCheckBox *m_compactBox; QCheckBox *m_showMetaBox; QCheckBox *m_usePrereleaseBox; @@ -393,6 +403,19 @@ private: QLineEdit *m_overwriteDirEdit; }; + class DiagnosticsTab : public SettingsTab + { + public: + DiagnosticsTab(Settings *parent, SettingsDialog &dialog); + + void update(); + + private: + QComboBox *m_logLevelBox; + QComboBox *m_dumpsTypeBox; + QSpinBox *m_dumpsMaxEdit; + }; + /** Display/store the configuration in the 'nexus' tab of the settings dialogue */ class NexusTab : public SettingsTab { diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index f5e37ea6..632dc6c9 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -70,48 +70,6 @@ p, li { white-space: pre-wrap; } - - - - - - Log Level - - - - - - - Decides the amount of data printed to "ModOrganizer.log" - - - Decides the amount of data printed to "ModOrganizer.log". -"Debug" produces very useful information for finding problems. There is usually no noteworthy performance impact but the file may become rather large. If this is a problem you may prefer the "Info" level for regluar use. On the "Error" level the log file usually remains empty. - - - - Debug - - - - - Info - - - - - Warning - - - - - Error - - - - - - @@ -378,7 +336,188 @@ If you use pre-releases, never contact me directly by e-mail or via private mess - + + + Diagnostics + + + + + + + + Log Level + + + + + + + Decides the amount of data printed to "ModOrganizer.log" + + + + Decides the amount of data printed to "ModOrganizer.log". + "Debug" produces very useful information for finding problems. There is usually no noteworthy performance impact but the file may become rather large. If this is a problem you may prefer the "Info" level for regluar use. On the "Error" level the log file usually remains empty. + + + + + Debug + + + + + Info (recommended) + + + + + Warning + + + + + Error + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Crash Dumps + + + + + + + Decides which type of crash dumps are collected when injected processes crash. + + + + Decides which type of crash dumps are collected when injected processes crash. + "None" Disables the generation of crash dumps by MO. + "Mini" Default level which generates small dumps (only stack traces). + "Data" Much larger dumps with additional information which may be need (also data segments). + "Full" Even larger dumps with a full memory dump of the process. + + + + + None + + + + + Mini (recommended) + + + + + Data + + + + + Full + + + + + + + + + + + + Max Dumps To Keep + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Maximum number of crash dumps to keep on disk. Use 0 for unlimited. + + + + Maximum number of crash dumps to keep on disk. Use 0 for unlimited. + Set "Crash Dumps" above to None to disable crash dump collection. + + + + + + + + + + + Dumps are stored in <a href="%LOCALAPPDATA%\modorganizer">%LOCALAPPDATA%\modorganizer</a>. + Sending such dumps to the developers can help solve crashes caused by MO. + It is recommended to compress the dumps before sending, especially on the larger settings. + + + + true + + + Hint: right click link and copy link location + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 232 + + + + + + + Nexus -- cgit v1.3.1