Skip to content

Commit 1dc1bfe

Browse files
committed
Merge branch 'launcherimportdefaults' into 'master'
Save/load INI importer flags in the launcher (#8189) Closes #8189 See merge request OpenMW/openmw!4429
2 parents b288448 + eea916a commit 1dc1bfe

File tree

4 files changed

+47
-1
lines changed

4 files changed

+47
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@
197197
Bug #8171: Items with more than 100% health can be repaired
198198
Bug #8172: Openmw-cs crashes when viewing `Dantooine, Sea`
199199
Bug #8187: Intervention effects should use Chebyshev distance to determine the closest marker
200+
Bug #8189: The import tab in the launcher doesn't remember the checkbox selection
200201
Bug #8191: NiRollController does not work for sheath meshes
201202
Bug #8206: Moving away from storm wind origin should make you faster
202203
Bug #8207: Using hand-to-hand while sneaking plays the critical hit sound when the target is not getting hurt

apps/launcher/importpage.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,15 @@ void Launcher::ImportPage::resetProgressBar()
220220
progressBar->reset();
221221
}
222222

223-
void Launcher::ImportPage::saveSettings() {}
223+
void Launcher::ImportPage::saveSettings()
224+
{
225+
mLauncherSettings.setImportContentSetup(addonsCheckBox->isChecked());
226+
mLauncherSettings.setImportFontSetup(fontsCheckBox->isChecked());
227+
}
224228

225229
bool Launcher::ImportPage::loadSettings()
226230
{
231+
addonsCheckBox->setChecked(mLauncherSettings.getImportContentSetup());
232+
fontsCheckBox->setChecked(mLauncherSettings.getImportFontSetup());
227233
return true;
228234
}

components/config/launchersettings.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ namespace Config
2020
constexpr char sSettingsSection[] = "Settings";
2121
constexpr char sGeneralSection[] = "General";
2222
constexpr char sProfilesSection[] = "Profiles";
23+
constexpr char sImporterSection[] = "Importer";
2324
constexpr char sLanguageKey[] = "language";
2425
constexpr char sCurrentProfileKey[] = "currentprofile";
2526
constexpr char sDataKey[] = "data";
2627
constexpr char sArchiveKey[] = "fallback-archive";
2728
constexpr char sContentKey[] = "content";
2829
constexpr char sFirstRunKey[] = "firstrun";
30+
constexpr char sImportContentSetupKey[] = "importcontentsetup";
31+
constexpr char sImportFontSetupKey[] = "importfontsetup";
2932
constexpr char sMainWindowWidthKey[] = "MainWindow/width";
3033
constexpr char sMainWindowHeightKey[] = "MainWindow/height";
3134
constexpr char sMainWindowPosXKey[] = "MainWindow/posx";
@@ -143,6 +146,16 @@ namespace Config
143146
return false;
144147
}
145148

149+
bool parseImporterSection(const QString& key, const QString& value, LauncherSettings::Importer& importer)
150+
{
151+
if (key == sImportContentSetupKey)
152+
return parseBool(value, importer.mImportContentSetup);
153+
if (key == sImportFontSetupKey)
154+
return parseBool(value, importer.mImportFontSetup);
155+
156+
return false;
157+
}
158+
146159
template <std::size_t size>
147160
void writeSectionHeader(const char (&name)[size], QTextStream& stream)
148161
{
@@ -202,6 +215,13 @@ namespace Config
202215
writeKeyValue(sMainWindowPosXKey, value.mMainWindow.mPosX, stream);
203216
writeKeyValue(sMainWindowHeightKey, value.mMainWindow.mHeight, stream);
204217
}
218+
219+
void writeImporter(const LauncherSettings::Importer& value, QTextStream& stream)
220+
{
221+
writeSectionHeader(sImporterSection, stream);
222+
writeKeyValue(sImportContentSetupKey, value.mImportContentSetup, stream);
223+
writeKeyValue(sImportFontSetupKey, value.mImportFontSetup, stream);
224+
}
205225
}
206226
}
207227

@@ -210,6 +230,7 @@ void Config::LauncherSettings::writeFile(QTextStream& stream) const
210230
writeSettings(mSettings, stream);
211231
writeProfiles(mProfiles, stream);
212232
writeGeneral(mGeneral, stream);
233+
writeImporter(mImporter, stream);
213234
}
214235

215236
QStringList Config::LauncherSettings::getContentLists()
@@ -335,6 +356,8 @@ bool Config::LauncherSettings::setValue(const QString& sectionPrefix, const QStr
335356
return parseProfilesSection(key, value, mProfiles);
336357
if (sectionPrefix == sGeneralSection)
337358
return parseGeneralSection(key, value, mGeneral);
359+
if (sectionPrefix == sImporterSection)
360+
return parseImporterSection(key, value, mImporter);
338361

339362
return false;
340363
}
@@ -390,4 +413,5 @@ void Config::LauncherSettings::clear()
390413
mSettings = Settings{};
391414
mGeneral = General{};
392415
mProfiles = Profiles{};
416+
mImporter = Importer{};
393417
}

components/config/launchersettings.hpp

+15
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ namespace Config
4949
std::map<QString, Profile> mValues;
5050
};
5151

52+
struct Importer
53+
{
54+
bool mImportContentSetup = true;
55+
bool mImportFontSetup = true;
56+
};
57+
5258
void readFile(QTextStream& stream);
5359

5460
void clear();
@@ -87,10 +93,19 @@ namespace Config
8793

8894
void setMainWindow(const MainWindow& value) { mGeneral.mMainWindow = value; }
8995

96+
bool getImportContentSetup() const { return mImporter.mImportContentSetup; }
97+
98+
void setImportContentSetup(bool value) { mImporter.mImportContentSetup = value; }
99+
100+
bool getImportFontSetup() const { return mImporter.mImportFontSetup; }
101+
102+
void setImportFontSetup(bool value) { mImporter.mImportFontSetup = value; }
103+
90104
private:
91105
Settings mSettings;
92106
Profiles mProfiles;
93107
General mGeneral;
108+
Importer mImporter;
94109

95110
bool setValue(const QString& sectionPrefix, const QString& key, const QString& value);
96111

0 commit comments

Comments
 (0)