From 84f409f3cd1711de208ad35d7698b65934eb2414 Mon Sep 17 00:00:00 2001 From: Oliver Knoll Date: Sat, 3 Dec 2022 14:02:07 +0100 Subject: [PATCH] FIX: Proper settings version initialisation --- src/Kernel/src/Settings.cpp | 23 ++++++++--------------- src/Kernel/src/SettingsConverter.cpp | 1 - src/Kernel/src/Version.cpp | 11 ++--------- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/Kernel/src/Settings.cpp b/src/Kernel/src/Settings.cpp index 420ea0a37..4a9e9ef6d 100644 --- a/src/Kernel/src/Settings.cpp +++ b/src/Kernel/src/Settings.cpp @@ -58,13 +58,6 @@ namespace struct SettingsPrivate { SettingsPrivate() noexcept - : version(QCoreApplication::instance()->applicationVersion()), - backupBeforeMigration(DefaultBackupBeforeMigration), - recordingSampleRateValue(DefaultRecordingSampleRate), - windowStayOnTop(DefaultWindowStayOnTop), - minimalUi(DefaultMinimalUi), - moduleSelectorVisible(DefaultModuleSelectorVisible), - replaySpeedVisible(DefaultReplaySpeedVisible) { QStringList standardLocations = QStandardPaths::standardLocations(QStandardPaths::StandardLocation::DocumentsLocation); if (standardLocations.count() > 0) { @@ -79,13 +72,13 @@ struct SettingsPrivate Version version; QString logbookPath; - bool backupBeforeMigration; + bool backupBeforeMigration {DefaultBackupBeforeMigration}; QUuid skyConnectPluginUuid; - double recordingSampleRateValue; - bool windowStayOnTop; - bool minimalUi; - bool moduleSelectorVisible; - bool replaySpeedVisible; + double recordingSampleRateValue {DefaultRecordingSampleRate}; + bool windowStayOnTop {DefaultWindowStayOnTop}; + bool minimalUi {DefaultMinimalUi}; + bool moduleSelectorVisible {DefaultModuleSelectorVisible}; + bool replaySpeedVisible {DefaultReplaySpeedVisible}; QByteArray windowGeometry; QByteArray windowState; QByteArray logbookState; @@ -148,7 +141,7 @@ struct SettingsPrivate static constexpr bool DefaultMinimalUiNonEssentialButtonVisible {false}; static constexpr bool DefaultMinimalUiReplaySpeedVisible {false}; - static inline const QString DefaultImportAircraftType {QLatin1String("")}; + static inline const QString DefaultImportAircraftType {}; static constexpr int DefaultPreviewInfoDialogCount {3}; static constexpr int PreviewInfoDialogBase {110}; @@ -700,7 +693,7 @@ void Settings::restore() noexcept { QString versionString; versionString = d->settings.value("Version", getVersion().toString()).toString(); - Version settingsVersion(versionString); + Version settingsVersion {versionString}; if (settingsVersion < getVersion()) { #ifdef DEBUG qDebug() << "Settings::restore: app version:" << getVersion().toString() << "settings version:" << settingsVersion.toString() << "converting..."; diff --git a/src/Kernel/src/SettingsConverter.cpp b/src/Kernel/src/SettingsConverter.cpp index 34a22de04..df82e2576 100644 --- a/src/Kernel/src/SettingsConverter.cpp +++ b/src/Kernel/src/SettingsConverter.cpp @@ -37,7 +37,6 @@ namespace settings.setValue("LocationTableState", QVariant()); } settings.endGroup(); - } } diff --git a/src/Kernel/src/Version.cpp b/src/Kernel/src/Version.cpp index 4ad993830..198133b26 100644 --- a/src/Kernel/src/Version.cpp +++ b/src/Kernel/src/Version.cpp @@ -38,17 +38,10 @@ struct VersionPrivate { - VersionPrivate(int theMajor, int theMinor, int thePatch) noexcept - : major(theMajor), minor(theMinor), patch(thePatch) + VersionPrivate(int major = VersionConfig::Major, int minor = VersionConfig::Minor, int patch = VersionConfig::Patch) noexcept + : major(major), minor(minor), patch(patch) {} - VersionPrivate() = default; - ~VersionPrivate() = default; - VersionPrivate(const VersionPrivate &rhs) = default; - VersionPrivate(VersionPrivate &&rhs) = default; - VersionPrivate &operator=(const VersionPrivate &rhs) = default; - VersionPrivate &operator=(VersionPrivate &&rhs) = default; - int major {VersionConfig::Major}; int minor {VersionConfig::Minor}; int patch {VersionConfig::Patch};