Utils: Simplify from/toSettings API

Change-Id: I591b6f833342ba9bd1a282332de5bb620d7f8c76
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Orgad Shaneh
2021-12-01 15:41:12 +02:00
committed by Orgad Shaneh
parent 64ac719ff8
commit ef30831213
22 changed files with 223 additions and 242 deletions

View File

@@ -216,23 +216,25 @@ void ICodeStylePreferences::toSettings(const QString &category, QSettings *s) co
Utils::toSettings(d->m_settingsSuffix, category, s, this);
}
void ICodeStylePreferences::fromSettings(const QString &category, const QSettings *s)
void ICodeStylePreferences::fromSettings(const QString &category, QSettings *s)
{
Utils::fromSettings(d->m_settingsSuffix, category, s, this);
}
void ICodeStylePreferences::toMap(const QString &prefix, QVariantMap *map) const
QVariantMap ICodeStylePreferences::toMap() const
{
QVariantMap map;
if (!currentDelegate())
d->m_tabSettings.toMap(prefix, map);
else
map->insert(prefix + QLatin1String(currentPreferencesKey), currentDelegateId());
return d->m_tabSettings.toMap();
return {
{currentPreferencesKey, currentDelegateId()}
};
}
void ICodeStylePreferences::fromMap(const QString &prefix, const QVariantMap &map)
void ICodeStylePreferences::fromMap(const QVariantMap &map)
{
d->m_tabSettings.fromMap(prefix, map);
const QByteArray delegateId = map.value(prefix + QLatin1String(currentPreferencesKey)).toByteArray();
d->m_tabSettings.fromMap(map);
const QByteArray delegateId = map.value(currentPreferencesKey).toByteArray();
if (delegatingPool()) {
ICodeStylePreferences *delegate = delegatingPool()->codeStyle(delegateId);
if (!delegateId.isEmpty() && delegate)