From bf3fd82630baee451674cc6456a2c66166ad0292 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Fri, 17 Oct 2025 17:50:46 -0400 Subject: [PATCH] chore: use kAppName and kAppId more to avoid unneed translations of Deskflow / deskflow --- src/apps/deskflow-gui/deskflow-gui.cpp | 7 ++++--- src/lib/gui/MainWindow.cpp | 8 ++++---- src/lib/gui/dialogs/AboutDialog.cpp | 6 +++--- src/lib/gui/dialogs/SettingsDialog.cpp | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/apps/deskflow-gui/deskflow-gui.cpp b/src/apps/deskflow-gui/deskflow-gui.cpp index d9751687e..3e2bf1d55 100644 --- a/src/apps/deskflow-gui/deskflow-gui.cpp +++ b/src/apps/deskflow-gui/deskflow-gui.cpp @@ -91,9 +91,10 @@ int main(int argc, char *argv[]) return s_exitSuccess; } + const auto shmId = QStringLiteral("%1-gui").arg(kAppId); // Create a shared memory segment with a unique key // This is to prevent a new instance from running if one is already running - QSharedMemory sharedMemory("deskflow-gui"); + QSharedMemory sharedMemory(shmId); // Attempt to attach first and detach in order to clean up stale shm chunks // This can happen if the previous instance was killed or crashed @@ -104,11 +105,11 @@ int main(int argc, char *argv[]) if (!sharedMemory.create(1)) { // Ping the running instance to have it show itself QLocalSocket socket; - socket.connectToServer("deskflow-gui", QLocalSocket::ReadOnly); + socket.connectToServer(shmId, QLocalSocket::ReadOnly); if (!socket.waitForConnected()) { // If we can't connect to the other instance tell the user its running. // This should never happen but just incase we should show something - QMessageBox::information(nullptr, QObject::tr("Deskflow"), QObject::tr("Deskflow is already running")); + QMessageBox::information(nullptr, kAppName, QObject::tr("%1 is already running").arg(kAppName)); } socket.disconnectFromServer(); return s_exitDuplicate; diff --git a/src/lib/gui/MainWindow.cpp b/src/lib/gui/MainWindow.cpp index 4f0411e52..92bf2717f 100644 --- a/src/lib/gui/MainWindow.cpp +++ b/src/lib/gui/MainWindow.cpp @@ -81,7 +81,7 @@ MainWindow::MainWindow() m_actionMinimize{new QAction(tr("&Minimize to tray"), this)}, m_actionQuit{new QAction(tr("&Quit"), this)}, m_actionTrayQuit{new QAction(tr("&Quit"), this)}, - m_actionRestore{new QAction(tr("&Open Deskflow"), this)}, + m_actionRestore{new QAction(tr("&Open %1").arg(kAppName), this)}, m_actionSettings{new QAction(tr("&Preferences"), this)}, m_actionStartCore{new QAction(tr("&Start"), this)}, m_actionRestartCore{new QAction(tr("Rest&art"), this)}, @@ -89,7 +89,7 @@ MainWindow::MainWindow() { ui->setupUi(this); - setWindowIcon(QIcon::fromTheme(QStringLiteral("deskflow"))); + setWindowIcon(QIcon::fromTheme(kAppId)); addDockWidget(Qt::BottomDockWidgetArea, m_logDock); @@ -775,11 +775,11 @@ void MainWindow::setTrayIcon() m_trayIcon->setIcon(QIcon(iconString)); #else if (symbolicIcon) { - auto icon = QIcon::fromTheme(QStringLiteral("deskflow-symbolic")); + auto icon = QIcon::fromTheme(QStringLiteral("%1-symbolic").arg(kAppId)); icon.setIsMask(true); m_trayIcon->setIcon(icon); } else { - m_trayIcon->setIcon(QIcon::fromTheme(QStringLiteral("deskflow"))); + m_trayIcon->setIcon(QIcon::fromTheme(kAppId)); } #endif } diff --git a/src/lib/gui/dialogs/AboutDialog.cpp b/src/lib/gui/dialogs/AboutDialog.cpp index 4109866ec..9f531c7c7 100644 --- a/src/lib/gui/dialogs/AboutDialog.cpp +++ b/src/lib/gui/dialogs/AboutDialog.cpp @@ -27,7 +27,7 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui{std::make_unique const QSize pixmapSize(px, px); ui->lblIcon->setFixedSize(pixmapSize); - ui->lblIcon->setPixmap(QPixmap(QIcon::fromTheme("deskflow").pixmap(QSize().scaled(pixmapSize, Qt::KeepAspectRatio)))); + ui->lblIcon->setPixmap(QPixmap(QIcon::fromTheme(kAppId).pixmap(QSize().scaled(pixmapSize, Qt::KeepAspectRatio)))); ui->btnCopyVersion->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::EditCopy)); connect(ui->btnCopyVersion, &QPushButton::clicked, this, &AboutDialog::copyVersionText); @@ -52,8 +52,8 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui{std::make_unique void AboutDialog::copyVersionText() const { - QString infoString = QStringLiteral("Deskflow: %1 (%2)\nQt: %3\nSystem: %4") - .arg(kVersion, kVersionGitSha, qVersion(), QSysInfo::prettyProductName()); + QString infoString = QStringLiteral("%1: %2 (%3)\nQt: %4\nSystem: %5") + .arg(kAppName, kVersion, kVersionGitSha, qVersion(), QSysInfo::prettyProductName()); #ifdef Q_OS_LINUX infoString.append(QStringLiteral("\nSession: %1 (%2)") .arg(qEnvironmentVariable("XDG_CURRENT_DESKTOP"), qEnvironmentVariable("XDG_SESSION_TYPE"))); diff --git a/src/lib/gui/dialogs/SettingsDialog.cpp b/src/lib/gui/dialogs/SettingsDialog.cpp index e05370dc5..2a6af6ba5 100644 --- a/src/lib/gui/dialogs/SettingsDialog.cpp +++ b/src/lib/gui/dialogs/SettingsDialog.cpp @@ -45,8 +45,8 @@ SettingsDialog::SettingsDialog(QWidget *parent, const IServerConfig &serverConfi ui->comboTlsKeyLength->setItemIcon(1, QIcon::fromTheme(QIcon::ThemeIcon::SecurityHigh)); ui->lblTlsCertInfo->setFixedSize(28, 28); - ui->rbIconMono->setIcon(QIcon::fromTheme(QStringLiteral("deskflow-symbolic"))); - ui->rbIconColorful->setIcon(QIcon::fromTheme(QStringLiteral("deskflow"))); + ui->rbIconMono->setIcon(QIcon::fromTheme(QStringLiteral("%1-symbolic").arg(kAppId))); + ui->rbIconColorful->setIcon(QIcon::fromTheme(kAppId)); // force the first tab, since qt creator sets the active tab as the last one // the developer was looking at, and it's easy to accidentally save that.