From e91f63ce66f4f3304a441061b5e69e35e12b6505 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Fri, 29 Dec 2023 13:40:31 +0300 Subject: [PATCH] UI: WindowManager: Minor refactor --- src/ui/form/tray/trayicon.cpp | 2 +- src/ui/fortmanager.cpp | 6 +++--- src/ui/manager/windowmanager.cpp | 10 +++++----- src/ui/manager/windowmanager.h | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ui/form/tray/trayicon.cpp b/src/ui/form/tray/trayicon.cpp index fd7e1d79..9a4fb89e 100644 --- a/src/ui/form/tray/trayicon.cpp +++ b/src/ui/form/tray/trayicon.cpp @@ -535,7 +535,7 @@ void TrayIcon::sendAlertMessage() if (!(m_alerted && iniUser()->progNotifyMessage())) return; - windowManager()->showTrayMessage(tr("New program detected!"), WindowManager::MessageAlert); + windowManager()->showTrayMessage(tr("New program detected!"), WindowManager::TrayMessageAlert); } void TrayIcon::updateAlertTimer() diff --git a/src/ui/fortmanager.cpp b/src/ui/fortmanager.cpp index 5c0e6fe7..59300e67 100644 --- a/src/ui/fortmanager.cpp +++ b/src/ui/fortmanager.cpp @@ -360,14 +360,14 @@ void FortManager::setupTaskManager() auto taskManager = IoC(); connect(taskManager, &TaskManager::appVersionDownloaded, this, [&](const QString &version) { - IoC()->showTrayMessage( - tr("New version v%1 available!").arg(version), WindowManager::MessageNewVersion); + IoC()->showTrayMessage(tr("New version v%1 available!").arg(version), + WindowManager::TrayMessageNewVersion); }); connect(taskManager, &TaskManager::zonesDownloaded, this, [&](const QStringList &zoneNames) { IoC()->showTrayMessage( tr("Zone Addresses Updated: %1.").arg(zoneNames.join(", ")), - WindowManager::MessageZones); + WindowManager::TrayMessageZones); }); connect(taskManager, &TaskManager::zonesUpdated, IoC(), diff --git a/src/ui/manager/windowmanager.cpp b/src/ui/manager/windowmanager.cpp index 9b69c8b6..e8526da0 100644 --- a/src/ui/manager/windowmanager.cpp +++ b/src/ui/manager/windowmanager.cpp @@ -268,7 +268,7 @@ void WindowManager::showTrayMessage(const QString &message, WindowManager::TrayM if (!m_trayIcon) return; - m_lastMessageType = type; + m_lastTrayMessageType = type; m_trayIcon->showMessage(QGuiApplication::applicationDisplayName(), message); } @@ -646,14 +646,14 @@ bool WindowManager::showPasswordDialog(QString &password, int *unlockType) void WindowManager::onTrayMessageClicked() { - switch (m_lastMessageType) { - case MessageNewVersion: { + switch (m_lastTrayMessageType) { + case TrayMessageNewVersion: { showHomeWindowAbout(); } break; - case MessageZones: { + case TrayMessageZones: { showZonesWindow(); } break; - case MessageAlert: { + case TrayMessageAlert: { showProgramsWindow(); } break; default: diff --git a/src/ui/manager/windowmanager.h b/src/ui/manager/windowmanager.h index b923ac68..520e79ee 100644 --- a/src/ui/manager/windowmanager.h +++ b/src/ui/manager/windowmanager.h @@ -26,10 +26,10 @@ class WindowManager : public QObject, public IocService public: enum TrayMessageType : qint8 { - MessageOptions, - MessageNewVersion, - MessageZones, - MessageAlert, + TrayMessageOptions, + TrayMessageNewVersion, + TrayMessageZones, + TrayMessageAlert, }; Q_ENUM(TrayMessageType) @@ -65,7 +65,7 @@ public slots: void showTrayIcon(); void closeTrayIcon(); void showTrayMessage( - const QString &message, WindowManager::TrayMessageType type = MessageOptions); + const QString &message, WindowManager::TrayMessageType type = TrayMessageOptions); void showHomeWindow(); void closeHomeWindow(); @@ -154,7 +154,7 @@ private: quint32 m_openedWindows = 0; - TrayMessageType m_lastMessageType = MessageOptions; + TrayMessageType m_lastTrayMessageType = TrayMessageOptions; TrayIcon *m_trayIcon = nullptr;