refactor: replace version.h with kDisplayVersion const
This commit is contained in:
parent
e38a8e6b15
commit
0a23e62093
5 changed files with 4 additions and 34 deletions
|
|
@ -9,7 +9,6 @@
|
||||||
#include "base/EventQueue.h"
|
#include "base/EventQueue.h"
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
#include "common/constants.h"
|
#include "common/constants.h"
|
||||||
#include "common/version.h"
|
|
||||||
#include "deskflow/DaemonApp.h"
|
#include "deskflow/DaemonApp.h"
|
||||||
#include "deskflow/ipc/DaemonIpcServer.h"
|
#include "deskflow/ipc/DaemonIpcServer.h"
|
||||||
|
|
||||||
|
|
@ -61,7 +60,7 @@ int main(int argc, char **argv)
|
||||||
// which is not useful for troubleshooting Windows services.
|
// 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
|
// 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.
|
// 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) {
|
switch (initResult) {
|
||||||
using enum DaemonApp::InitResult;
|
using enum DaemonApp::InitResult;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
#include "ui_AboutDialog.h"
|
#include "ui_AboutDialog.h"
|
||||||
|
|
||||||
#include "common/constants.h"
|
#include "common/constants.h"
|
||||||
#include "common/version.h"
|
|
||||||
|
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
@ -32,7 +31,7 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui{std::make_unique
|
||||||
ui->btnCopyVersion->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::EditCopy));
|
ui->btnCopyVersion->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::EditCopy));
|
||||||
connect(ui->btnCopyVersion, &QPushButton::clicked, this, &AboutDialog::copyVersionText);
|
connect(ui->btnCopyVersion, &QPushButton::clicked, this, &AboutDialog::copyVersionText);
|
||||||
|
|
||||||
ui->lblVersion->setText(displayVersion());
|
ui->lblVersion->setText(kDisplayVersion);
|
||||||
|
|
||||||
ui->lblDescription->setText(kAppDescription);
|
ui->lblDescription->setText(kAppDescription);
|
||||||
ui->lblCopyright->setText(kCopyright);
|
ui->lblCopyright->setText(kCopyright);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ configure_file(constants.h.in constants.h @ONLY)
|
||||||
|
|
||||||
add_library(common STATIC
|
add_library(common STATIC
|
||||||
common.h
|
common.h
|
||||||
version.h
|
|
||||||
IInterface.h
|
IInterface.h
|
||||||
stddeque.h
|
stddeque.h
|
||||||
stdexcept.h
|
stdexcept.h
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Deskflow -- mouse and keyboard sharing utility
|
* 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-FileCopyrightText: (C) 2025 Symless Ltd.
|
||||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
* 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 kAppDescription = "@CMAKE_PROJECT_DESCRIPTION@";
|
||||||
const auto kVersion = "@CMAKE_PROJECT_VERSION@";
|
const auto kVersion = "@CMAKE_PROJECT_VERSION@";
|
||||||
const auto kVersionGitSha = "@GIT_SHA_SHORT@";
|
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 kDaemonBinName = "@CMAKE_PROJECT_NAME@-daemon";
|
||||||
const auto kDaemonIpcName = "@CMAKE_PROJECT_NAME@-daemon";
|
const auto kDaemonIpcName = "@CMAKE_PROJECT_NAME@-daemon";
|
||||||
const auto kDaemonLogFilename = "@CMAKE_PROJECT_NAME@-daemon.log";
|
const auto kDaemonLogFilename = "@CMAKE_PROJECT_NAME@-daemon.log";
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue