diff --git a/src/apps/deskflow-daemon/deskflow-daemon.cpp b/src/apps/deskflow-daemon/deskflow-daemon.cpp index b44a76da9..5dfddc60e 100644 --- a/src/apps/deskflow-daemon/deskflow-daemon.cpp +++ b/src/apps/deskflow-daemon/deskflow-daemon.cpp @@ -9,7 +9,6 @@ #include "base/EventQueue.h" #include "base/Log.h" #include "common/constants.h" -#include "common/version.h" #include "deskflow/DaemonApp.h" #include "deskflow/ipc/DaemonIpcServer.h" @@ -61,7 +60,7 @@ int main(int argc, char **argv) // which is not useful for troubleshooting Windows services. // It's important to write the version number to the log file so we can be certain the old daemon // was uninstalled, since sometimes Windows services can get stuck and fail to be removed. - LOG_PRINT("%s Daemon v%s", kAppName, displayVersion().toStdString().c_str()); + LOG_PRINT("%s Daemon v%s", kAppName, kDisplayVersion); switch (initResult) { using enum DaemonApp::InitResult; diff --git a/src/apps/deskflow-gui/dialogs/AboutDialog.cpp b/src/apps/deskflow-gui/dialogs/AboutDialog.cpp index 4fce649ac..dffc80312 100644 --- a/src/apps/deskflow-gui/dialogs/AboutDialog.cpp +++ b/src/apps/deskflow-gui/dialogs/AboutDialog.cpp @@ -10,7 +10,6 @@ #include "ui_AboutDialog.h" #include "common/constants.h" -#include "common/version.h" #include #include @@ -32,7 +31,7 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui{std::make_unique ui->btnCopyVersion->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::EditCopy)); connect(ui->btnCopyVersion, &QPushButton::clicked, this, &AboutDialog::copyVersionText); - ui->lblVersion->setText(displayVersion()); + ui->lblVersion->setText(kDisplayVersion); ui->lblDescription->setText(kAppDescription); ui->lblCopyright->setText(kCopyright); diff --git a/src/lib/common/CMakeLists.txt b/src/lib/common/CMakeLists.txt index 9b1c2fe6c..b788eb2be 100644 --- a/src/lib/common/CMakeLists.txt +++ b/src/lib/common/CMakeLists.txt @@ -5,7 +5,6 @@ configure_file(constants.h.in constants.h @ONLY) add_library(common STATIC common.h - version.h IInterface.h stddeque.h stdexcept.h diff --git a/src/lib/common/constants.h.in b/src/lib/common/constants.h.in index 92760cd5b..ba762c44d 100644 --- a/src/lib/common/constants.h.in +++ b/src/lib/common/constants.h.in @@ -1,6 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility - * SPDX-FileCopyrightText: (C) 2024 Chris Rizzitello + * SPDX-FileCopyrightText: (C) 2024 - 2025 Chris Rizzitello * SPDX-FileCopyrightText: (C) 2025 Symless Ltd. * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception */ @@ -12,6 +12,7 @@ const auto kAppId = "@CMAKE_PROJECT_NAME@"; const auto kAppDescription = "@CMAKE_PROJECT_DESCRIPTION@"; const auto kVersion = "@CMAKE_PROJECT_VERSION@"; const auto kVersionGitSha = "@GIT_SHA_SHORT@"; +const auto kDisplayVersion = @CMAKE_PROJECT_VERSION_TWEAK@ ? "@CMAKE_PROJECT_VERSION@ (@GIT_SHA_SHORT@)" : "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@.@CMAKE_PROJECT_VERSION_PATCH@"; const auto kDaemonBinName = "@CMAKE_PROJECT_NAME@-daemon"; const auto kDaemonIpcName = "@CMAKE_PROJECT_NAME@-daemon"; const auto kDaemonLogFilename = "@CMAKE_PROJECT_NAME@-daemon.log"; diff --git a/src/lib/common/version.h b/src/lib/common/version.h deleted file mode 100644 index 92260fa7b..000000000 --- a/src/lib/common/version.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Deskflow -- mouse and keyboard sharing utility - * SPDX-FileCopyrightText: (C) 2025 Symless Ltd. - * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception - */ - -#pragma once - -#include "common/constants.h" - -#include - -/** - * @brief Get the version number string for display. - * - * If the version number ends with ".0", the ".0" is removed. - * If the version number does not end with ".0", the git SHA is appended in parentheses. - */ -inline QString displayVersion() -{ - auto versionString = QString(kVersion); - if (versionString.endsWith(QStringLiteral(".0"))) { - versionString.chop(2); - } else { - versionString.append(QStringLiteral(" (%1)").arg(kVersionGitSha)); - } - return versionString; -}