build: rm DESKFLOW_APP_ID define

This commit is contained in:
sithlord48
2024-10-28 15:20:35 -04:00
committed by Nick Bolton
parent 937813cb2e
commit 46a6f74fb7
25 changed files with 41 additions and 41 deletions

View File

@ -54,10 +54,6 @@ endmacro()
macro(configure_meta)
set(DESKFLOW_APP_ID
"deskflow"
CACHE STRING "ID of the app for filenames, etc")
set(DESKFLOW_DOMAIN
"deskflow.org"
CACHE STRING "Domain of the app maintainer (not a URL)")
@ -98,7 +94,6 @@ macro(configure_meta)
true
CACHE BOOL "Show developer thanks message")
message(VERBOSE "App ID: ${DESKFLOW_APP_ID}")
message(VERBOSE "App domain: ${DESKFLOW_DOMAIN}")
message(VERBOSE "App name: ${DESKFLOW_APP_NAME}")
message(VERBOSE "Author name: ${DESKFLOW_AUTHOR_NAME}")
@ -111,7 +106,6 @@ macro(configure_meta)
message(VERBOSE "Show dev thanks: ${DESKFLOW_SHOW_DEV_THANKS}")
# TODO: We need to move this to configure_file() in the future, which is much cleaner.
add_definitions(-DDESKFLOW_APP_ID="${DESKFLOW_APP_ID}")
add_definitions(-DDESKFLOW_DOMAIN="${DESKFLOW_DOMAIN}")
add_definitions(-DDESKFLOW_APP_NAME="${DESKFLOW_APP_NAME}")
add_definitions(-DDESKFLOW_AUTHOR_NAME="${DESKFLOW_AUTHOR_NAME}")

View File

@ -351,8 +351,6 @@ macro(configure_qt)
message(STATUS "Qt version: ${Qt6_VERSION}")
set(GUI_QRC_FILE ${PROJECT_SOURCE_DIR}/src/gui/res/app.qrc)
endmacro()
macro(configure_openssl)

View File

@ -13,7 +13,7 @@ macro(configure_packaging)
set(DESKFLOW_PROJECT_RES_DIR ${PROJECT_SOURCE_DIR}/res)
if(${BUILD_INSTALLER})
set(CPACK_PACKAGE_NAME ${DESKFLOW_APP_ID})
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
set(CPACK_PACKAGE_CONTACT ${DESKFLOW_MAINTAINER})
set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION})
set(CPACK_PACKAGE_VENDOR ${DESKFLOW_AUTHOR_NAME})
@ -92,9 +92,6 @@ macro(configure_mac_packaging)
set(OS_STRING "macos-${CMAKE_SYSTEM_PROCESSOR}")
file(RENAME ${DESKFLOW_BUNDLE_DIR}/Contents/Resources/App.icns
${DESKFLOW_BUNDLE_DIR}/Contents/Resources/${DESKFLOW_APP_NAME}.icns)
endmacro()
#

View File

@ -6,11 +6,11 @@
<key>CFBundleDisplayName</key>
<string>@DESKFLOW_APP_NAME@</string>
<key>CFBundleExecutable</key>
<string>@DESKFLOW_APP_ID@</string>
<string>deskflow</string>
<key>CFBundleIconFile</key>
<string>@DESKFLOW_APP_NAME@.icns</string>
<key>CFBundleIdentifier</key>
<string>@DESKFLOW_APP_ID@</string>
<string>org.deskflow.deskflow</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Include>
<?define AppId="@DESKFLOW_APP_ID@"?>
<?define AppId="deskflow"?>
<?define Name="@DESKFLOW_APP_NAME@"?>
<?define Version="@DESKFLOW_VERSION@"?>
<?define Author="@DESKFLOW_AUTHOR_NAME@"?>
<?define BinDir="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@"?>
<?define ProjectIcon="@CMAKE_SOURCE_DIR@/src/gui/src/app.ico"?>
<?define ProjectIcon="@CMAKE_SOURCE_DIR@/src/gui/src/deskflow.ico"?>
<?define DeployResDir="@DESKFLOW_DEPLOY_RES_DIR@"?>
<?define QtDir="@QT_PATH@"?>
<?define QtBinDir="$(var.QtDir)\bin"?>

View File

@ -23,7 +23,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
file(
GLOB
sources
res/app.qrc
res/deskflow.qrc
src/*.cpp
src/*.h
src/dialogs/*.h
@ -33,7 +33,7 @@ file(
file(GLOB ui_files src/*.ui src/dialogs/*.ui)
if(WIN32)
set(rc_files ${CMAKE_CURRENT_SOURCE_DIR}/src/app.rc ${PROJECT_BINARY_DIR}/src/version.rc)
set(rc_files src/deskflow.rc ${PROJECT_BINARY_DIR}/src/version.rc)
endif()
# regular exe headers

View File

@ -501,7 +501,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../../res/gui/app.qrc">:/icons/64x64/padlock.png</pixmap>
<pixmap resource="../../../../res/gui/deskflow.qrc">:/icons/64x64/padlock.png</pixmap>
</property>
<property name="minimumSize">
<size>

View File

@ -24,7 +24,7 @@
#include "gui/config/Screen.h"
const QString ScreenSetupModel::m_MimeType = "application/x-" DESKFLOW_APP_ID "-screen";
const QString ScreenSetupModel::m_MimeType = "application/x-deskflow-screen";
ScreenSetupModel::ScreenSetupModel(ScreenList &screens, int numColumns, int numRows)
: QAbstractTableModel(NULL),

View File

@ -1 +0,0 @@
IDI_ICON1 ICON DISCARDABLE "app.ico"

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

1
src/gui/src/deskflow.rc Normal file
View File

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "deskflow.ico"

View File

@ -23,6 +23,7 @@
#endif
const auto kAppName = DESKFLOW_APP_NAME;
const auto kAppId = "deskflow";
const auto kAppDescription = "Mouse and keyboard sharing utility";
const auto kVersion = DESKFLOW_VERSION;

View File

@ -149,9 +149,9 @@ private:
// configuration file name
#if SYSAPI_WIN32
#define USER_CONFIG_NAME DESKFLOW_APP_ID ".sgc"
#define SYSTEM_CONFIG_NAME DESKFLOW_APP_ID ".sgc"
#define USER_CONFIG_NAME "deskflow.sgc"
#define SYSTEM_CONFIG_NAME "deskflow.sgc"
#elif SYSAPI_UNIX
#define USER_CONFIG_NAME "." DESKFLOW_APP_ID ".conf"
#define SYSTEM_CONFIG_NAME DESKFLOW_APP_ID ".conf"
#define USER_CONFIG_NAME ".deskflow.conf"
#define SYSTEM_CONFIG_NAME "deskflow.conf"
#endif

View File

@ -38,12 +38,10 @@ static const char *const kLogLevelNames[] = {"INFO", "DEBUG", "DEBUG1", "DEBUG2"
const char AppConfig::m_CoreServerName[] = SERVER_BINARY_NAME ".exe";
const char AppConfig::m_CoreClientName[] = CLIENT_BINARY_NAME ".exe";
const char AppConfig::m_LogDir[] = "log/";
const char AppConfig::m_ConfigFilename[] = DESKFLOW_APP_ID ".sgc";
#else
const char AppConfig::m_CoreServerName[] = SERVER_BINARY_NAME;
const char AppConfig::m_CoreClientName[] = CLIENT_BINARY_NAME;
const char AppConfig::m_LogDir[] = "/var/log/";
const char AppConfig::m_ConfigFilename[] = DESKFLOW_APP_ID ".conf";
#endif
// TODO: instead, use key value pair table, which would be less fragile.

View File

@ -21,6 +21,7 @@
#include "ElevateMode.h"
#include "IAppConfig.h"
#include "IConfigScopes.h"
#include "common/constants.h"
#include "gui/paths.h"
#include <QDir>
@ -35,7 +36,7 @@
namespace deskflow::gui {
const ElevateMode kDefaultElevateMode = ElevateMode::kAutomatic;
const QString kDefaultLogFile = QString("%1.log").arg(DESKFLOW_APP_ID);
const QString kDefaultLogFile = QStringLiteral("%1.log").arg(kAppId);
const int kDefaultTlsKeyLength = 2048;
#ifdef DESKFLOW_SHOW_DEV_THANKS
@ -295,8 +296,12 @@ private:
/// @brief Contains the string values of the settings names that will be saved
static const char *const m_SettingsName[];
/// @brief Core config filename (not the Qt settings filename)
static const char m_ConfigFilename[];
/// @brief Core config file extention (not the Qt settings filename)
#ifdef Q_OS_WIN
inline static const auto s_ConfigFileExt = QStringLiteral("sgc");
#else
inline static const auto s_ConfigFileExt = QStringLiteral("conf");
#endif
int m_Port = 24800;
QString m_Interface = "";
@ -315,7 +320,7 @@ private:
bool m_InvertConnection = false;
bool m_ServerGroupChecked = false;
bool m_UseExternalConfig = false;
QString m_ConfigFile = QDir::homePath() + "/" + m_ConfigFilename;
QString m_ConfigFile = QStringLiteral("%1/%2.%3").arg(QDir::homePath(), kAppId, s_ConfigFileExt);
bool m_UseInternalConfig = false;
bool m_ClientGroupChecked = false;
QString m_ServerHostname = "";

View File

@ -17,6 +17,7 @@
#include "CoreProcess.h"
#include "common/constants.h"
#include "gui/config/IAppConfig.h"
#include "gui/core/CoreTool.h"
#include "gui/paths.h"
@ -39,7 +40,7 @@
namespace deskflow::gui {
const int kRetryDelay = 1000;
const auto kServerConfigFilename = DESKFLOW_APP_ID "-server.conf";
const auto kServerConfigFilename = QStringLiteral("%1-server.conf").arg(kAppId);
const auto kLineSplitRegex = QRegularExpression("\r|\n|\r\n");
//

View File

@ -17,6 +17,7 @@
#pragma once
#include "common/constants.h"
#include "core/CoreTool.h"
#include <QDir>
@ -24,7 +25,7 @@
#include <QString>
// TODO: Reduce duplication of these strings between here and SecureSocket.cpp
const auto kCertificateFilename = QString("%1.pem").arg(DESKFLOW_APP_ID);
const auto kCertificateFilename = QStringLiteral("%1.pem").arg(kAppId);
const auto kSslDir = "tls";
namespace deskflow::gui::paths {

View File

@ -18,6 +18,7 @@
#include "SecureServerSocket.h"
#include <arch/XArch.h>
#include <common/constants.h>
#include <deskflow/ArgParser.h>
#include <deskflow/ArgsBase.h>
#include <net/SecureSocket.h>
@ -74,8 +75,7 @@ std::string SecureServerSocket::getCertificateFileName() const
if (certificateFilename.empty()) {
// TODO: Reduce duplication of these strings between here and
// SecureSocket.cpp
certificateFilename =
deskflow::string::sprintf("%s/tls/" DESKFLOW_APP_ID ".pem", ARCH->getProfileDirectory().c_str());
certificateFilename = deskflow::string::sprintf("%s/tls/%s.pem", ARCH->getProfileDirectory().c_str(), kAppId);
}
return certificateFilename;

View File

@ -19,6 +19,7 @@
#include "SecureSocket.h"
#include "arch/XArch.h"
#include "common/constants.h"
#include "deskflow/ArgParser.h"
#include "deskflow/ArgsBase.h"
#include "net/NetworkAddress.h"
@ -27,7 +28,7 @@
// TODO: Reduce duplication of these strings between here and SecureSocket.cpp
static const char s_certificateDir[] = {"tls"};
static const char s_certificateFilename[] = {DESKFLOW_APP_ID ".pem"};
static const char s_certificateFileExt[] = {"pem"};
//
// SecureListenSocket
@ -53,7 +54,7 @@ IDataSocket *SecureListenSocket::accept()
// default location of the TLS cert file in users dir
String certificateFilename = deskflow::string::sprintf(
"%s/%s/%s", ARCH->getProfileDirectory().c_str(), s_certificateDir, s_certificateFilename
"%s/%s/%s.%s", ARCH->getProfileDirectory().c_str(), s_certificateDir, kAppId, s_certificateFileExt
);
// if the tls cert option is set use that for the certificate file

View File

@ -24,6 +24,7 @@
#include "base/Log.h"
#include "base/Stopwatch.h"
#include "base/TMethodEventJob.h"
#include "common/constants.h"
#include "deskflow/Clipboard.h"
#include "deskflow/KeyMap.h"
#include "deskflow/XScreen.h"
@ -129,7 +130,8 @@ void EiScreen::init_ei()
ei_set_user_data(ei_, this);
ei_log_set_priority(ei_, EI_LOG_PRIORITY_DEBUG);
ei_log_set_handler(ei_, cb_handle_ei_log_event);
ei_configure_name(ei_, DESKFLOW_APP_ID " client");
std::string configName = kAppId;
ei_configure_name(ei_, configName.append(" client").c_str());
// install the platform event queue
events_->adoptBuffer(nullptr);

View File

@ -26,6 +26,7 @@
#include "base/TMethodEventJob.h"
#include "base/TMethodJob.h"
#include "client/Client.h"
#include "common/constants.h"
#include "deskflow/App.h"
#include "deskflow/ArgsBase.h"
#include "deskflow/ClientApp.h"
@ -1441,7 +1442,7 @@ bool MSWindowsScreen::onClipboardChange()
sendClipboardEvent(m_events->forClipboard().clipboardGrabbed(), kClipboardSelection);
}
} else if (!m_ownClipboard) {
LOG((CLOG_DEBUG "clipboard changed: " DESKFLOW_APP_ID " owned"));
LOG((CLOG_DEBUG "clipboard changed: %s owned", kAppId));
m_ownClipboard = true;
}

View File

@ -80,7 +80,7 @@ macro(set_sources)
list(APPEND sources ${PROJECT_BINARY_DIR}/src/version.rc)
endif()
list(APPEND sources ${GUI_QRC_FILE})
list(APPEND sources ${PROJECT_SOURCE_DIR}/src/gui/res/deskflow.qrc)
replace_platform_sources()
replace_arch_sources()

View File

@ -18,6 +18,7 @@
#include <array>
#include <functional>
#include "common/constants.h"
#include "deskflow/ArgParser.h"
#include "deskflow/ArgsBase.h"
#include "deskflow/ClientArgs.h"
@ -237,7 +238,7 @@ TEST(ArgParserTests, parseClientArgs_parses_single_help)
deskflow::ClientArgs args;
args.m_daemon = false;
char const *argv[] = {
"deskflow",
kAppId,
"--help"
#if WINAPI_MSWINDOWS
,