mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 03:59:56 +00:00
Save/load INI importer flags in the launcher (#8189)
This commit is contained in:
parent
7bbb1bf05d
commit
eea916a43d
4 changed files with 47 additions and 1 deletions
|
@ -197,6 +197,7 @@
|
||||||
Bug #8171: Items with more than 100% health can be repaired
|
Bug #8171: Items with more than 100% health can be repaired
|
||||||
Bug #8172: Openmw-cs crashes when viewing `Dantooine, Sea`
|
Bug #8172: Openmw-cs crashes when viewing `Dantooine, Sea`
|
||||||
Bug #8187: Intervention effects should use Chebyshev distance to determine the closest marker
|
Bug #8187: Intervention effects should use Chebyshev distance to determine the closest marker
|
||||||
|
Bug #8189: The import tab in the launcher doesn't remember the checkbox selection
|
||||||
Bug #8191: NiRollController does not work for sheath meshes
|
Bug #8191: NiRollController does not work for sheath meshes
|
||||||
Feature #1415: Infinite fall failsafe
|
Feature #1415: Infinite fall failsafe
|
||||||
Feature #2566: Handle NAM9 records for manual cell references
|
Feature #2566: Handle NAM9 records for manual cell references
|
||||||
|
|
|
@ -220,9 +220,15 @@ void Launcher::ImportPage::resetProgressBar()
|
||||||
progressBar->reset();
|
progressBar->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher::ImportPage::saveSettings() {}
|
void Launcher::ImportPage::saveSettings()
|
||||||
|
{
|
||||||
|
mLauncherSettings.setImportContentSetup(addonsCheckBox->isChecked());
|
||||||
|
mLauncherSettings.setImportFontSetup(fontsCheckBox->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
bool Launcher::ImportPage::loadSettings()
|
bool Launcher::ImportPage::loadSettings()
|
||||||
{
|
{
|
||||||
|
addonsCheckBox->setChecked(mLauncherSettings.getImportContentSetup());
|
||||||
|
fontsCheckBox->setChecked(mLauncherSettings.getImportFontSetup());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,15 @@ namespace Config
|
||||||
constexpr char sSettingsSection[] = "Settings";
|
constexpr char sSettingsSection[] = "Settings";
|
||||||
constexpr char sGeneralSection[] = "General";
|
constexpr char sGeneralSection[] = "General";
|
||||||
constexpr char sProfilesSection[] = "Profiles";
|
constexpr char sProfilesSection[] = "Profiles";
|
||||||
|
constexpr char sImporterSection[] = "Importer";
|
||||||
constexpr char sLanguageKey[] = "language";
|
constexpr char sLanguageKey[] = "language";
|
||||||
constexpr char sCurrentProfileKey[] = "currentprofile";
|
constexpr char sCurrentProfileKey[] = "currentprofile";
|
||||||
constexpr char sDataKey[] = "data";
|
constexpr char sDataKey[] = "data";
|
||||||
constexpr char sArchiveKey[] = "fallback-archive";
|
constexpr char sArchiveKey[] = "fallback-archive";
|
||||||
constexpr char sContentKey[] = "content";
|
constexpr char sContentKey[] = "content";
|
||||||
constexpr char sFirstRunKey[] = "firstrun";
|
constexpr char sFirstRunKey[] = "firstrun";
|
||||||
|
constexpr char sImportContentSetupKey[] = "importcontentsetup";
|
||||||
|
constexpr char sImportFontSetupKey[] = "importfontsetup";
|
||||||
constexpr char sMainWindowWidthKey[] = "MainWindow/width";
|
constexpr char sMainWindowWidthKey[] = "MainWindow/width";
|
||||||
constexpr char sMainWindowHeightKey[] = "MainWindow/height";
|
constexpr char sMainWindowHeightKey[] = "MainWindow/height";
|
||||||
constexpr char sMainWindowPosXKey[] = "MainWindow/posx";
|
constexpr char sMainWindowPosXKey[] = "MainWindow/posx";
|
||||||
|
@ -143,6 +146,16 @@ namespace Config
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool parseImporterSection(const QString& key, const QString& value, LauncherSettings::Importer& importer)
|
||||||
|
{
|
||||||
|
if (key == sImportContentSetupKey)
|
||||||
|
return parseBool(value, importer.mImportContentSetup);
|
||||||
|
if (key == sImportFontSetupKey)
|
||||||
|
return parseBool(value, importer.mImportFontSetup);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
template <std::size_t size>
|
template <std::size_t size>
|
||||||
void writeSectionHeader(const char (&name)[size], QTextStream& stream)
|
void writeSectionHeader(const char (&name)[size], QTextStream& stream)
|
||||||
{
|
{
|
||||||
|
@ -202,6 +215,13 @@ namespace Config
|
||||||
writeKeyValue(sMainWindowPosXKey, value.mMainWindow.mPosX, stream);
|
writeKeyValue(sMainWindowPosXKey, value.mMainWindow.mPosX, stream);
|
||||||
writeKeyValue(sMainWindowHeightKey, value.mMainWindow.mHeight, stream);
|
writeKeyValue(sMainWindowHeightKey, value.mMainWindow.mHeight, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void writeImporter(const LauncherSettings::Importer& value, QTextStream& stream)
|
||||||
|
{
|
||||||
|
writeSectionHeader(sImporterSection, stream);
|
||||||
|
writeKeyValue(sImportContentSetupKey, value.mImportContentSetup, stream);
|
||||||
|
writeKeyValue(sImportFontSetupKey, value.mImportFontSetup, stream);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,6 +230,7 @@ void Config::LauncherSettings::writeFile(QTextStream& stream) const
|
||||||
writeSettings(mSettings, stream);
|
writeSettings(mSettings, stream);
|
||||||
writeProfiles(mProfiles, stream);
|
writeProfiles(mProfiles, stream);
|
||||||
writeGeneral(mGeneral, stream);
|
writeGeneral(mGeneral, stream);
|
||||||
|
writeImporter(mImporter, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Config::LauncherSettings::getContentLists()
|
QStringList Config::LauncherSettings::getContentLists()
|
||||||
|
@ -335,6 +356,8 @@ bool Config::LauncherSettings::setValue(const QString& sectionPrefix, const QStr
|
||||||
return parseProfilesSection(key, value, mProfiles);
|
return parseProfilesSection(key, value, mProfiles);
|
||||||
if (sectionPrefix == sGeneralSection)
|
if (sectionPrefix == sGeneralSection)
|
||||||
return parseGeneralSection(key, value, mGeneral);
|
return parseGeneralSection(key, value, mGeneral);
|
||||||
|
if (sectionPrefix == sImporterSection)
|
||||||
|
return parseImporterSection(key, value, mImporter);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -390,4 +413,5 @@ void Config::LauncherSettings::clear()
|
||||||
mSettings = Settings{};
|
mSettings = Settings{};
|
||||||
mGeneral = General{};
|
mGeneral = General{};
|
||||||
mProfiles = Profiles{};
|
mProfiles = Profiles{};
|
||||||
|
mImporter = Importer{};
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,12 @@ namespace Config
|
||||||
std::map<QString, Profile> mValues;
|
std::map<QString, Profile> mValues;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Importer
|
||||||
|
{
|
||||||
|
bool mImportContentSetup = true;
|
||||||
|
bool mImportFontSetup = true;
|
||||||
|
};
|
||||||
|
|
||||||
void readFile(QTextStream& stream);
|
void readFile(QTextStream& stream);
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -87,10 +93,19 @@ namespace Config
|
||||||
|
|
||||||
void setMainWindow(const MainWindow& value) { mGeneral.mMainWindow = value; }
|
void setMainWindow(const MainWindow& value) { mGeneral.mMainWindow = value; }
|
||||||
|
|
||||||
|
bool getImportContentSetup() const { return mImporter.mImportContentSetup; }
|
||||||
|
|
||||||
|
void setImportContentSetup(bool value) { mImporter.mImportContentSetup = value; }
|
||||||
|
|
||||||
|
bool getImportFontSetup() const { return mImporter.mImportFontSetup; }
|
||||||
|
|
||||||
|
void setImportFontSetup(bool value) { mImporter.mImportFontSetup = value; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Settings mSettings;
|
Settings mSettings;
|
||||||
Profiles mProfiles;
|
Profiles mProfiles;
|
||||||
General mGeneral;
|
General mGeneral;
|
||||||
|
Importer mImporter;
|
||||||
|
|
||||||
bool setValue(const QString& sectionPrefix, const QString& key, const QString& value);
|
bool setValue(const QString& sectionPrefix, const QString& key, const QString& value);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue