refactor: replace version.h with kDisplayVersion const

This commit is contained in:
sithlord48
2025-03-06 17:15:39 -05:00
committed by Nick Bolton
parent e38a8e6b15
commit 0a23e62093
5 changed files with 4 additions and 34 deletions

View File

@ -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;

View File

@ -10,7 +10,6 @@
#include "ui_AboutDialog.h"
#include "common/constants.h"
#include "common/version.h"
#include <QClipboard>
#include <QDateTime>
@ -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);

View File

@ -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

View File

@ -1,6 +1,6 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2024 Chris Rizzitello <sithlord48@gmail.com>
* SPDX-FileCopyrightText: (C) 2024 - 2025 Chris Rizzitello <sithlord48@gmail.com>
* 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";

View File

@ -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 <QString>
/**
* @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;
}