mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-30 07:21:12 +00:00
Settings: reduce scope for better readability
This commit is contained in:
parent
33019b93b4
commit
fb1aa096be
@ -50,7 +50,7 @@ namespace Config
|
|||||||
|
|
||||||
bool readFile(QTextStream &stream)
|
bool readFile(QTextStream &stream)
|
||||||
{
|
{
|
||||||
mCache.clear();
|
Map cache;
|
||||||
|
|
||||||
QString sectionPrefix;
|
QString sectionPrefix;
|
||||||
|
|
||||||
@ -79,31 +79,30 @@ namespace Config
|
|||||||
|
|
||||||
mSettings.remove(key);
|
mSettings.remove(key);
|
||||||
|
|
||||||
QStringList values = mCache.values(key);
|
QStringList values = cache.values(key);
|
||||||
|
|
||||||
if (!values.contains(value)) {
|
if (!values.contains(value)) {
|
||||||
if (mMultiValue) {
|
if (mMultiValue) {
|
||||||
mCache.insertMulti(key, value);
|
cache.insertMulti(key, value);
|
||||||
} else {
|
} else {
|
||||||
mCache.insert(key, value);
|
cache.insert(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSettings.isEmpty()) {
|
if (mSettings.isEmpty()) {
|
||||||
mSettings = mCache; // This is the first time we read a file
|
mSettings = cache; // This is the first time we read a file
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge the changed keys with those which didn't
|
// Merge the changed keys with those which didn't
|
||||||
mSettings.unite(mCache);
|
mSettings.unite(cache);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Map mSettings;
|
Map mSettings;
|
||||||
Map mCache;
|
|
||||||
|
|
||||||
bool mMultiValue;
|
bool mMultiValue;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user