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;
}
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;

View File

@ -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
}

View File

@ -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")));

View File

@ -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.