summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEran Mizrahi <erasmux@gmail.com>2017-12-08 11:00:57 +0200
committerEran Mizrahi <erasmux@gmail.com>2017-12-10 02:53:08 +0200
commit54fd26fee15c320c363a4be355c80e4b7ce38164 (patch)
treecaab9d0f9e2998f753884ca4478f27575c270fd9 /src
parent0aaece55d8b5bb392523db4ee96029d0567294e8 (diff)
new diagnostics settings dialog tab
Diffstat (limited to 'src')
-rw-r--r--src/settings.cpp37
-rw-r--r--src/settings.h25
-rw-r--r--src/settingsdialog.ui225
3 files changed, 237 insertions, 50 deletions
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 <http://www.gnu.org/licenses/>.
#include <iplugin.h>
#include <iplugingame.h>
#include <questionboxmemory.h>
+#include <usvfs.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"))
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 <http://www.gnu.org/licenses/>.
class QCheckBox;
class QComboBox;
class QLineEdit;
+class QSpinBox;
class QListWidget;
class QWidget;
@@ -205,6 +206,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
*
* @param username username
@@ -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
@@ -71,48 +71,6 @@ p, li { white-space: pre-wrap; }
</layout>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_6">
- <item>
- <widget class="QLabel" name="label_12">
- <property name="text">
- <string>Log Level</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="logLevelBox">
- <property name="toolTip">
- <string>Decides the amount of data printed to &quot;ModOrganizer.log&quot;</string>
- </property>
- <property name="whatsThis">
- <string>Decides the amount of data printed to &quot;ModOrganizer.log&quot;.
-&quot;Debug&quot; 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 &quot;Info&quot; level for regluar use. On the &quot;Error&quot; level the log file usually remains empty.</string>
- </property>
- <item>
- <property name="text">
- <string>Debug</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Info</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Warning</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Error</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- <item>
<widget class="QCheckBox" name="usePrereleaseBox">
<property name="toolTip">
<string>Update to non-stable releases.</string>
@@ -378,7 +336,188 @@ If you use pre-releases, never contact me directly by e-mail or via private mess
</item>
</layout>
</widget>
- <widget class="QWidget" name="nexusTab">
+ <widget class="QWidget" name="diagnosticsTab">
+ <attribute name="title">
+ <string>Diagnostics</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QLabel" name="label_12">
+ <property name="text">
+ <string>Log Level</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="logLevelBox">
+ <property name="toolTip">
+ <string>Decides the amount of data printed to &quot;ModOrganizer.log&quot;</string>
+ </property>
+ <property name="whatsThis">
+ <string>
+ Decides the amount of data printed to &quot;ModOrganizer.log&quot;.
+ &quot;Debug&quot; 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 &quot;Info&quot; level for regluar use. On the &quot;Error&quot; level the log file usually remains empty.
+ </string>
+ </property>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Info (recommended)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Warning</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Error</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <spacer name="verticalSpacer_9">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_12">
+ <item>
+ <widget class="QLabel" name="label_27">
+ <property name="text">
+ <string>Crash Dumps</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="dumpsTypeBox">
+ <property name="toolTip">
+ <string>Decides which type of crash dumps are collected when injected processes crash.</string>
+ </property>
+ <property name="whatsThis">
+ <string>
+ Decides which type of crash dumps are collected when injected processes crash.
+ &quot;None&quot; Disables the generation of crash dumps by MO.
+ &quot;Mini&quot; Default level which generates small dumps (only stack traces).
+ &quot;Data&quot; Much larger dumps with additional information which may be need (also data segments).
+ &quot;Full&quot; Even larger dumps with a full memory dump of the process.
+ </string>
+ </property>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Mini (recommended)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Data</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Full</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_13">
+ <item>
+ <widget class="QLabel" name="label_28">
+ <property name="text">
+ <string>Max Dumps To Keep</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_6">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>60</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="dumpsMaxEdit">
+ <property name="toolTip">
+ <string>Maximum number of crash dumps to keep on disk. Use 0 for unlimited.</string>
+ </property>
+ <property name="whatsThis">
+ <string>
+ Maximum number of crash dumps to keep on disk. Use 0 for unlimited.
+ Set "Crash Dumps" above to None to disable crash dump collection.
+ </string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_29">
+ <property name="text">
+ <string>
+ Dumps are stored in &lt;a href=&quot;%LOCALAPPDATA%\modorganizer&quot;&gt;%LOCALAPPDATA%\modorganizer&lt;/a&gt;.
+ 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.
+ </string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip">
+ <string>Hint: right click link and copy link location</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <spacer name="verticalSpacer_10">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>232</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="nexusTab">
<attribute name="title">
<string>Nexus</string>
</attribute>