From 3f9bf0ab9c193d10a052c96dfe88b2323a3a30de Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Wed, 26 Jun 2024 20:18:41 +0200 Subject: [PATCH] Add versionSuffix function to Theme. Signed-off-by: Camila Ayres --- src/gui/updater/updater.cpp | 2 +- src/libsync/configfile.cpp | 2 +- src/libsync/theme.cpp | 5 +++++ src/libsync/theme.h | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/updater/updater.cpp b/src/gui/updater/updater.cpp index 6f5f3970a..2e49e8706 100644 --- a/src/gui/updater/updater.cpp +++ b/src/gui/updater/updater.cpp @@ -99,7 +99,7 @@ QUrlQuery Updater::getQueryParams() query.addQueryItem(QStringLiteral("buildArch"), QSysInfo::buildCpuArchitecture()); query.addQueryItem(QStringLiteral("currentArch"), QSysInfo::currentCpuArchitecture()); - const auto suffix = QStringLiteral(MIRALL_STRINGIFY(MIRALL_VERSION_SUFFIX)); + const auto suffix = Theme::instance()->versionSuffix(); query.addQueryItem(QStringLiteral("versionsuffix"), suffix); ConfigFile config; diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index 4eb39de72..b43317ae9 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -686,7 +686,7 @@ int ConfigFile::updateSegment() const QString ConfigFile::updateChannel() const { - auto defaultUpdateChannel = QString::fromLatin1(MIRALL_STRINGIFY(MIRALL_VERSION_SUFFIX)); + auto defaultUpdateChannel = Theme::instance()->versionSuffix(); QSettings settings(configFile(), QSettings::IniFormat); const auto channel = settings.value(QLatin1String(updateChannelC), defaultUpdateChannel).toString(); if (!validUpdateChannels().contains(channel)) { diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index bb4bae4c4..b20ef2a67 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -195,6 +195,11 @@ QString Theme::version() const return MIRALL_VERSION_STRING; } +QString Theme::versionSuffix() const +{ + return QString::fromLatin1(MIRALL_STRINGIFY(MIRALL_VERSION_SUFFIX)); +} + QString Theme::configFileName() const { return QStringLiteral(APPLICATION_CONFIG_NAME ".cfg"); diff --git a/src/libsync/theme.h b/src/libsync/theme.h index c59266f65..e5d312dde 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -196,6 +196,7 @@ public: [[nodiscard]] QString statusHeaderText(SyncResult::Status) const; [[nodiscard]] QString version() const; + [[nodiscard]] QString versionSuffix() const; /** * Characteristics: bool if more than one sync folder is allowed