mirror of
https://github.com/tnodir/fort
synced 2024-11-15 06:55:54 +00:00
UI: Fix tray icon animation switching
This commit is contained in:
parent
f7ab740a50
commit
1b6283e3be
@ -541,19 +541,13 @@ void TrayIcon::sendAlertMessage()
|
||||
|
||||
void TrayIcon::updateAlertTimer()
|
||||
{
|
||||
if (!iniUser()->trayAnimateAlert())
|
||||
if (!iniUser()->trayAnimateAlert()) {
|
||||
removeAlertTimer();
|
||||
return;
|
||||
|
||||
if (!m_alertTimer) {
|
||||
m_alertTimer = new QTimer(this);
|
||||
m_alertTimer->setInterval(1000);
|
||||
|
||||
connect(m_alertTimer, &QTimer::timeout, this, [&] {
|
||||
m_animatedAlert = !m_animatedAlert;
|
||||
updateTrayIconShape();
|
||||
});
|
||||
}
|
||||
|
||||
setupAlertTimer();
|
||||
|
||||
m_animatedAlert = m_alerted;
|
||||
|
||||
if (m_alerted) {
|
||||
@ -563,6 +557,29 @@ void TrayIcon::updateAlertTimer()
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::setupAlertTimer()
|
||||
{
|
||||
if (m_alertTimer)
|
||||
return;
|
||||
|
||||
m_alertTimer = new QTimer(this);
|
||||
m_alertTimer->setInterval(1000);
|
||||
|
||||
connect(m_alertTimer, &QTimer::timeout, this, [&] {
|
||||
m_animatedAlert = !m_animatedAlert;
|
||||
updateTrayIconShape();
|
||||
});
|
||||
}
|
||||
|
||||
void TrayIcon::removeAlertTimer()
|
||||
{
|
||||
if (!m_alertTimer)
|
||||
return;
|
||||
|
||||
delete m_alertTimer;
|
||||
m_alertTimer = nullptr;
|
||||
}
|
||||
|
||||
void TrayIcon::updateTrayIconShape()
|
||||
{
|
||||
QString mainIconPath;
|
||||
|
@ -105,6 +105,10 @@ private:
|
||||
|
||||
void sendAlertMessage();
|
||||
void updateAlertTimer();
|
||||
|
||||
void setupAlertTimer();
|
||||
void removeAlertTimer();
|
||||
|
||||
void updateTrayIconShape();
|
||||
|
||||
void addHotKey(QAction *action, const QString &shortcutText);
|
||||
|
Loading…
Reference in New Issue
Block a user