Core: Save less settings

Try to not save settings that weren't changed from their default, and
make it possible for defaults to change in the future.

Task-number: QTCREATORBUG-24762
Change-Id: If469b72573791bc92ed535edf00271ef09b55386
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Eike Ziller
2020-12-10 11:24:27 +01:00
parent e2eab0e016
commit a40e5b5382
19 changed files with 140 additions and 84 deletions

View File

@@ -894,14 +894,20 @@ void FindToolBar::resizeEvent(QResizeEvent *event)
void FindToolBar::writeSettings()
{
QSettings *settings = ICore::settings();
settings->beginGroup(QLatin1String("Find"));
settings->beginGroup(QLatin1String("FindToolBar"));
settings->setValue(QLatin1String("Backward"), QVariant((m_findFlags & FindBackward) != 0));
settings->setValue(QLatin1String("CaseSensitively"), QVariant((m_findFlags & FindCaseSensitively) != 0));
settings->setValue(QLatin1String("WholeWords"), QVariant((m_findFlags & FindWholeWords) != 0));
settings->setValue(QLatin1String("RegularExpression"), QVariant((m_findFlags & FindRegularExpression) != 0));
settings->setValue(QLatin1String("PreserveCase"), QVariant((m_findFlags & FindPreserveCase) != 0));
Utils::QtcSettings *settings = ICore::settings();
settings->beginGroup("Find");
settings->beginGroup("FindToolBar");
settings->setValueWithDefault("Backward", bool((m_findFlags & FindBackward) != 0), false);
settings->setValueWithDefault("CaseSensitively",
bool((m_findFlags & FindCaseSensitively) != 0),
false);
settings->setValueWithDefault("WholeWords", bool((m_findFlags & FindWholeWords) != 0), false);
settings->setValueWithDefault("RegularExpression",
bool((m_findFlags & FindRegularExpression) != 0),
false);
settings->setValueWithDefault("PreserveCase",
bool((m_findFlags & FindPreserveCase) != 0),
false);
settings->endGroup();
settings->endGroup();
}