mirror of
https://github.com/tnodir/fort
synced 2024-11-15 06:15:15 +00:00
UI: WindowManager: Minor refactor
This commit is contained in:
parent
3113e355eb
commit
e91f63ce66
@ -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()
|
||||
|
@ -360,14 +360,14 @@ void FortManager::setupTaskManager()
|
||||
auto taskManager = IoC<TaskManager>();
|
||||
|
||||
connect(taskManager, &TaskManager::appVersionDownloaded, this, [&](const QString &version) {
|
||||
IoC<WindowManager>()->showTrayMessage(
|
||||
tr("New version v%1 available!").arg(version), WindowManager::MessageNewVersion);
|
||||
IoC<WindowManager>()->showTrayMessage(tr("New version v%1 available!").arg(version),
|
||||
WindowManager::TrayMessageNewVersion);
|
||||
});
|
||||
|
||||
connect(taskManager, &TaskManager::zonesDownloaded, this, [&](const QStringList &zoneNames) {
|
||||
IoC<WindowManager>()->showTrayMessage(
|
||||
tr("Zone Addresses Updated: %1.").arg(zoneNames.join(", ")),
|
||||
WindowManager::MessageZones);
|
||||
WindowManager::TrayMessageZones);
|
||||
});
|
||||
|
||||
connect(taskManager, &TaskManager::zonesUpdated, IoC<ConfZoneManager>(),
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user