diff --git a/cmake/Definitions.cmake b/cmake/Definitions.cmake index dee47b28d..9a2c2240c 100644 --- a/cmake/Definitions.cmake +++ b/cmake/Definitions.cmake @@ -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}") diff --git a/cmake/Libraries.cmake b/cmake/Libraries.cmake index cb45f6fc1..3c8b5ff0f 100644 --- a/cmake/Libraries.cmake +++ b/cmake/Libraries.cmake @@ -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) diff --git a/cmake/Packaging.cmake b/cmake/Packaging.cmake index 12e3f3936..3254d4a7d 100644 --- a/cmake/Packaging.cmake +++ b/cmake/Packaging.cmake @@ -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() # diff --git a/deploy/dist/mac/bundle/Contents/Info.plist.in b/deploy/dist/mac/bundle/Contents/Info.plist.in index 94ee5683c..e25e88bb2 100644 --- a/deploy/dist/mac/bundle/Contents/Info.plist.in +++ b/deploy/dist/mac/bundle/Contents/Info.plist.in @@ -6,11 +6,11 @@ CFBundleDisplayName @DESKFLOW_APP_NAME@ CFBundleExecutable - @DESKFLOW_APP_ID@ + deskflow CFBundleIconFile @DESKFLOW_APP_NAME@.icns CFBundleIdentifier - @DESKFLOW_APP_ID@ + org.deskflow.deskflow CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/deploy/dist/mac/bundle/Contents/Resources/App.icns b/deploy/dist/mac/bundle/Contents/Resources/Deskflow.icns similarity index 100% rename from deploy/dist/mac/bundle/Contents/Resources/App.icns rename to deploy/dist/mac/bundle/Contents/Resources/Deskflow.icns diff --git a/deploy/dist/wix/Include.wxi.in b/deploy/dist/wix/Include.wxi.in index 2d3d17de2..467f9ab66 100644 --- a/deploy/dist/wix/Include.wxi.in +++ b/deploy/dist/wix/Include.wxi.in @@ -1,11 +1,11 @@ - + - + diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 0567ba3bd..d94a197bd 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -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 diff --git a/src/gui/res/app.qrc b/src/gui/res/deskflow.qrc similarity index 100% rename from src/gui/res/app.qrc rename to src/gui/res/deskflow.qrc diff --git a/src/gui/src/MainWindow.ui b/src/gui/src/MainWindow.ui index 20bab33f3..02a81a84e 100644 --- a/src/gui/src/MainWindow.ui +++ b/src/gui/src/MainWindow.ui @@ -501,7 +501,7 @@ - :/icons/64x64/padlock.png + :/icons/64x64/padlock.png diff --git a/src/gui/src/ScreenSetupModel.cpp b/src/gui/src/ScreenSetupModel.cpp index a0c3e9573..044792ec6 100644 --- a/src/gui/src/ScreenSetupModel.cpp +++ b/src/gui/src/ScreenSetupModel.cpp @@ -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), diff --git a/src/gui/src/app.rc b/src/gui/src/app.rc deleted file mode 100644 index 80624c3e4..000000000 --- a/src/gui/src/app.rc +++ /dev/null @@ -1 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "app.ico" diff --git a/src/gui/src/app.ico b/src/gui/src/deskflow.ico similarity index 100% rename from src/gui/src/app.ico rename to src/gui/src/deskflow.ico diff --git a/src/gui/src/deskflow.rc b/src/gui/src/deskflow.rc new file mode 100644 index 000000000..d22c936e1 --- /dev/null +++ b/src/gui/src/deskflow.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "deskflow.ico" diff --git a/src/lib/common/constants.h b/src/lib/common/constants.h index db280385a..127a7c6b0 100644 --- a/src/lib/common/constants.h +++ b/src/lib/common/constants.h @@ -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; diff --git a/src/lib/deskflow/ServerApp.h b/src/lib/deskflow/ServerApp.h index 1c5eb8054..979126568 100644 --- a/src/lib/deskflow/ServerApp.h +++ b/src/lib/deskflow/ServerApp.h @@ -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 diff --git a/src/lib/gui/config/AppConfig.cpp b/src/lib/gui/config/AppConfig.cpp index 8bff3a88f..5df0c59ab 100644 --- a/src/lib/gui/config/AppConfig.cpp +++ b/src/lib/gui/config/AppConfig.cpp @@ -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. diff --git a/src/lib/gui/config/AppConfig.h b/src/lib/gui/config/AppConfig.h index 3fe4bb8d9..83a492dcf 100644 --- a/src/lib/gui/config/AppConfig.h +++ b/src/lib/gui/config/AppConfig.h @@ -21,6 +21,7 @@ #include "ElevateMode.h" #include "IAppConfig.h" #include "IConfigScopes.h" +#include "common/constants.h" #include "gui/paths.h" #include @@ -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 = ""; diff --git a/src/lib/gui/core/CoreProcess.cpp b/src/lib/gui/core/CoreProcess.cpp index d83322cdc..19a36549a 100644 --- a/src/lib/gui/core/CoreProcess.cpp +++ b/src/lib/gui/core/CoreProcess.cpp @@ -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"); // diff --git a/src/lib/gui/paths.h b/src/lib/gui/paths.h index 1b59a3fb5..5d1c7cfe6 100644 --- a/src/lib/gui/paths.h +++ b/src/lib/gui/paths.h @@ -17,6 +17,7 @@ #pragma once +#include "common/constants.h" #include "core/CoreTool.h" #include @@ -24,7 +25,7 @@ #include // 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 { diff --git a/src/lib/net/InverseSockets/SecureServerSocket.cpp b/src/lib/net/InverseSockets/SecureServerSocket.cpp index 923feab80..6f1c6682f 100644 --- a/src/lib/net/InverseSockets/SecureServerSocket.cpp +++ b/src/lib/net/InverseSockets/SecureServerSocket.cpp @@ -18,6 +18,7 @@ #include "SecureServerSocket.h" #include +#include #include #include #include @@ -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; diff --git a/src/lib/net/SecureListenSocket.cpp b/src/lib/net/SecureListenSocket.cpp index 00dfe4c3b..ca3733cab 100644 --- a/src/lib/net/SecureListenSocket.cpp +++ b/src/lib/net/SecureListenSocket.cpp @@ -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 diff --git a/src/lib/platform/EiScreen.cpp b/src/lib/platform/EiScreen.cpp index 9ca8bca09..3e1daaae9 100644 --- a/src/lib/platform/EiScreen.cpp +++ b/src/lib/platform/EiScreen.cpp @@ -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); diff --git a/src/lib/platform/MSWindowsScreen.cpp b/src/lib/platform/MSWindowsScreen.cpp index d6576adc9..e25dd5a64 100644 --- a/src/lib/platform/MSWindowsScreen.cpp +++ b/src/lib/platform/MSWindowsScreen.cpp @@ -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; } diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index cad4e171f..56f28695b 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -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() diff --git a/src/test/unittests/deskflow/ArgParserTests.cpp b/src/test/unittests/deskflow/ArgParserTests.cpp index 8f4624a3a..243785f89 100644 --- a/src/test/unittests/deskflow/ArgParserTests.cpp +++ b/src/test/unittests/deskflow/ArgParserTests.cpp @@ -18,6 +18,7 @@ #include #include +#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 ,