From a514fb7e85051feb71ffd92b7991edc0622e4d03 Mon Sep 17 00:00:00 2001 From: Aussiemon <1407091-Aussiemon@users.noreply.gitlab.com> Date: Thu, 29 Oct 2026 15:41:07 -0600 Subject: [PATCH 1/5] Backup and restore launcher settings when dropped by old versions --- apps/launcher/maindialog.cpp | 56 +++++++++++++++++++++++++- components/config/launchersettings.cpp | 16 +++++++- components/config/launchersettings.hpp | 10 ++++- files/lang/launcher_bg.ts | 8 ++++ files/lang/launcher_de.ts | 8 ++++ files/lang/launcher_en.ts | 8 ++++ files/lang/launcher_fr.ts | 8 ++++ files/lang/launcher_pl.ts | 8 ++++ files/lang/launcher_ru.ts | 8 ++++ files/lang/launcher_sv.ts | 8 ++++ 10 files changed, 134 insertions(+), 4 deletions(-) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 63612f061e..51e5b92a10 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -314,13 +314,14 @@ bool Launcher::MainDialog::setupLauncherSettings() { mLauncherSettings.clear(); + // Launcher settings const QString path = Files::pathToQString(mCfgMgr.getUserConfigPath() / Config::LauncherSettings::sLauncherConfigFileName); if (!QFile::exists(path)) return true; - Log(Debug::Info) << "Loading config file: " << path.toUtf8().constData(); + Log(Debug::Info) << "Loading Launcher config file: " << path.toUtf8().constData(); QFile file(path); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) @@ -338,6 +339,35 @@ bool Launcher::MainDialog::setupLauncherSettings() Misc::ensureUtf8Encoding(stream); mLauncherSettings.readFile(stream); + file.close(); + + // Launcher settings backup + file.setFileName( + Files::pathToQString(mCfgMgr.getUserConfigPath() / Config::LauncherSettings::sLauncherConfigBackupFileName)); + + // Read from the backup only if the watchdog is unset and the backup exists + if (mLauncherSettings.getWatchdog() || !file.exists()) + return true; + + Log(Debug::Warning) << "Watchdog unset. Restoring missing keys from Launcher config backup file: " + << file.fileName().toUtf8().constData(); + + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) + { + cfgError(tr("Error opening OpenMW configuration backup file"), + tr("
Could not open %0 for reading:

%1

" + "Please make sure you have the right permissions " + "and try again.
") + .arg(file.fileName().toHtmlEscaped()) + .arg(file.errorString().toHtmlEscaped())); + return true; + } + + QTextStream backupStream(&file); + Misc::ensureUtf8Encoding(backupStream); + + mLauncherSettings.readFile(backupStream, true); // Restore missing settings + file.close(); return true; } @@ -528,6 +558,9 @@ bool Launcher::MainDialog::writeSettings() return false; } + // Set a watchdog value so future reads can check for dropped launcher settings + mLauncherSettings.setWatchdog(true); + // Launcher settings file.setFileName(Files::pathToQString(userPath / Config::LauncherSettings::sLauncherConfigFileName)); @@ -543,12 +576,31 @@ bool Launcher::MainDialog::writeSettings() } QTextStream stream(&file); - stream.setDevice(&file); Misc::ensureUtf8Encoding(stream); mLauncherSettings.writeFile(stream); file.close(); + // Launcher settings backup + file.setFileName(Files::pathToQString(userPath / Config::LauncherSettings::sLauncherConfigBackupFileName)); + + if (!file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Truncate)) + { + // File cannot be opened or created + cfgError(tr("Error writing Launcher configuration backup file"), + tr("
Could not open or create %0 for writing

" + "Please make sure you have the right permissions " + "and try again.
") + .arg(file.fileName().toHtmlEscaped())); + return false; + } + + QTextStream backupStream(&file); + Misc::ensureUtf8Encoding(backupStream); + + mLauncherSettings.writeFile(backupStream); + file.close(); + return true; } diff --git a/components/config/launchersettings.cpp b/components/config/launchersettings.cpp index 8b510d6e30..96725b7cf2 100644 --- a/components/config/launchersettings.cpp +++ b/components/config/launchersettings.cpp @@ -34,6 +34,7 @@ namespace Config constexpr char sMainWindowHeightKey[] = "MainWindow/height"; constexpr char sMainWindowPosXKey[] = "MainWindow/posx"; constexpr char sMainWindowPosYKey[] = "MainWindow/posy"; + constexpr char sWatchdogKey[] = "watchdog"; QString makeNewContentListName() { @@ -122,6 +123,8 @@ namespace Config settings.mLanguage = value; return true; } + if (key == sWatchdogKey) + return parseBool(value, settings.mWatchdog); settings.mUnknown.emplaceBack(key, value); return true; @@ -210,6 +213,7 @@ namespace Config { writeSectionHeader(sSettingsSection, stream); writeKeyValue(sLanguageKey, value.mLanguage, stream); + writeKeyValue(sWatchdogKey, value.mWatchdog, stream); writeUnknownKeys(value.mUnknown, stream); } @@ -411,11 +415,13 @@ bool Config::LauncherSettings::setValue(const QString& sectionPrefix, const QStr return true; } -void Config::LauncherSettings::readFile(QTextStream& stream) +void Config::LauncherSettings::readFile(QTextStream& stream, bool missingOnly) { const QRegularExpression sectionRe("^\\[([^]]+)\\]$"); const QRegularExpression keyRe("^([^=]+)\\s*=\\s*(.+)$"); + QSet readKeys; + QString section; while (!stream.atEnd()) @@ -442,11 +448,18 @@ void Config::LauncherSettings::readFile(QTextStream& stream) const QString key = keyMatch.captured(1).trimmed(); const QString value = keyMatch.captured(2).trimmed(); + const QString id = "[" + section + "]." + key; + if (missingOnly && mReadKeys.contains(id)) + continue; + if (!setValue(section, key, value)) Log(Debug::Warning) << "Invalid value in the launcher config file: section: " << section.toUtf8().constData() << " key: " << key.toUtf8().constData() << " value: " << value.toUtf8().constData(); + else + readKeys.insert(id); } + mReadKeys.unite(readKeys); } const Config::LauncherSettings::Profile* Config::LauncherSettings::findProfile(const QString& name) const @@ -463,5 +476,6 @@ void Config::LauncherSettings::clear() mGeneral = General{}; mProfiles = Profiles{}; mImporter = Importer{}; + mReadKeys.clear(); mUnknownSections.clear(); } diff --git a/components/config/launchersettings.hpp b/components/config/launchersettings.hpp index 28b248698d..d5bc2fadd3 100644 --- a/components/config/launchersettings.hpp +++ b/components/config/launchersettings.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -19,6 +20,7 @@ namespace Config { public: static constexpr char sLauncherConfigFileName[] = "launcher.cfg"; + static constexpr char sLauncherConfigBackupFileName[] = "launcher.cfg.bak"; /// Keys of a section this version does not use, in file order, written back as read using UnknownKeys = QList>; @@ -26,6 +28,7 @@ namespace Config struct Settings { QString mLanguage; + bool mWatchdog = false; UnknownKeys mUnknown; }; @@ -66,7 +69,7 @@ namespace Config UnknownKeys mUnknown; }; - void readFile(QTextStream& stream); + void readFile(QTextStream& stream, bool missingOnly = false); void clear(); @@ -101,6 +104,10 @@ namespace Config void setLanguage(const QString& value) { mSettings.mLanguage = value; } + bool getWatchdog() const { return mSettings.mWatchdog; } + + void setWatchdog(bool value) { mSettings.mWatchdog = value; } + MainWindow getMainWindow() const { return mGeneral.mMainWindow; } void setMainWindow(const MainWindow& value) { mGeneral.mMainWindow = value; } @@ -118,6 +125,7 @@ namespace Config Profiles mProfiles; General mGeneral; Importer mImporter; + QSet mReadKeys; /// Sections this version does not know at all, in name order, written back as read QMap mUnknownSections; diff --git a/files/lang/launcher_bg.ts b/files/lang/launcher_bg.ts index 514c454450..f30c9e76f4 100644 --- a/files/lang/launcher_bg.ts +++ b/files/lang/launcher_bg.ts @@ -569,6 +569,14 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov <br><b>You do not have a game file selected.</b><br><br>OpenMW will not start without a game file selected.<br> <br><b>Не сте избрали файл на играта.</b><br><br>OpenMW няма да стартира без избран файл на играта.<br> + + Error writing Launcher configuration backup file + + + + Error opening OpenMW configuration backup file + + Launcher::SettingsPage diff --git a/files/lang/launcher_de.ts b/files/lang/launcher_de.ts index bccf216a88..52942e5442 100644 --- a/files/lang/launcher_de.ts +++ b/files/lang/launcher_de.ts @@ -567,6 +567,14 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov <br><b>Could not create directory %0</b><br><br>%1<br> + + Error writing Launcher configuration backup file + + + + Error opening OpenMW configuration backup file + + Launcher::SettingsPage diff --git a/files/lang/launcher_en.ts b/files/lang/launcher_en.ts index 933cf35853..c2b45edcd9 100644 --- a/files/lang/launcher_en.ts +++ b/files/lang/launcher_en.ts @@ -567,6 +567,14 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov <br><b>You do not have a game file selected.</b><br><br>OpenMW will not start without a game file selected.<br> + + Error writing Launcher configuration backup file + + + + Error opening OpenMW configuration backup file + + Launcher::SettingsPage diff --git a/files/lang/launcher_fr.ts b/files/lang/launcher_fr.ts index def0448d6c..eba376d024 100644 --- a/files/lang/launcher_fr.ts +++ b/files/lang/launcher_fr.ts @@ -567,6 +567,14 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov <br><b>Could not create directory %0</b><br><br>%1<br> <br><b>Impossible de créer le dossier %0</b><br><br>%1<br> + + Error writing Launcher configuration backup file + + + + Error opening OpenMW configuration backup file + + Launcher::SettingsPage diff --git a/files/lang/launcher_pl.ts b/files/lang/launcher_pl.ts index 78cc00ccda..ab13d5a24b 100644 --- a/files/lang/launcher_pl.ts +++ b/files/lang/launcher_pl.ts @@ -571,6 +571,14 @@ do domyślnych czcionek Morrowind. Zaznacz to pole, jeśli nadal wolisz oryginal <br><b>You do not have a game file selected.</b><br><br>OpenMW will not start without a game file selected.<br> <br><b>Nie wybrano pliku gry.</b><br><br>OpenMW nie uruchomi się bez wybranego pliku gry.<br> + + Error writing Launcher configuration backup file + + + + Error opening OpenMW configuration backup file + + Launcher::SettingsPage diff --git a/files/lang/launcher_ru.ts b/files/lang/launcher_ru.ts index 23290e9592..319b563981 100644 --- a/files/lang/launcher_ru.ts +++ b/files/lang/launcher_ru.ts @@ -569,6 +569,14 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov <br><b>Could not create directory %0</b><br><br>%1<br> <br><b>Не удалось создать директорию %0</b><br><br>%1<br> + + Error writing Launcher configuration backup file + + + + Error opening OpenMW configuration backup file + + Launcher::SettingsPage diff --git a/files/lang/launcher_sv.ts b/files/lang/launcher_sv.ts index c8181b0c01..33f8704d4f 100644 --- a/files/lang/launcher_sv.ts +++ b/files/lang/launcher_sv.ts @@ -570,6 +570,14 @@ de ordinarie fonterna i Morrowind. Bocka denna ruta om du ändå föredrar ordin <br><b>Could not create directory %0</b><br><br>%1<br> <br><b>Kunde inte skapa katalog %0</b><br><br>%1<br> + + Error writing Launcher configuration backup file + + + + Error opening OpenMW configuration backup file + + Launcher::SettingsPage From fe85274fe5021a96524458f70a2b095c41a80183 Mon Sep 17 00:00:00 2001 From: Aussiemon <1407091-Aussiemon@users.noreply.gitlab.com> Date: Thu, 29 Oct 2026 15:46:15 -0600 Subject: [PATCH 2/5] Machine translations because we're in a hurry --- files/lang/launcher_bg.ts | 4 ++-- files/lang/launcher_de.ts | 8 ++++---- files/lang/launcher_en.ts | 4 ++-- files/lang/launcher_fr.ts | 4 ++-- files/lang/launcher_pl.ts | 6 +++--- files/lang/launcher_ru.ts | 4 ++-- files/lang/launcher_sv.ts | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/files/lang/launcher_bg.ts b/files/lang/launcher_bg.ts index f30c9e76f4..710e0a3be1 100644 --- a/files/lang/launcher_bg.ts +++ b/files/lang/launcher_bg.ts @@ -571,11 +571,11 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov Error writing Launcher configuration backup file - + Грешка при записване на резервното копие на конфигурационния файл на стартиращата програма Error opening OpenMW configuration backup file - + Грешка при отваряне на резервното копие на конфигурационния файл на OpenMW diff --git a/files/lang/launcher_de.ts b/files/lang/launcher_de.ts index 52942e5442..5843c4da90 100644 --- a/files/lang/launcher_de.ts +++ b/files/lang/launcher_de.ts @@ -477,7 +477,7 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov Error opening OpenMW configuration file - + Fehler beim Öffnen der OpenMW-Konfigurationsdatei First run @@ -525,7 +525,7 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov Error writing Launcher configuration file - + Fehler beim Schreiben der Launcher-Konfigurationsdatei No game file selected @@ -569,11 +569,11 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov Error writing Launcher configuration backup file - + Fehler beim Schreiben der Sicherungskopie der Launcher-Konfigurationsdatei Error opening OpenMW configuration backup file - + Fehler beim Öffnen der Sicherungskopie der OpenMW-Konfigurationsdatei diff --git a/files/lang/launcher_en.ts b/files/lang/launcher_en.ts index c2b45edcd9..f618bb5399 100644 --- a/files/lang/launcher_en.ts +++ b/files/lang/launcher_en.ts @@ -569,11 +569,11 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov Error writing Launcher configuration backup file - + Error opening OpenMW configuration backup file - + diff --git a/files/lang/launcher_fr.ts b/files/lang/launcher_fr.ts index eba376d024..644f4863b1 100644 --- a/files/lang/launcher_fr.ts +++ b/files/lang/launcher_fr.ts @@ -569,11 +569,11 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov Error writing Launcher configuration backup file - + Erreur lors de l'écriture dans le fichier de sauvegarde des paramètres du Lanceur Error opening OpenMW configuration backup file - + Erreur lors de l'ouverture du fichier de sauvegarde de la configuration d'OpenMW diff --git a/files/lang/launcher_pl.ts b/files/lang/launcher_pl.ts index ab13d5a24b..829b2c6fec 100644 --- a/files/lang/launcher_pl.ts +++ b/files/lang/launcher_pl.ts @@ -561,7 +561,7 @@ do domyślnych czcionek Morrowind. Zaznacz to pole, jeśli nadal wolisz oryginal Error writing Launcher configuration file - Błąd zapisu pliku konfiguracyjnego programu uruchamiącego + Błąd zapisu pliku konfiguracyjnego programu uruchamiającego No game file selected @@ -573,11 +573,11 @@ do domyślnych czcionek Morrowind. Zaznacz to pole, jeśli nadal wolisz oryginal Error writing Launcher configuration backup file - + Błąd zapisu kopii zapasowej pliku konfiguracyjnego programu uruchamiającego Error opening OpenMW configuration backup file - + Wystąpił błąd podczas otwierania kopii zapasowej pliku konfiguracyjnego OpenMW diff --git a/files/lang/launcher_ru.ts b/files/lang/launcher_ru.ts index 319b563981..164891128c 100644 --- a/files/lang/launcher_ru.ts +++ b/files/lang/launcher_ru.ts @@ -571,11 +571,11 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov Error writing Launcher configuration backup file - + Не удалось сохранить данные в резервную копию файла с настройками лаунчера Error opening OpenMW configuration backup file - + Не удалось открыть резервную копию файла с настройками OpenMW diff --git a/files/lang/launcher_sv.ts b/files/lang/launcher_sv.ts index 33f8704d4f..0ccaaa5750 100644 --- a/files/lang/launcher_sv.ts +++ b/files/lang/launcher_sv.ts @@ -572,11 +572,11 @@ de ordinarie fonterna i Morrowind. Bocka denna ruta om du ändå föredrar ordin Error writing Launcher configuration backup file - + Fel när säkerhetskopia av Startarens-konfigurationsfil skulle skrivas Error opening OpenMW configuration backup file - + Fel när säkerhetskopia av OpenMW-konfigurationsfil skulle öppnas From 1afec0ecb58e56c12290df9d591dfbb8e3a80b37 Mon Sep 17 00:00:00 2001 From: Aussiemon <1407091-Aussiemon@users.noreply.gitlab.com> Date: Thu, 29 Oct 2026 18:29:22 -0600 Subject: [PATCH 3/5] Add watchdog unit tests --- .../config/testlaunchersettings.cpp | 67 +++++++++++++++++-- apps/launcher/maindialog.cpp | 3 - components/config/launchersettings.cpp | 2 +- components/config/launchersettings.hpp | 2 - 4 files changed, 63 insertions(+), 11 deletions(-) diff --git a/apps/components_tests/config/testlaunchersettings.cpp b/apps/components_tests/config/testlaunchersettings.cpp index 617b3015a5..be919b3010 100644 --- a/apps/components_tests/config/testlaunchersettings.cpp +++ b/apps/components_tests/config/testlaunchersettings.cpp @@ -7,10 +7,18 @@ namespace { - void read(Config::LauncherSettings& settings, QString text) + void read(Config::LauncherSettings& settings, QString text, bool missingOnly = false) { QTextStream stream(&text); - settings.readFile(stream); + settings.readFile(stream, missingOnly); + } + + Config::LauncherSettings restore(const QString& main, const QString& backup) + { + Config::LauncherSettings settings; + read(settings, main); + read(settings, backup, true); + return settings; } Config::LauncherSettings parse(const QString& text) @@ -63,6 +71,7 @@ thing=5 EXPECT_EQ(write(settings).toStdString(), R"( [Settings] language=en +watchdog=true future=1 [Profiles] @@ -149,7 +158,7 @@ thing=5 EXPECT_TRUE(write(settings).contains("Default/future=one\nDefault/future=two\nDefault/future=three\n")); } - TEST(LauncherSettingsTest, ContentOrderSurvivesAWriteAndRead) + TEST(LauncherSettingsTest, contentOrderSurvivesAWriteAndRead) { Config::LauncherSettings settings; settings.setContentList("Default", { "/games/morrowind/Data Files" }, { "Morrowind.bsa" }, @@ -162,7 +171,7 @@ thing=5 EXPECT_EQ(reread.getContentListFiles("Default"), QStringList({ "Morrowind.esm", "Tribunal.esm" })); } - TEST(LauncherSettingsTest, ALauncherConfigWrittenBeforeTheOrderKeyStillLoads) + TEST(LauncherSettingsTest, launcherConfigWrittenBeforeTheOrderKeyStillLoads) { const Config::LauncherSettings settings = parse(QString::fromUtf8(sConfig)); @@ -171,7 +180,7 @@ thing=5 EXPECT_TRUE(settings.getUserFilesInOrder("Default").isEmpty()); } - TEST(LauncherSettingsTest, TheOrderKeyDoesNotLeakIntoTheOtherProfileLists) + TEST(LauncherSettingsTest, orderKeyDoesNotLeakIntoTheOtherProfileLists) { const Config::LauncherSettings settings = parse(QString::fromUtf8(sConfig) + "Default/order=Morrowind.esm\n" @@ -184,4 +193,52 @@ thing=5 EXPECT_EQ(settings.getDataDirectoryList("Default"), QStringList({ "/games/morrowind/Data Files" })); EXPECT_EQ(settings.getArchiveList("Default"), QStringList({ "Morrowind.bsa" })); } + + TEST(LauncherSettingsTest, watchdogRestoreShouldAddMissingKeysAndMaintainFileOrder) + { + const QString current = QString::fromUtf8(sConfig); + const QString backup = QString::fromUtf8(sConfig) + + "Default/order=Morrowind.esm\n" + "Default/order=SomethingDisabled.esp\n" + "Default/order=Tribunal.esm\n"; + + const Config::LauncherSettings settings = restore(current, backup); + + EXPECT_EQ(settings.getUserFilesInOrder("Default"), + QStringList({ "Morrowind.esm", "SomethingDisabled.esp", "Tribunal.esm" })); + EXPECT_EQ(settings.getContentListFiles("Default"), QStringList({ "Morrowind.esm", "Tribunal.esm" })); + } + + TEST(LauncherSettingsTest, watchdogRestoreShouldMaintainExistingKeyValues) + { + const QString current = QString::fromUtf8(sConfig) + + "Default/order=Morrowind.esm\n" + "Default/order=SomethingDisabled.esp\n" + "Default/order=Tribunal.esm\n"; + const QString backup = QString::fromUtf8(sConfig) + + "Default/order=SomethingDisabled.esp\n" + "Default/order=Morrowind.esm\n" + "Default/order=Tribunal.esm\n"; + + const Config::LauncherSettings settings = restore(current, backup); + + EXPECT_EQ(settings.getCurrentContentListName(), "Default"); + EXPECT_EQ(settings.getUserFilesInOrder("Default"), + QStringList({ "Morrowind.esm", "SomethingDisabled.esp", "Tribunal.esm" })); + } + + TEST(LauncherSettingsTest, watchdogShouldBeUnsetByDefault) + { + const Config::LauncherSettings settings = parse(QString::fromUtf8(sConfig)); + + EXPECT_FALSE(settings.getWatchdog()); + } + + TEST(LauncherSettingsTest, watchdogShouldBeSetOnSuccessfulWrite) + { + const QString written = write(parse("[Settings]\nlanguage=English\n")); + + EXPECT_EQ(written.count("watchdog="), 1); + EXPECT_TRUE(written.contains("watchdog=true\n")); + } } diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 51e5b92a10..b6a79ac3d2 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -558,9 +558,6 @@ bool Launcher::MainDialog::writeSettings() return false; } - // Set a watchdog value so future reads can check for dropped launcher settings - mLauncherSettings.setWatchdog(true); - // Launcher settings file.setFileName(Files::pathToQString(userPath / Config::LauncherSettings::sLauncherConfigFileName)); diff --git a/components/config/launchersettings.cpp b/components/config/launchersettings.cpp index 96725b7cf2..d1831e07e6 100644 --- a/components/config/launchersettings.cpp +++ b/components/config/launchersettings.cpp @@ -213,7 +213,7 @@ namespace Config { writeSectionHeader(sSettingsSection, stream); writeKeyValue(sLanguageKey, value.mLanguage, stream); - writeKeyValue(sWatchdogKey, value.mWatchdog, stream); + writeKeyValue(sWatchdogKey, true, stream); // Set so future reads check for dropped launcher settings writeUnknownKeys(value.mUnknown, stream); } diff --git a/components/config/launchersettings.hpp b/components/config/launchersettings.hpp index d5bc2fadd3..65830f311d 100644 --- a/components/config/launchersettings.hpp +++ b/components/config/launchersettings.hpp @@ -106,8 +106,6 @@ namespace Config bool getWatchdog() const { return mSettings.mWatchdog; } - void setWatchdog(bool value) { mSettings.mWatchdog = value; } - MainWindow getMainWindow() const { return mGeneral.mMainWindow; } void setMainWindow(const MainWindow& value) { mGeneral.mMainWindow = value; } From 337b68fab095ec801041fd2cb14a777137328873 Mon Sep 17 00:00:00 2001 From: Aussiemon <1407091-Aussiemon@users.noreply.gitlab.com> Date: Thu, 29 Oct 2026 19:17:23 -0600 Subject: [PATCH 4/5] Defensive naming --- apps/launcher/maindialog.cpp | 3 +++ components/config/launchersettings.hpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index b6a79ac3d2..3a28d2febf 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -595,6 +595,9 @@ bool Launcher::MainDialog::writeSettings() QTextStream backupStream(&file); Misc::ensureUtf8Encoding(backupStream); + backupStream << "# Written automatically by the OpenMW launcher. Do not edit or rename.\n" + "# Your settings are located in launcher.cfg\n"; + mLauncherSettings.writeFile(backupStream); file.close(); diff --git a/components/config/launchersettings.hpp b/components/config/launchersettings.hpp index 65830f311d..8d16f9fd81 100644 --- a/components/config/launchersettings.hpp +++ b/components/config/launchersettings.hpp @@ -20,7 +20,7 @@ namespace Config { public: static constexpr char sLauncherConfigFileName[] = "launcher.cfg"; - static constexpr char sLauncherConfigBackupFileName[] = "launcher.cfg.bak"; + static constexpr char sLauncherConfigBackupFileName[] = "launcher-wd.dat"; /// Keys of a section this version does not use, in file order, written back as read using UnknownKeys = QList>; From f830b842be43f9bf7c527ab23c18022d158cc8e5 Mon Sep 17 00:00:00 2001 From: Aussiemon <1407091-Aussiemon@users.noreply.gitlab.com> Date: Fri, 30 Oct 2026 01:41:38 -0600 Subject: [PATCH 5/5] Wording and translation changes Co-authored-by: jvoisin --- apps/launcher/maindialog.cpp | 6 +++--- files/lang/launcher_bg.ts | 8 ++++++-- files/lang/launcher_de.ts | 16 ++++++++++------ files/lang/launcher_en.ts | 6 +++++- files/lang/launcher_fr.ts | 10 +++++++--- files/lang/launcher_pl.ts | 8 ++++++-- files/lang/launcher_ru.ts | 8 ++++++-- files/lang/launcher_sv.ts | 8 ++++++-- 8 files changed, 49 insertions(+), 21 deletions(-) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 3a28d2febf..08f660085f 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -326,7 +326,7 @@ bool Launcher::MainDialog::setupLauncherSettings() QFile file(path); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - cfgError(tr("Error opening OpenMW configuration file"), + cfgError(tr("Error opening Launcher configuration file"), tr("
Could not open %0 for reading:

%1

" "Please make sure you have the right permissions " "and try again.
") @@ -354,7 +354,7 @@ bool Launcher::MainDialog::setupLauncherSettings() if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - cfgError(tr("Error opening OpenMW configuration backup file"), + cfgError(tr("Error opening Launcher configuration backup file"), tr("
Could not open %0 for reading:

%1

" "Please make sure you have the right permissions " "and try again.
") @@ -595,7 +595,7 @@ bool Launcher::MainDialog::writeSettings() QTextStream backupStream(&file); Misc::ensureUtf8Encoding(backupStream); - backupStream << "# Written automatically by the OpenMW launcher. Do not edit or rename.\n" + backupStream << "# Backup file written automatically by the OpenMW launcher. Do not edit or rename.\n" "# Your settings are located in launcher.cfg\n"; mLauncherSettings.writeFile(backupStream); diff --git a/files/lang/launcher_bg.ts b/files/lang/launcher_bg.ts index 710e0a3be1..4e4f49627c 100644 --- a/files/lang/launcher_bg.ts +++ b/files/lang/launcher_bg.ts @@ -574,8 +574,12 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov Грешка при записване на резервното копие на конфигурационния файл на стартиращата програма - Error opening OpenMW configuration backup file - Грешка при отваряне на резервното копие на конфигурационния файл на OpenMW + Error opening Launcher configuration file + Грешка при отваряне на конфигурационния файл на стартиращата програма + + + Error opening Launcher configuration backup file + Грешка при отваряне на резервното копие на конфигурационния файл на стартиращата програма
diff --git a/files/lang/launcher_de.ts b/files/lang/launcher_de.ts index 5843c4da90..ccedf760f2 100644 --- a/files/lang/launcher_de.ts +++ b/files/lang/launcher_de.ts @@ -477,7 +477,7 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov Error opening OpenMW configuration file - Fehler beim Öffnen der OpenMW-Konfigurationsdatei + First run @@ -525,7 +525,7 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov Error writing Launcher configuration file - Fehler beim Schreiben der Launcher-Konfigurationsdatei + No game file selected @@ -568,12 +568,16 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov - Error writing Launcher configuration backup file - Fehler beim Schreiben der Sicherungskopie der Launcher-Konfigurationsdatei + Error opening Launcher configuration file + - Error opening OpenMW configuration backup file - Fehler beim Öffnen der Sicherungskopie der OpenMW-Konfigurationsdatei + Error opening Launcher configuration backup file + + + + Error writing Launcher configuration backup file + diff --git a/files/lang/launcher_en.ts b/files/lang/launcher_en.ts index f618bb5399..76808578e0 100644 --- a/files/lang/launcher_en.ts +++ b/files/lang/launcher_en.ts @@ -572,7 +572,11 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov - Error opening OpenMW configuration backup file + Error opening Launcher configuration file + + + + Error opening Launcher configuration backup file diff --git a/files/lang/launcher_fr.ts b/files/lang/launcher_fr.ts index 644f4863b1..1801af7a89 100644 --- a/files/lang/launcher_fr.ts +++ b/files/lang/launcher_fr.ts @@ -569,11 +569,15 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov Error writing Launcher configuration backup file - Erreur lors de l'écriture dans le fichier de sauvegarde des paramètres du Lanceur + Erreur lors de l'écriture du fichier de sauvegarde des paramètres du Lanceur - Error opening OpenMW configuration backup file - Erreur lors de l'ouverture du fichier de sauvegarde de la configuration d'OpenMW + Error opening Launcher configuration file + Erreur lors de l'ouverture du fichier de paramètres du Lanceur + + + Error opening Launcher configuration backup file + Erreur lors de l'ouverture du fichier de sauvegarde des paramètres du Lanceur diff --git a/files/lang/launcher_pl.ts b/files/lang/launcher_pl.ts index 829b2c6fec..3cdc32b1c0 100644 --- a/files/lang/launcher_pl.ts +++ b/files/lang/launcher_pl.ts @@ -576,8 +576,12 @@ do domyślnych czcionek Morrowind. Zaznacz to pole, jeśli nadal wolisz oryginal Błąd zapisu kopii zapasowej pliku konfiguracyjnego programu uruchamiającego - Error opening OpenMW configuration backup file - Wystąpił błąd podczas otwierania kopii zapasowej pliku konfiguracyjnego OpenMW + Error opening Launcher configuration file + Wystąpił błąd podczas otwierania pliku konfiguracyjnego programu uruchamiającego + + + Error opening Launcher configuration backup file + Wystąpił błąd podczas otwierania kopii zapasowej pliku konfiguracyjnego programu uruchamiającego diff --git a/files/lang/launcher_ru.ts b/files/lang/launcher_ru.ts index 164891128c..cb0a4014f4 100644 --- a/files/lang/launcher_ru.ts +++ b/files/lang/launcher_ru.ts @@ -574,8 +574,12 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov Не удалось сохранить данные в резервную копию файла с настройками лаунчера - Error opening OpenMW configuration backup file - Не удалось открыть резервную копию файла с настройками OpenMW + Error opening Launcher configuration file + Не удалось открыть файл с настройками лаунчера + + + Error opening Launcher configuration backup file + Не удалось открыть резервную копию файла с настройками лаунчера diff --git a/files/lang/launcher_sv.ts b/files/lang/launcher_sv.ts index 0ccaaa5750..dcecc246ba 100644 --- a/files/lang/launcher_sv.ts +++ b/files/lang/launcher_sv.ts @@ -575,8 +575,12 @@ de ordinarie fonterna i Morrowind. Bocka denna ruta om du ändå föredrar ordin Fel när säkerhetskopia av Startarens-konfigurationsfil skulle skrivas - Error opening OpenMW configuration backup file - Fel när säkerhetskopia av OpenMW-konfigurationsfil skulle öppnas + Error opening Launcher configuration file + Fel när Startarens-konfigurationsfil skulle öppnas + + + Error opening Launcher configuration backup file + Fel när säkerhetskopia av Startarens-konfigurationsfil skulle öppnas