chore: use kAppName and kAppId more to avoid unneed translations of Deskflow / deskflow

This commit is contained in:
sithlord48 2025-10-17 17:50:46 -04:00 committed by Chris Rizzitello
parent bdacd6a994
commit bf3fd82630
4 changed files with 13 additions and 12 deletions

View file

@ -91,9 +91,10 @@ int main(int argc, char *argv[])
return s_exitSuccess; return s_exitSuccess;
} }
const auto shmId = QStringLiteral("%1-gui").arg(kAppId);
// Create a shared memory segment with a unique key // Create a shared memory segment with a unique key
// This is to prevent a new instance from running if one is already running // 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 // 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 // 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)) { if (!sharedMemory.create(1)) {
// Ping the running instance to have it show itself // Ping the running instance to have it show itself
QLocalSocket socket; QLocalSocket socket;
socket.connectToServer("deskflow-gui", QLocalSocket::ReadOnly); socket.connectToServer(shmId, QLocalSocket::ReadOnly);
if (!socket.waitForConnected()) { if (!socket.waitForConnected()) {
// If we can't connect to the other instance tell the user its running. // 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 // 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(); socket.disconnectFromServer();
return s_exitDuplicate; return s_exitDuplicate;

View file

@ -81,7 +81,7 @@ MainWindow::MainWindow()
m_actionMinimize{new QAction(tr("&Minimize to tray"), this)}, m_actionMinimize{new QAction(tr("&Minimize to tray"), this)},
m_actionQuit{new QAction(tr("&Quit"), this)}, m_actionQuit{new QAction(tr("&Quit"), this)},
m_actionTrayQuit{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_actionSettings{new QAction(tr("&Preferences"), this)},
m_actionStartCore{new QAction(tr("&Start"), this)}, m_actionStartCore{new QAction(tr("&Start"), this)},
m_actionRestartCore{new QAction(tr("Rest&art"), this)}, m_actionRestartCore{new QAction(tr("Rest&art"), this)},
@ -89,7 +89,7 @@ MainWindow::MainWindow()
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowIcon(QIcon::fromTheme(QStringLiteral("deskflow"))); setWindowIcon(QIcon::fromTheme(kAppId));
addDockWidget(Qt::BottomDockWidgetArea, m_logDock); addDockWidget(Qt::BottomDockWidgetArea, m_logDock);
@ -775,11 +775,11 @@ void MainWindow::setTrayIcon()
m_trayIcon->setIcon(QIcon(iconString)); m_trayIcon->setIcon(QIcon(iconString));
#else #else
if (symbolicIcon) { if (symbolicIcon) {
auto icon = QIcon::fromTheme(QStringLiteral("deskflow-symbolic")); auto icon = QIcon::fromTheme(QStringLiteral("%1-symbolic").arg(kAppId));
icon.setIsMask(true); icon.setIsMask(true);
m_trayIcon->setIcon(icon); m_trayIcon->setIcon(icon);
} else { } else {
m_trayIcon->setIcon(QIcon::fromTheme(QStringLiteral("deskflow"))); m_trayIcon->setIcon(QIcon::fromTheme(kAppId));
} }
#endif #endif
} }

View file

@ -27,7 +27,7 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui{std::make_unique
const QSize pixmapSize(px, px); const QSize pixmapSize(px, px);
ui->lblIcon->setFixedSize(pixmapSize); 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)); ui->btnCopyVersion->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::EditCopy));
connect(ui->btnCopyVersion, &QPushButton::clicked, this, &AboutDialog::copyVersionText); 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 void AboutDialog::copyVersionText() const
{ {
QString infoString = QStringLiteral("Deskflow: %1 (%2)\nQt: %3\nSystem: %4") QString infoString = QStringLiteral("%1: %2 (%3)\nQt: %4\nSystem: %5")
.arg(kVersion, kVersionGitSha, qVersion(), QSysInfo::prettyProductName()); .arg(kAppName, kVersion, kVersionGitSha, qVersion(), QSysInfo::prettyProductName());
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
infoString.append(QStringLiteral("\nSession: %1 (%2)") infoString.append(QStringLiteral("\nSession: %1 (%2)")
.arg(qEnvironmentVariable("XDG_CURRENT_DESKTOP"), qEnvironmentVariable("XDG_SESSION_TYPE"))); .arg(qEnvironmentVariable("XDG_CURRENT_DESKTOP"), qEnvironmentVariable("XDG_SESSION_TYPE")));

View file

@ -45,8 +45,8 @@ SettingsDialog::SettingsDialog(QWidget *parent, const IServerConfig &serverConfi
ui->comboTlsKeyLength->setItemIcon(1, QIcon::fromTheme(QIcon::ThemeIcon::SecurityHigh)); ui->comboTlsKeyLength->setItemIcon(1, QIcon::fromTheme(QIcon::ThemeIcon::SecurityHigh));
ui->lblTlsCertInfo->setFixedSize(28, 28); ui->lblTlsCertInfo->setFixedSize(28, 28);
ui->rbIconMono->setIcon(QIcon::fromTheme(QStringLiteral("deskflow-symbolic"))); ui->rbIconMono->setIcon(QIcon::fromTheme(QStringLiteral("%1-symbolic").arg(kAppId)));
ui->rbIconColorful->setIcon(QIcon::fromTheme(QStringLiteral("deskflow"))); ui->rbIconColorful->setIcon(QIcon::fromTheme(kAppId));
// force the first tab, since qt creator sets the active tab as the last one // 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. // the developer was looking at, and it's easy to accidentally save that.