mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 19:04:29 +02:00
Reordered a few operations
This commit is contained in:
parent
2a5292732c
commit
92be06bb84
1 changed files with 15 additions and 12 deletions
|
@ -277,12 +277,13 @@ void updateSetting(const QString& key, const QJsonValue& newValue, QVariantMap&
|
||||||
settingMap[key] = QVariantMap();
|
settingMap[key] = QVariantMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap& thisMap = *reinterpret_cast<QVariantMap*>(settingMap[key].data());
|
||||||
foreach(const QString childKey, newValue.toObject().keys()) {
|
foreach(const QString childKey, newValue.toObject().keys()) {
|
||||||
updateSetting(childKey, newValue.toObject()[childKey],
|
updateSetting(childKey, newValue.toObject()[childKey],
|
||||||
*reinterpret_cast<QVariantMap*>(settingMap[key].data()),
|
thisMap,
|
||||||
settingDescription.toObject()[key]);
|
settingDescription.toObject()[key]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingMap[key].toMap().isEmpty()) {
|
if (settingMap[key].toMap().isEmpty()) {
|
||||||
// we've cleared all of the settings below this value, so remove this one too
|
// we've cleared all of the settings below this value, so remove this one too
|
||||||
settingMap.remove(key);
|
settingMap.remove(key);
|
||||||
|
@ -293,31 +294,33 @@ void updateSetting(const QString& key, const QJsonValue& newValue, QVariantMap&
|
||||||
void DomainServerSettingsManager::recurseJSONObjectAndOverwriteSettings(const QJsonObject& postedObject,
|
void DomainServerSettingsManager::recurseJSONObjectAndOverwriteSettings(const QJsonObject& postedObject,
|
||||||
QVariantMap& settingsVariant,
|
QVariantMap& settingsVariant,
|
||||||
const QJsonArray& descriptionArray) {
|
const QJsonArray& descriptionArray) {
|
||||||
|
// Iterate on the setting groups
|
||||||
foreach(const QString& groupKey, postedObject.keys()) {
|
foreach(const QString& groupKey, postedObject.keys()) {
|
||||||
QJsonValue groupValue = postedObject[groupKey];
|
QJsonValue groupValue = postedObject[groupKey];
|
||||||
|
|
||||||
foreach(const QString& settingKey, groupValue.toObject().keys()) {
|
|
||||||
QJsonValue settingValue = groupValue.toObject()[settingKey];
|
|
||||||
|
|
||||||
QJsonValue thisDescription;
|
|
||||||
if (settingExists(groupKey, settingKey, descriptionArray, thisDescription)) {
|
|
||||||
if (!settingsVariant.contains(groupKey)) {
|
if (!settingsVariant.contains(groupKey)) {
|
||||||
// we don't have a map below this key yet, so set it up now
|
// we don't have a map below this key yet, so set it up now
|
||||||
settingsVariant[groupKey] = QVariantMap();
|
settingsVariant[groupKey] = QVariantMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Iterate on the settings
|
||||||
|
foreach(const QString& settingKey, groupValue.toObject().keys()) {
|
||||||
|
QJsonValue settingValue = groupValue.toObject()[settingKey];
|
||||||
|
|
||||||
|
QJsonValue thisDescription;
|
||||||
|
if (settingExists(groupKey, settingKey, descriptionArray, thisDescription)) {
|
||||||
QVariantMap& thisMap = *reinterpret_cast<QVariantMap*>(settingsVariant[groupKey].data());
|
QVariantMap& thisMap = *reinterpret_cast<QVariantMap*>(settingsVariant[groupKey].data());
|
||||||
updateSetting(settingKey, settingValue,
|
updateSetting(settingKey, settingValue,
|
||||||
thisMap,
|
thisMap,
|
||||||
thisDescription);
|
thisDescription);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (settingsVariant[groupKey].toMap().empty()) {
|
if (settingsVariant[groupKey].toMap().empty()) {
|
||||||
// we've cleared all of the settings below this value, so remove this one too
|
// we've cleared all of the settings below this value, so remove this one too
|
||||||
settingsVariant.remove(groupKey);
|
settingsVariant.remove(groupKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainServerSettingsManager::persistToFile() {
|
void DomainServerSettingsManager::persistToFile() {
|
||||||
|
|
Loading…
Reference in a new issue