UI: TrayIcon: Send alert message for each event

This commit is contained in:
Nodir Temirkhodjaev 2024-01-31 16:29:37 +03:00
parent 08e826075b
commit f990ecfc22

View File

@ -176,8 +176,10 @@ TrayIcon::TrayIcon(QObject *parent) : QSystemTrayIcon(parent), m_ctrl(new TrayCo
connect(confManager(), &ConfManager::confChanged, this, &TrayIcon::updateTrayMenu); connect(confManager(), &ConfManager::confChanged, this, &TrayIcon::updateTrayMenu);
connect(confManager(), &ConfManager::iniUserChanged, this, &TrayIcon::setupByIniUser); connect(confManager(), &ConfManager::iniUserChanged, this, &TrayIcon::setupByIniUser);
connect(confAppManager(), &ConfAppManager::appAlerted, this, connect(confAppManager(), &ConfAppManager::appAlerted, this, [&] {
[&] { updateTrayIcon(/*alerted=*/true); }); updateTrayIcon(/*alerted=*/true);
sendAlertMessage();
});
connect(driverManager(), &DriverManager::isDeviceOpenedChanged, this, connect(driverManager(), &DriverManager::isDeviceOpenedChanged, this,
&TrayIcon::updateTrayIconShape); &TrayIcon::updateTrayIconShape);
@ -259,9 +261,7 @@ void TrayIcon::updateTrayIcon(bool alerted)
m_alerted = alerted; m_alerted = alerted;
m_animatedAlert = false; m_animatedAlert = false;
sendAlertMessage();
updateAlertTimer(); updateAlertTimer();
updateTrayIconShape(); updateTrayIconShape();
} }
@ -548,7 +548,7 @@ void TrayIcon::updateAppGroupActions()
void TrayIcon::sendAlertMessage() void TrayIcon::sendAlertMessage()
{ {
if (!(m_alerted && iniUser()->progNotifyMessage())) if (!iniUser()->progNotifyMessage())
return; return;
windowManager()->showTrayMessage(tr("New program detected!"), WindowManager::TrayMessageAlert); windowManager()->showTrayMessage(tr("New program detected!"), WindowManager::TrayMessageAlert);