Skip to content

Commit

Permalink
FIX: Proper settings version initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
till213 committed Dec 3, 2022
1 parent d86e987 commit 84f409f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
23 changes: 8 additions & 15 deletions src/Kernel/src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -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...";
Expand Down
1 change: 0 additions & 1 deletion src/Kernel/src/SettingsConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ namespace
settings.setValue("LocationTableState", QVariant());
}
settings.endGroup();

}
}

Expand Down
11 changes: 2 additions & 9 deletions src/Kernel/src/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit 84f409f

Please sign in to comment.