forked from teamnwah/openmw-tes3coop
Revert "Remove user preference setting option."
This reverts commit d3b7cf44d3
.
This commit is contained in:
parent
c560f8b8a2
commit
b7cd62e4de
3 changed files with 37 additions and 3 deletions
|
@ -490,7 +490,16 @@ bool Launcher::MainDialog::writeSettings()
|
||||||
// Game settings
|
// Game settings
|
||||||
QFile file(userPath + QString("openmw.cfg"));
|
QFile file(userPath + QString("openmw.cfg"));
|
||||||
|
|
||||||
if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
QIODevice::OpenMode mode(0);
|
||||||
|
bool keepComments = mLauncherSettings.value(QString("Settings/keep-comments"), QString("true"))
|
||||||
|
== QLatin1String("true");
|
||||||
|
|
||||||
|
if (keepComments)
|
||||||
|
mode = QIODevice::ReadWrite | QIODevice::Text;
|
||||||
|
else
|
||||||
|
mode = QIODevice::ReadWrite | QIODevice::Text | QIODevice::Truncate;
|
||||||
|
|
||||||
|
if (!file.open(mode)) {
|
||||||
// File cannot be opened or created
|
// File cannot be opened or created
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setWindowTitle(tr("Error writing OpenMW configuration file"));
|
msgBox.setWindowTitle(tr("Error writing OpenMW configuration file"));
|
||||||
|
@ -503,8 +512,16 @@ bool Launcher::MainDialog::writeSettings()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QTextStream stream(&file);
|
||||||
|
|
||||||
|
if (keepComments)
|
||||||
|
mGameSettings.writeFileWithComments(file);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stream.setCodec(QTextCodec::codecForName("UTF-8"));
|
||||||
|
mGameSettings.writeFile(stream);
|
||||||
|
}
|
||||||
|
|
||||||
mGameSettings.writeFileWithComments(file);
|
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
// Graphics settings
|
// Graphics settings
|
||||||
|
@ -523,7 +540,6 @@ bool Launcher::MainDialog::writeSettings()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream stream(&file);
|
|
||||||
stream.setDevice(&file);
|
stream.setDevice(&file);
|
||||||
stream.setCodec(QTextCodec::codecForName("UTF-8"));
|
stream.setCodec(QTextCodec::codecForName("UTF-8"));
|
||||||
|
|
||||||
|
|
|
@ -260,6 +260,10 @@ void Launcher::SettingsPage::saveSettings()
|
||||||
} else {
|
} else {
|
||||||
mGameSettings.setValue(QLatin1String("encoding"), QLatin1String("win1252"));
|
mGameSettings.setValue(QLatin1String("encoding"), QLatin1String("win1252"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString keepComments(saveCommentsCheckBox->isChecked() ? "true" : "false");
|
||||||
|
|
||||||
|
mLauncherSettings.setValue(QLatin1String("Settings/keep-comments"), keepComments);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Launcher::SettingsPage::loadSettings()
|
bool Launcher::SettingsPage::loadSettings()
|
||||||
|
@ -271,5 +275,9 @@ bool Launcher::SettingsPage::loadSettings()
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
languageComboBox->setCurrentIndex(index);
|
languageComboBox->setCurrentIndex(index);
|
||||||
|
|
||||||
|
QString keepComments(mLauncherSettings.value(QLatin1String("Settings/keep-comments")));
|
||||||
|
|
||||||
|
saveCommentsCheckBox->setChecked(keepComments == "true");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,16 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="saveCommentsCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Keep comments in openmw.cfg</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in a new issue