forked from teamnwah/openmw-tes3coop
Some fixes to the settings handlers
This commit is contained in:
parent
4737b20e4c
commit
919d1ee572
2 changed files with 4 additions and 23 deletions
|
@ -88,6 +88,8 @@ bool GameSettings::readFile(QTextStream &stream)
|
|||
QString key = keyRe.cap(1).simplified();
|
||||
QString value = keyRe.cap(2).simplified();
|
||||
|
||||
// Don't remove existing data entries
|
||||
if (key != QLatin1String("data"))
|
||||
mSettings.remove(key);
|
||||
|
||||
QStringList values = cache.values(key);
|
||||
|
@ -103,19 +105,6 @@ bool GameSettings::readFile(QTextStream &stream)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Replace values from previous settings
|
||||
QMapIterator<QString, QString> i(cache);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
|
||||
// Don't remove existing data entries
|
||||
if (i.key() == QLatin1String("data"))
|
||||
continue;
|
||||
|
||||
if (mSettings.contains(i.key()))
|
||||
mSettings.remove(i.key());
|
||||
}
|
||||
|
||||
// Merge the changed keys with those which didn't
|
||||
mSettings.unite(cache);
|
||||
validatePaths();
|
||||
|
@ -136,7 +125,7 @@ bool GameSettings::writeFile(QTextStream &stream)
|
|||
continue;
|
||||
|
||||
// Quote paths with spaces
|
||||
if (i.key() == QLatin1String("data") || i.key() == QLatin1String("data")) {
|
||||
if (i.key() == QLatin1String("data")) {
|
||||
if (i.value().contains(" ")) {
|
||||
stream << i.key() << "=\"" << i.value() << "\"\n";
|
||||
continue;
|
||||
|
|
|
@ -85,14 +85,6 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
// Replace values from previous settings
|
||||
QMapIterator<QString, QString> i(mCache);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
if (mSettings.contains(i.key()))
|
||||
mSettings.remove(i.key());
|
||||
}
|
||||
|
||||
// Merge the changed keys with those which didn't
|
||||
mSettings.unite(mCache);
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue