diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index 60e377afb..a0df2fb82 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -19,23 +19,6 @@ #include "datafilespage.hpp" -#include -/** - * Workaround for problems with whitespaces in paths in older versions of Boost library - */ -#if (BOOST_VERSION <= 104600) -namespace boost -{ - - template<> - inline boost::filesystem::path lexical_cast(const std::string& arg) - { - return boost::filesystem::path(arg); - } - -} /* namespace boost */ -#endif /* (BOOST_VERSION <= 104600) */ - using namespace ESM; using namespace std; @@ -241,7 +224,7 @@ void DataFilesPage::setupDataFiles() mDataFilesModel->sort(3); QStringList profiles = mLauncherSettings.subKeys(QString("Profiles/")); - QString profile = mLauncherSettings.value(QString("Profiles/CurrentProfile")); + QString profile = mLauncherSettings.value(QString("Profiles/currentprofile")); mProfilesComboBox->setCurrentIndex(-1); mProfilesComboBox->addItems(profiles); @@ -271,7 +254,7 @@ void DataFilesPage::setupDataFiles() void DataFilesPage::loadSettings() { - QString profile = mLauncherSettings.value(QString("Profiles/CurrentProfile")); + QString profile = mLauncherSettings.value(QString("Profiles/currentprofile")); if (profile.isEmpty()) return; @@ -299,10 +282,12 @@ void DataFilesPage::saveSettings() if (mDataFilesModel->rowCount() < 1) return; - QString profile = mLauncherSettings.value(QString("Profiles/CurrentProfile")); + QString profile = mLauncherSettings.value(QString("Profiles/currentprofile")); - if (profile.isEmpty()) - return; + if (profile.isEmpty()) { + profile = mProfilesComboBox->currentText(); + mLauncherSettings.setValue(QString("Profiles/currentprofile"), profile); + } mLauncherSettings.remove(QString("Profiles/") + profile + QString("/master")); mLauncherSettings.remove(QString("Profiles/") + profile + QString("/plugin")); @@ -539,9 +524,9 @@ void DataFilesPage::profileChanged(const QString &previous, const QString &curre return; // Profile was deleted // Store the previous profile - mLauncherSettings.setValue(QString("Profiles/CurrentProfile"), previous); + mLauncherSettings.setValue(QString("Profiles/currentprofile"), previous); saveSettings(); - mLauncherSettings.setValue(QString("Profiles/CurrentProfile"), current); + mLauncherSettings.setValue(QString("Profiles/currentprofile"), current); loadSettings(); } @@ -552,7 +537,7 @@ void DataFilesPage::profileRenamed(const QString &previous, const QString &curre return; // Save the new profile name - mLauncherSettings.setValue(QString("Profiles/CurrentProfile"), current); + mLauncherSettings.setValue(QString("Profiles/currentprofile"), current); saveSettings(); // Remove the old one diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 49002e87e..b5a00b14c 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -196,7 +196,7 @@ void GraphicsPage::loadSettings() resolution.append(QString(" x ") + mGraphicsSettings.value(QString("Video/resolution y"))); int resIndex = mResolutionComboBox->findText(resolution, Qt::MatchStartsWith); - qDebug() << "resolution from file: " << resolution; + if (resIndex != -1) mResolutionComboBox->setCurrentIndex(resIndex); } diff --git a/apps/launcher/settings/gamesettings.cpp b/apps/launcher/settings/gamesettings.cpp index c08179acc..af78757b7 100644 --- a/apps/launcher/settings/gamesettings.cpp +++ b/apps/launcher/settings/gamesettings.cpp @@ -8,6 +8,23 @@ #include +#include +/** + * Workaround for problems with whitespaces in paths in older versions of Boost library + */ +#if (BOOST_VERSION <= 104600) +namespace boost +{ + + template<> + inline boost::filesystem::path lexical_cast(const std::string& arg) + { + return boost::filesystem::path(arg); + } + +} /* namespace boost */ +#endif /* (BOOST_VERSION <= 104600) */ + #include "gamesettings.hpp" GameSettings::GameSettings(Files::ConfigurationManager &cfg) @@ -93,6 +110,8 @@ bool GameSettings::readFile(QTextStream &stream) mSettings.remove(key); QStringList values = cache.values(key); + values.append(mSettings.values(key)); + if (!values.contains(value)) { cache.insertMulti(key, value); } @@ -125,9 +144,16 @@ bool GameSettings::writeFile(QTextStream &stream) continue; // Quote paths with spaces - if (i.key() == QLatin1String("data")) { - if (i.value().contains(" ")) { - stream << i.key() << "=\"" << i.value() << "\"\n"; + if (i.key() == QLatin1String("data") + || i.key() == QLatin1String("data-local") + || i.key() == QLatin1String("resources")) + { + if (i.value().contains(QChar(' '))) + { + QString stripped = i.value(); + stripped.remove(QChar('\"')); // Remove quotes + + stream << i.key() << "=\"" << stripped << "\"\n"; continue; } } diff --git a/apps/launcher/settings/launchersettings.cpp b/apps/launcher/settings/launchersettings.cpp index e9730c235..ee529d891 100644 --- a/apps/launcher/settings/launchersettings.cpp +++ b/apps/launcher/settings/launchersettings.cpp @@ -66,6 +66,7 @@ bool LauncherSettings::writeFile(QTextStream &stream) QString sectionPrefix; QRegExp sectionRe("([^/]+)/(.+)$"); QMap settings = SettingsBase::getSettings(); + qDebug() << "writing " << settings; QMapIterator i(settings); i.toBack(); @@ -81,6 +82,13 @@ bool LauncherSettings::writeFile(QTextStream &stream) key = sectionRe.cap(2); } + // Get rid of legacy settings + if (key.contains(QChar('\\'))) + continue; + + if (key == QLatin1String("CurrentProfile")) + continue; + if (sectionPrefix != prefix) { sectionPrefix = prefix; stream << "\n[" << prefix << "]\n";