build: rm DESKFLOW_APP_NAME define

Unify Server APP USER_CONFIG_NAME and SYSTEM_CONFIG_NAME
 Some unix users may need to move their config to deskflow.conf from .deskflow.conf
This commit is contained in:
sithlord48 2024-11-01 08:59:17 -04:00 committed by Nick Bolton
parent 9b59acdf26
commit 403830ceea
27 changed files with 83 additions and 77 deletions

View file

@ -54,10 +54,6 @@ endmacro()
macro(configure_meta) macro(configure_meta)
set(DESKFLOW_APP_NAME
"Deskflow"
CACHE STRING "App name (used in GUI title bar, etc)")
set(DESKFLOW_AUTHOR_NAME set(DESKFLOW_AUTHOR_NAME
"Deskflow" "Deskflow"
CACHE STRING "Author name (also used as organization name)") CACHE STRING "Author name (also used as organization name)")
@ -90,7 +86,6 @@ macro(configure_meta)
true true
CACHE BOOL "Show developer thanks message") CACHE BOOL "Show developer thanks message")
message(VERBOSE "App name: ${DESKFLOW_APP_NAME}")
message(VERBOSE "Author name: ${DESKFLOW_AUTHOR_NAME}") message(VERBOSE "Author name: ${DESKFLOW_AUTHOR_NAME}")
message(VERBOSE "Maintainer: ${DESKFLOW_MAINTAINER}") message(VERBOSE "Maintainer: ${DESKFLOW_MAINTAINER}")
message(VERBOSE "Website URL: ${DESKFLOW_WEBSITE_URL}") message(VERBOSE "Website URL: ${DESKFLOW_WEBSITE_URL}")
@ -101,7 +96,6 @@ macro(configure_meta)
message(VERBOSE "Show dev thanks: ${DESKFLOW_SHOW_DEV_THANKS}") 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. # TODO: We need to move this to configure_file() in the future, which is much cleaner.
add_definitions(-DDESKFLOW_APP_NAME="${DESKFLOW_APP_NAME}")
add_definitions(-DDESKFLOW_AUTHOR_NAME="${DESKFLOW_AUTHOR_NAME}") add_definitions(-DDESKFLOW_AUTHOR_NAME="${DESKFLOW_AUTHOR_NAME}")
add_definitions(-DDESKFLOW_MAINTAINER="${DESKFLOW_MAINTAINER}") add_definitions(-DDESKFLOW_MAINTAINER="${DESKFLOW_MAINTAINER}")
add_definitions(-DDESKFLOW_WEBSITE_URL="${DESKFLOW_WEBSITE_URL}") add_definitions(-DDESKFLOW_WEBSITE_URL="${DESKFLOW_WEBSITE_URL}")

View file

@ -85,7 +85,7 @@ macro(configure_mac_packaging)
set(DESKFLOW_BUNDLE_SOURCE_DIR set(DESKFLOW_BUNDLE_SOURCE_DIR
${PROJECT_SOURCE_DIR}/deploy/dist/mac/bundle ${PROJECT_SOURCE_DIR}/deploy/dist/mac/bundle
CACHE PATH "Path to the macOS app bundle") CACHE PATH "Path to the macOS app bundle")
set(DESKFLOW_BUNDLE_DIR ${PROJECT_BINARY_DIR}/bundle/${DESKFLOW_APP_NAME}.app) set(DESKFLOW_BUNDLE_DIR ${PROJECT_BINARY_DIR}/bundle/Deskflow.app)
set(DESKFLOW_BUNDLE_BINARY_DIR ${DESKFLOW_BUNDLE_DIR}/Contents/MacOS) set(DESKFLOW_BUNDLE_BINARY_DIR ${DESKFLOW_BUNDLE_DIR}/Contents/MacOS)
configure_files(${DESKFLOW_BUNDLE_SOURCE_DIR} ${DESKFLOW_BUNDLE_DIR}) configure_files(${DESKFLOW_BUNDLE_SOURCE_DIR} ${DESKFLOW_BUNDLE_DIR})

View file

@ -4,17 +4,17 @@
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>English</string> <string>English</string>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>@DESKFLOW_APP_NAME@</string> <string>Deskflow</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>deskflow</string> <string>deskflow</string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>@DESKFLOW_APP_NAME@.icns</string> <string>Deskflow.icns</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>org.deskflow.deskflow</string> <string>org.deskflow.deskflow</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>@DESKFLOW_APP_NAME@</string> <string>Deskflow</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Include> <Include>
<?define AppId="deskflow"?> <?define AppId="deskflow"?>
<?define Name="@DESKFLOW_APP_NAME@"?> <?define Name="Deskflow"?>
<?define Version="@DESKFLOW_VERSION@"?> <?define Version="@DESKFLOW_VERSION@"?>
<?define Author="@DESKFLOW_AUTHOR_NAME@"?> <?define Author="@DESKFLOW_AUTHOR_NAME@"?>
<?define BinDir="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@"?> <?define BinDir="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@"?>

View file

@ -13,13 +13,13 @@ https://learn.microsoft.com/en-us/windows/win32/menurc/versioninfo-resource?redi
#define VER_PRODUCTVERSION_STR "@DESKFLOW_VERSION@\0" #define VER_PRODUCTVERSION_STR "@DESKFLOW_VERSION@\0"
#define VER_COMPANYNAME_STR "@DESKFLOW_AUTHOR_NAME@\0" #define VER_COMPANYNAME_STR "@DESKFLOW_AUTHOR_NAME@\0"
#define VER_FILEDESCRIPTION_STR "@DESKFLOW_APP_NAME@\0" #define VER_FILEDESCRIPTION_STR "Deskflow\0"
#define VER_INTERNALNAME_STR "@DESKFLOW_APP_NAME@\0" #define VER_INTERNALNAME_STR "Deskflow\0"
#define VER_LEGALCOPYRIGHT_STR "© 2024 Deskflow Developers\0" #define VER_LEGALCOPYRIGHT_STR "© 2024 Deskflow Developers\0"
#define VER_LEGALTRADEMARKS1_STR "All Rights Reserved\0" #define VER_LEGALTRADEMARKS1_STR "All Rights Reserved\0"
#define VER_LEGALTRADEMARKS2_STR "\0" #define VER_LEGALTRADEMARKS2_STR "\0"
#define VER_ORIGINALFILENAME_STR "\0" #define VER_ORIGINALFILENAME_STR "\0"
#define VER_PRODUCTNAME_STR "@DESKFLOW_APP_NAME@\0" #define VER_PRODUCTNAME_STR "Deskflow\0"
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION FILEVERSION VER_FILEVERSION

View file

@ -12,6 +12,7 @@
#include <QFormLayout> #include <QFormLayout>
#include <QPushButton> #include <QPushButton>
#include "common/constants.h"
#include "gui/config/AppConfig.h" #include "gui/config/AppConfig.h"
#include "gui/styles.h" #include "gui/styles.h"
#include "gui/validators/ScreenNameValidator.h" #include "gui/validators/ScreenNameValidator.h"
@ -23,7 +24,7 @@ SetupWizard::SetupWizard(AppConfig &appConfig)
m_lineName{new QLineEdit(this)}, m_lineName{new QLineEdit(this)},
m_btnApply{new QPushButton(tr("Continue"), this)} m_btnApply{new QPushButton(tr("Continue"), this)}
{ {
setWindowTitle(tr("Setup %1").arg(DESKFLOW_APP_NAME)); setWindowTitle(tr("Setup %1").arg(kAppName));
setFixedSize(740, 550); setFixedSize(740, 550);

View file

@ -19,6 +19,7 @@
#include "ServerConfigDialog.h" #include "ServerConfigDialog.h"
#include "ui_ServerConfigDialog.h" #include "ui_ServerConfigDialog.h"
#include "common/constants.h"
#include "dialogs/ActionDialog.h" #include "dialogs/ActionDialog.h"
#include "dialogs/HotkeyDialog.h" #include "dialogs/HotkeyDialog.h"
#include "dialogs/ScreenSettingsDialog.h" #include "dialogs/ScreenSettingsDialog.h"
@ -447,12 +448,14 @@ void ServerConfigDialog::on_m_pCheckBoxUseExternalConfig_toggled(bool checked)
bool ServerConfigDialog::on_m_pButtonBrowseConfigFile_clicked() bool ServerConfigDialog::on_m_pButtonBrowseConfigFile_clicked()
{ {
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
const QString deskflowConfigFilter(QString("%1 Configurations (*.sgc);;All files (*.*)").arg(DESKFLOW_APP_NAME)); static const auto configExt = QStringLiteral("sgc");
#else #else
const QString deskflowConfigFilter(QString("%1 Configurations (*.conf);;All files (*.*)").arg(DESKFLOW_APP_NAME)); static const auto configExt = QStringLiteral("conf");
#endif #endif
static const auto deskflowConfigFilter = QStringLiteral("%1 Configurations (*.%2);;All files (*.*)");
QString fileName = QFileDialog::getOpenFileName(this, "Browse for a config file", "", deskflowConfigFilter); QString fileName =
QFileDialog::getOpenFileName(this, "Browse for a config file", "", deskflowConfigFilter.arg(kAppName, configExt));
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
ui->m_pEditConfigFile->setText(fileName); ui->m_pEditConfigFile->setText(fileName);

View file

@ -93,7 +93,7 @@ int main(int argc, char *argv[])
qInstallMessageHandler(deskflow::gui::messages::messageHandler); qInstallMessageHandler(deskflow::gui::messages::messageHandler);
QString version = QString::fromStdString(deskflow::version()); QString version = QString::fromStdString(deskflow::version());
qInfo(DESKFLOW_APP_NAME " v%s", qPrintable(version)); qInfo("%s v%s", kAppName, qPrintable(version));
dotenv(); dotenv();
Logger::instance().loadEnvVars(); Logger::instance().loadEnvVars();
@ -101,11 +101,9 @@ int main(int argc, char *argv[])
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
if (app.applicationDirPath().startsWith("/Volumes/")) { if (app.applicationDirPath().startsWith("/Volumes/")) {
QMessageBox::information( QString msgBody = QStringLiteral("Please drag %1 to the Applications folder, "
NULL, DESKFLOW_APP_NAME, "and open it from there.");
"Please drag " DESKFLOW_APP_NAME " to the Applications folder, " QMessageBox::information(NULL, kAppName, msgBody.arg(kAppName));
"and open it from there."
);
return 1; return 1;
} }
@ -179,12 +177,10 @@ bool checkMacAssistiveDevices()
// now deprecated in mavericks. // now deprecated in mavericks.
bool result = AXAPIEnabled(); bool result = AXAPIEnabled();
if (!result) { if (!result) {
QMessageBox::information( QString msgBody = QString("Please enable access to assistive devices "
NULL, DESKFLOW_APP_NAME, "System Preferences -> Security & Privacy -> "
"Please enable access to assistive devices " "Privacy -> Accessibility, then re-open %1.");
"System Preferences -> Security & Privacy -> " QMessageBox::information(NULL, kAppName, msgBody.arg(kAppName));
"Privacy -> Accessibility, then re-open " DESKFLOW_APP_NAME "."
);
} }
return result; return result;

View file

@ -18,6 +18,7 @@
#include "arch/unix/ArchFileUnix.h" #include "arch/unix/ArchFileUnix.h"
#include "common/constants.h"
#include <cstring> #include <cstring>
#include <filesystem> #include <filesystem>
#include <pwd.h> #include <pwd.h>
@ -90,7 +91,9 @@ std::string ArchFileUnix::getInstalledDirectory()
#if WINAPI_XWINDOWS #if WINAPI_XWINDOWS
return "/usr/bin"; return "/usr/bin";
#else #else
return "/Applications/" DESKFLOW_APP_NAME ".app/Contents/MacOS"; std::string rtn = "/Applications/";
rtn.append(kAppName).append(".app/Contents/MacOS");
return rtn;
#endif #endif
} }
@ -121,12 +124,12 @@ std::string ArchFileUnix::getProfileDirectory()
#if WINAPI_XWINDOWS #if WINAPI_XWINDOWS
const auto xdgDir = std::getenv("XDG_CONFIG_HOME"); const auto xdgDir = std::getenv("XDG_CONFIG_HOME");
if (xdgDir != nullptr) { if (xdgDir != nullptr) {
return std::filesystem::path(xdgDir) / DESKFLOW_APP_NAME; return std::filesystem::path(xdgDir) / kAppName;
} else { } else {
return homeDir / ".config" / DESKFLOW_APP_NAME; return homeDir / ".config" / kAppName;
} }
#else #else
return homeDir / "Library" / DESKFLOW_APP_NAME; return homeDir / "Library" / kAppName;
#endif #endif
} }
} }

View file

@ -19,6 +19,7 @@
#include "arch/unix/ArchSystemUnix.h" #include "arch/unix/ArchSystemUnix.h"
#include <array> #include <array>
#include <common/constants.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#ifndef __APPLE__ #ifndef __APPLE__
@ -112,9 +113,8 @@ bool ArchSystemUnix::DBusInhibitScreenCall(InhibitScreenServices serviceID, bool
return false; return false;
} }
reply = screenSaverInterface.call( QString msg = "Sleep is manually prevented by the %1 preferences";
"Inhibit", DESKFLOW_APP_NAME, "Sleep is manually prevented by the " DESKFLOW_APP_NAME " preferences" reply = screenSaverInterface.call("Inhibit", kAppName, msg.arg(kAppName));
);
if (reply.isValid()) if (reply.isValid())
cookies[serviceNum] = reply.value(); cookies[serviceNum] = reply.value();
} else { } else {

View file

@ -20,6 +20,7 @@
#include "arch/IArchDaemon.h" #include "arch/IArchDaemon.h"
#include "arch/IArchMultithread.h" #include "arch/IArchMultithread.h"
#include "common/constants.h"
#include "common/stdstring.h" #include "common/stdstring.h"
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
@ -144,8 +145,8 @@ private:
std::string m_commandLine; std::string m_commandLine;
}; };
#define DEFAULT_DAEMON_NAME _T(DESKFLOW_APP_NAME) #define DEFAULT_DAEMON_NAME _T(kAppName)
#define DEFAULT_DAEMON_INFO _T("Manages the " DESKFLOW_APP_NAME " foreground processes.") #define DEFAULT_DAEMON_INFO _T("Manages the Deskflow foreground processes.")
#define LEGACY_SERVER_DAEMON_NAME _T(DESKFLOW_APP_NAME " Server") #define LEGACY_SERVER_DAEMON_NAME _T("Deskflow Server")
#define LEGACY_CLIENT_DAEMON_NAME _T(DESKFLOW_APP_NAME " Client") #define LEGACY_CLIENT_DAEMON_NAME _T("Deskflow Client")

View file

@ -156,7 +156,7 @@ std::string ArchFileWindows::getProfileDirectory()
} }
// HACK: append program name, this seems wrong. // HACK: append program name, this seems wrong.
dir.append("\\" DESKFLOW_APP_NAME); dir.append("\\Deskflow");
return dir; return dir;
} }

View file

@ -20,6 +20,7 @@
#include "arch/win32/ArchMiscWindows.h" #include "arch/win32/ArchMiscWindows.h"
#include "arch/XArch.h" #include "arch/XArch.h"
#include "common/constants.h"
#include "tchar.h" #include "tchar.h"
#include <string> #include <string>
@ -27,7 +28,7 @@
#include <psapi.h> #include <psapi.h>
#include <windows.h> #include <windows.h>
static const char *s_settingsKeyNames[] = {_T("SOFTWARE"), _T(DESKFLOW_APP_NAME), NULL}; static const char *s_settingsKeyNames[] = {_T("SOFTWARE"), _T(kAppName), NULL};
// //
// ArchSystemWindows // ArchSystemWindows

View file

@ -22,7 +22,7 @@
#error version was not passed to the compiler #error version was not passed to the compiler
#endif #endif
const auto kAppName = DESKFLOW_APP_NAME; const auto kAppName = "Deskflow";
const auto kAppId = "deskflow"; const auto kAppId = "deskflow";
const auto kAppDescription = "Mouse and keyboard sharing utility"; const auto kAppDescription = "Mouse and keyboard sharing utility";
const auto kVersion = DESKFLOW_VERSION; const auto kVersion = DESKFLOW_VERSION;

View file

@ -26,6 +26,7 @@
#include "base/String.h" #include "base/String.h"
#include "base/TMethodEventJob.h" #include "base/TMethodEventJob.h"
#include "client/Client.h" #include "client/Client.h"
#include "common/constants.h"
#include "deskflow/ArgParser.h" #include "deskflow/ArgParser.h"
#include "deskflow/ClientArgs.h" #include "deskflow/ClientArgs.h"
#include "deskflow/Screen.h" #include "deskflow/Screen.h"
@ -134,7 +135,7 @@ void ClientApp::help()
#endif #endif
<< HELP_SYS_ARGS << HELP_COMMON_ARGS << " <server-address>" << HELP_SYS_ARGS << HELP_COMMON_ARGS << " <server-address>"
<< "\n\n" << "\n\n"
<< "Connect to a " DESKFLOW_APP_NAME " mouse/keyboard sharing server.\n" << "Connect to a " << kAppName << " mouse/keyboard sharing server.\n"
<< "\n" << "\n"
<< " -a, --address <address> local network interface address.\n" << " -a, --address <address> local network interface address.\n"
<< HELP_COMMON_INFO_1 << HELP_SYS_INFO << " --yscroll <delta> defines the vertical scrolling delta,\n" << HELP_COMMON_INFO_1 << HELP_SYS_INFO << " --yscroll <delta> defines the vertical scrolling delta,\n"
@ -165,7 +166,7 @@ void ClientApp::help()
const char *ClientApp::daemonName() const const char *ClientApp::daemonName() const
{ {
#if SYSAPI_WIN32 #if SYSAPI_WIN32
return DESKFLOW_APP_NAME " Client"; return "Deskflow Client";
#elif SYSAPI_UNIX #elif SYSAPI_UNIX
return CLIENT_BINARY_NAME; return CLIENT_BINARY_NAME;
#endif #endif

View file

@ -25,6 +25,7 @@
#include "base/Log.h" #include "base/Log.h"
#include "base/TMethodEventJob.h" #include "base/TMethodEventJob.h"
#include "base/log_outputters.h" #include "base/log_outputters.h"
#include "common/constants.h"
#include "common/ipc.h" #include "common/ipc.h"
#include "deskflow/App.h" #include "deskflow/App.h"
#include "deskflow/ArgParser.h" #include "deskflow/ArgParser.h"
@ -178,10 +179,10 @@ int DaemonApp::run(int argc, char **argv)
} else { } else {
#if SYSAPI_WIN32 #if SYSAPI_WIN32
LOG((CLOG_PRINT "daemonizing windows service")); LOG((CLOG_PRINT "daemonizing windows service"));
arch.daemonize(DESKFLOW_APP_NAME, winMainLoopStatic); arch.daemonize(kAppName, winMainLoopStatic);
#elif SYSAPI_UNIX #elif SYSAPI_UNIX
LOG((CLOG_PRINT "daemonizing unix service")); LOG((CLOG_PRINT "daemonizing unix service"));
arch.daemonize(DESKFLOW_APP_NAME, unixMainLoopStatic); arch.daemonize(kAppName, unixMainLoopStatic);
#endif #endif
} }

View file

@ -23,6 +23,7 @@
#include "base/Log.h" #include "base/Log.h"
#include "base/Path.h" #include "base/Path.h"
#include "base/TMethodEventJob.h" #include "base/TMethodEventJob.h"
#include "common/constants.h"
#include "deskflow/App.h" #include "deskflow/App.h"
#include "deskflow/ArgParser.h" #include "deskflow/ArgParser.h"
#include "deskflow/Screen.h" #include "deskflow/Screen.h"
@ -123,8 +124,8 @@ void ServerApp::parseArgs(int argc, const char *const *argv)
void ServerApp::help() void ServerApp::help()
{ {
const auto userConfig = ARCH->concatPath(ARCH->getUserDirectory(), USER_CONFIG_NAME); const auto userConfig = ARCH->concatPath(ARCH->getUserDirectory(), CONFIG_NAME);
const auto sysConfig = ARCH->concatPath(ARCH->getSystemDirectory(), SYSTEM_CONFIG_NAME); const auto sysConfig = ARCH->concatPath(ARCH->getSystemDirectory(), CONFIG_NAME);
std::stringstream help; std::stringstream help;
help << "Usage: " << args().m_pname help << "Usage: " << args().m_pname
@ -141,7 +142,7 @@ void ServerApp::help()
#endif #endif
<< HELP_SYS_ARGS HELP_COMMON_ARGS "\n\n" << HELP_SYS_ARGS HELP_COMMON_ARGS "\n\n"
<< "Start the " DESKFLOW_APP_NAME " mouse/keyboard sharing server.\n" << "Start the " << kAppName << " mouse/keyboard sharing server.\n"
<< "\n" << "\n"
<< " -a, --address <address> listen for clients on the given address.\n" << " -a, --address <address> listen for clients on the given address.\n"
<< " -c, --config <pathname> use the named configuration file " << " -c, --config <pathname> use the named configuration file "
@ -208,7 +209,7 @@ void ServerApp::loadConfig()
path = ARCH->getUserDirectory(); path = ARCH->getUserDirectory();
if (!path.empty()) { if (!path.empty()) {
// complete path // complete path
path = ARCH->concatPath(path, USER_CONFIG_NAME); path = ARCH->concatPath(path, CONFIG_NAME);
// now try loading the user's configuration // now try loading the user's configuration
if (loadConfig(path)) { if (loadConfig(path)) {
@ -220,7 +221,7 @@ void ServerApp::loadConfig()
// try the system-wide config file // try the system-wide config file
path = ARCH->getSystemDirectory(); path = ARCH->getSystemDirectory();
if (!path.empty()) { if (!path.empty()) {
path = ARCH->concatPath(path, SYSTEM_CONFIG_NAME); path = ARCH->concatPath(path, CONFIG_NAME);
if (loadConfig(path)) { if (loadConfig(path)) {
loaded = true; loaded = true;
args().m_configFile = path; args().m_configFile = path;
@ -844,7 +845,7 @@ int ServerApp::foregroundStartup(int argc, char **argv)
const char *ServerApp::daemonName() const const char *ServerApp::daemonName() const
{ {
#if SYSAPI_WIN32 #if SYSAPI_WIN32
return DESKFLOW_APP_NAME " Server"; return "Deskflow Server";
#elif SYSAPI_UNIX #elif SYSAPI_UNIX
return SERVER_BINARY_NAME; return SERVER_BINARY_NAME;
#endif #endif

View file

@ -145,13 +145,9 @@ private:
ClientListener *m_listener; ClientListener *m_listener;
EventQueueTimer *m_timer; EventQueueTimer *m_timer;
NetworkAddress *m_deskflowAddress; NetworkAddress *m_deskflowAddress;
};
// configuration file name
#if SYSAPI_WIN32 #if SYSAPI_WIN32
#define USER_CONFIG_NAME "deskflow.sgc" inline static const std::string CONFIG_NAME = "%s.sgc", kAppName;
#define SYSTEM_CONFIG_NAME "deskflow.sgc"
#elif SYSAPI_UNIX #elif SYSAPI_UNIX
#define USER_CONFIG_NAME ".deskflow.conf" inline static const std::string CONFIG_NAME = "%s.conf", kAppName;
#define SYSTEM_CONFIG_NAME "deskflow.conf"
#endif #endif
};

View file

@ -31,6 +31,7 @@
#endif #endif
#include "base/Log.h" #include "base/Log.h"
#include "base/log_outputters.h" #include "base/log_outputters.h"
#include "common/constants.h"
#if HAVE_LIBNOTIFY #if HAVE_LIBNOTIFY
#include <libnotify/notify.h> #include <libnotify/notify.h>
@ -168,7 +169,7 @@ void AppUtilUnix::showNotification(const String &title, const String &text) cons
{ {
#if HAVE_LIBNOTIFY #if HAVE_LIBNOTIFY
LOG((CLOG_INFO "showing notification, title=\"%s\", text=\"%s\"", title.c_str(), text.c_str())); LOG((CLOG_INFO "showing notification, title=\"%s\", text=\"%s\"", title.c_str(), text.c_str()));
if (!notify_init(DESKFLOW_APP_NAME)) { if (!notify_init(kAppName)) {
LOG((CLOG_INFO "failed to initialize libnotify")); LOG((CLOG_INFO "failed to initialize libnotify"));
return; return;
} }

View file

@ -252,9 +252,15 @@ void AppUtilWindows::showNotification(const String &title, const String &text) c
return; return;
} }
if (!WinToastLib::WinToast::instance()->isInitialized()) { if (!WinToastLib::WinToast::instance()->isInitialized()) {
WinToastLib::WinToast::instance()->setAppName(L"" DESKFLOW_APP_NAME); WinToastLib::WinToast::instance()->setAppName(L""
"Deskflow");
const auto aumi = WinToastLib::WinToast::configureAUMI( const auto aumi = WinToastLib::WinToast::configureAUMI(
L"" DESKFLOW_AUTHOR_NAME, L"" DESKFLOW_APP_NAME, L"" DESKFLOW_APP_NAME, L"1.14.1+" L"" DESKFLOW_AUTHOR_NAME,
L""
"Deskflow",
L""
"Deskflow",
L"1.14.1+"
); );
WinToastLib::WinToast::instance()->setAppUserModelId(aumi); WinToastLib::WinToast::instance()->setAppUserModelId(aumi);

View file

@ -54,7 +54,7 @@ bool
isOSXDevelopmentBuild() isOSXDevelopmentBuild()
{ {
std::string bundleURL = [[[NSBundle mainBundle] bundleURL].absoluteString UTF8String]; std::string bundleURL = [[[NSBundle mainBundle] bundleURL].absoluteString UTF8String];
return (bundleURL.find("Applications/" DESKFLOW_APP_NAME ".app") == std::string::npos); return (bundleURL.find("Applications/Deskflow.app") == std::string::npos);
} }
bool bool

View file

@ -44,8 +44,8 @@ void VersionChecker::checkLatest() const
auto request = QNetworkRequest(url); auto request = QNetworkRequest(url);
auto userAgent = QString("%1 %2 on %3").arg(kAppName, kVersion, QSysInfo::prettyProductName()); auto userAgent = QString("%1 %2 on %3").arg(kAppName, kVersion, QSysInfo::prettyProductName());
request.setHeader(QNetworkRequest::UserAgentHeader, userAgent); request.setHeader(QNetworkRequest::UserAgentHeader, userAgent);
request.setRawHeader("X-" DESKFLOW_APP_NAME "-Version", kVersion); request.setRawHeader("X-Deskflow-Version", kVersion);
request.setRawHeader("X-" DESKFLOW_APP_NAME "-Language", QLocale::system().name().toStdString().c_str()); request.setRawHeader("X-Deskflow-Language", QLocale::system().name().toStdString().c_str());
m_network->get(request); m_network->get(request);
} }

View file

@ -19,6 +19,8 @@
#include "TlsFingerprint.h" #include "TlsFingerprint.h"
#include "common/constants.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
#include <QProcess> #include <QProcess>
@ -26,7 +28,6 @@
static const char *const kCertificateKeyLength = "rsa:"; static const char *const kCertificateKeyLength = "rsa:";
static const char *const kCertificateHashAlgorithm = "-sha256"; static const char *const kCertificateHashAlgorithm = "-sha256";
static const char *const kCertificateLifetime = "365"; static const char *const kCertificateLifetime = "365";
static const char *const kCertificateSubjectInfo = "/CN=" DESKFLOW_APP_NAME;
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
static const char *const kWinOpenSslDir = "OpenSSL"; static const char *const kWinOpenSslDir = "OpenSSL";
@ -167,8 +168,8 @@ bool TlsCertificate::generateCertificate(const QString &path, int keyLength)
// subject information // subject information
arguments.append("-subj"); arguments.append("-subj");
QString subInfo(kCertificateSubjectInfo); QString subInfo("/CN=%1");
arguments.append(subInfo); arguments.append(subInfo.arg(kAppName));
// private key // private key
arguments.append("-newkey"); arguments.append("-newkey");

View file

@ -202,7 +202,7 @@ bool MSWindowsClipboard::isOwnedByDeskflow()
{ {
// create ownership format if we haven't yet // create ownership format if we haven't yet
if (s_ownershipFormat == 0) { if (s_ownershipFormat == 0) {
s_ownershipFormat = RegisterClipboardFormat(TEXT(DESKFLOW_APP_NAME "Ownership")); s_ownershipFormat = RegisterClipboardFormat(TEXT("Deskflow Ownership"));
} }
return (IsClipboardFormatAvailable(getOwnershipFormat()) != 0); return (IsClipboardFormatAvailable(getOwnershipFormat()) != 0);
} }
@ -211,7 +211,7 @@ UINT MSWindowsClipboard::getOwnershipFormat()
{ {
// create ownership format if we haven't yet // create ownership format if we haven't yet
if (s_ownershipFormat == 0) { if (s_ownershipFormat == 0) {
s_ownershipFormat = RegisterClipboardFormat(TEXT(DESKFLOW_APP_NAME "Ownership")); s_ownershipFormat = RegisterClipboardFormat(TEXT("Deskflow Ownership"));
} }
// return the format // return the format

View file

@ -376,7 +376,7 @@ ATOM MSWindowsDesks::createDeskWindowClass(bool isPrimary) const
classInfo.hCursor = m_cursor; classInfo.hCursor = m_cursor;
classInfo.hbrBackground = NULL; classInfo.hbrBackground = NULL;
classInfo.lpszMenuName = NULL; classInfo.lpszMenuName = NULL;
classInfo.lpszClassName = DESKFLOW_APP_NAME "Desk"; classInfo.lpszClassName = "DeskflowDesk";
classInfo.hIconSm = NULL; classInfo.hIconSm = NULL;
return RegisterClassEx(&classInfo); return RegisterClassEx(&classInfo);
} }
@ -592,7 +592,7 @@ void MSWindowsDesks::deskThread(void *vdesk)
// create a window. we use this window to hide the cursor. // create a window. we use this window to hide the cursor.
try { try {
desk->m_window = createWindow(m_deskClass, DESKFLOW_APP_NAME "Desk"); desk->m_window = createWindow(m_deskClass, "DeskflowDesk");
LOG((CLOG_DEBUG "desk %s window is 0x%08x", desk->m_name.c_str(), desk->m_window)); LOG((CLOG_DEBUG "desk %s window is 0x%08x", desk->m_name.c_str(), desk->m_window));
} catch (...) { } catch (...) {
// ignore // ignore

View file

@ -149,7 +149,7 @@ MSWindowsScreen::MSWindowsScreen(
updateScreenShape(); updateScreenShape();
m_class = createWindowClass(); m_class = createWindowClass();
m_window = createWindow(m_class, DESKFLOW_APP_NAME); m_window = createWindow(m_class, kAppName);
forceShowCursor(); forceShowCursor();
LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_multimon ? "(multi-monitor)" : "")); LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_multimon ? "(multi-monitor)" : ""));
LOG((CLOG_DEBUG "window is 0x%08x", m_window)); LOG((CLOG_DEBUG "window is 0x%08x", m_window));
@ -851,7 +851,7 @@ ATOM MSWindowsScreen::createWindowClass() const
classInfo.hCursor = NULL; classInfo.hCursor = NULL;
classInfo.hbrBackground = NULL; classInfo.hbrBackground = NULL;
classInfo.lpszMenuName = NULL; classInfo.lpszMenuName = NULL;
classInfo.lpszClassName = DESKFLOW_APP_NAME; classInfo.lpszClassName = kAppName;
classInfo.hIconSm = NULL; classInfo.hIconSm = NULL;
return RegisterClassEx(&classInfo); return RegisterClassEx(&classInfo);
} }

View file

@ -31,7 +31,7 @@ OSXPowerManager::~OSXPowerManager()
void OSXPowerManager::disableSleep() void OSXPowerManager::disableSleep()
{ {
if (!m_sleepPreventionAssertionID) { if (!m_sleepPreventionAssertionID) {
CFStringRef reasonForActivity = CFSTR(DESKFLOW_APP_NAME " application"); CFStringRef reasonForActivity = CFSTR("Deskflow application");
IOReturn result = IOPMAssertionCreateWithName( IOReturn result = IOPMAssertionCreateWithName(
kIOPMAssertPreventUserIdleDisplaySleep, kIOPMAssertionLevelOn, reasonForActivity, &m_sleepPreventionAssertionID kIOPMAssertPreventUserIdleDisplaySleep, kIOPMAssertionLevelOn, reasonForActivity, &m_sleepPreventionAssertionID
); );