aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer/appoutputpane.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-12-14 17:00:53 +0100
committerEike Ziller <eike.ziller@qt.io>2020-12-16 08:40:24 +0000
commitc8980478805ed6bcdfbf2965cbf6c03492d804e6 (patch)
tree7637ee0aea7eec25ec46a38dedcad06ece797e79 /src/plugins/projectexplorer/appoutputpane.cpp
parent8987996500adea77ac494da5c70e2e489d907353 (diff)
ProjectExplorer: Don't save defaults to settings
Writes less settings and makes it possible to change defaults in the future. Task-number: QTCREATORBUG-24762 Change-Id: I73873b3684827b4fe27cfa5ea2f62a76003f9750 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/appoutputpane.cpp')
-rw-r--r--src/plugins/projectexplorer/appoutputpane.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp
index 658028b2b7..8eb808111f 100644
--- a/src/plugins/projectexplorer/appoutputpane.cpp
+++ b/src/plugins/projectexplorer/appoutputpane.cpp
@@ -510,15 +510,27 @@ void AppOutputPane::setSettings(const AppOutputSettings &settings)
updateFromSettings();
}
+const AppOutputPaneMode kRunOutputModeDefault = AppOutputPaneMode::PopupOnFirstOutput;
+const AppOutputPaneMode kDebugOutputModeDefault = AppOutputPaneMode::FlashOnOutput;
+const bool kCleanOldOutputDefault = false;
+const bool kMergeChannelsDefault = false;
+const bool kWrapOutputDefault = true;
+
void AppOutputPane::storeSettings() const
{
- QSettings * const s = Core::ICore::settings();
- s->setValue(POP_UP_FOR_RUN_OUTPUT_KEY, int(m_settings.runOutputMode));
- s->setValue(POP_UP_FOR_DEBUG_OUTPUT_KEY, int(m_settings.debugOutputMode));
- s->setValue(CLEAN_OLD_OUTPUT_KEY, m_settings.cleanOldOutput);
- s->setValue(MERGE_CHANNELS_KEY, m_settings.mergeChannels);
- s->setValue(WRAP_OUTPUT_KEY, m_settings.wrapOutput);
- s->setValue(MAX_LINES_KEY, m_settings.maxCharCount / 100);
+ Utils::QtcSettings *const s = Core::ICore::settings();
+ s->setValueWithDefault(POP_UP_FOR_RUN_OUTPUT_KEY,
+ int(m_settings.runOutputMode),
+ int(kRunOutputModeDefault));
+ s->setValueWithDefault(POP_UP_FOR_DEBUG_OUTPUT_KEY,
+ int(m_settings.debugOutputMode),
+ int(kDebugOutputModeDefault));
+ s->setValueWithDefault(CLEAN_OLD_OUTPUT_KEY, m_settings.cleanOldOutput, kCleanOldOutputDefault);
+ s->setValueWithDefault(MERGE_CHANNELS_KEY, m_settings.mergeChannels, kMergeChannelsDefault);
+ s->setValueWithDefault(WRAP_OUTPUT_KEY, m_settings.wrapOutput, kWrapOutputDefault);
+ s->setValueWithDefault(MAX_LINES_KEY,
+ m_settings.maxCharCount / 100,
+ Core::Constants::DEFAULT_MAX_CHAR_COUNT);
}
void AppOutputPane::loadSettings()
@@ -527,13 +539,12 @@ void AppOutputPane::loadSettings()
const auto modeFromSettings = [s](const QString key, AppOutputPaneMode defaultValue) {
return static_cast<AppOutputPaneMode>(s->value(key, int(defaultValue)).toInt());
};
- m_settings.runOutputMode = modeFromSettings(POP_UP_FOR_RUN_OUTPUT_KEY,
- AppOutputPaneMode::PopupOnFirstOutput);
+ m_settings.runOutputMode = modeFromSettings(POP_UP_FOR_RUN_OUTPUT_KEY, kRunOutputModeDefault);
m_settings.debugOutputMode = modeFromSettings(POP_UP_FOR_DEBUG_OUTPUT_KEY,
- AppOutputPaneMode::FlashOnOutput);
- m_settings.cleanOldOutput = s->value(CLEAN_OLD_OUTPUT_KEY, false).toBool();
- m_settings.mergeChannels = s->value(MERGE_CHANNELS_KEY, false).toBool();
- m_settings.wrapOutput = s->value(WRAP_OUTPUT_KEY, true).toBool();
+ kDebugOutputModeDefault);
+ m_settings.cleanOldOutput = s->value(CLEAN_OLD_OUTPUT_KEY, kCleanOldOutputDefault).toBool();
+ m_settings.mergeChannels = s->value(MERGE_CHANNELS_KEY, kMergeChannelsDefault).toBool();
+ m_settings.wrapOutput = s->value(WRAP_OUTPUT_KEY, kWrapOutputDefault).toBool();
m_settings.maxCharCount = s->value(MAX_LINES_KEY,
Core::Constants::DEFAULT_MAX_CHAR_COUNT).toInt() * 100;
}