UI: Options: Tray: Add "Show Alert Icon" flag

This commit is contained in:
Nodir Temirkhodjaev 2024-08-16 15:41:38 +05:00
parent d6b4905195
commit 2644e4e4df
4 changed files with 15 additions and 0 deletions

View File

@ -54,6 +54,7 @@ void IfacePage::onResetToDefault()
m_cbHomeAutoShowMenu->setChecked(false);
m_cbSplashVisible->setChecked(true);
m_cbTrayShowIcon->setChecked(true);
m_cbTrayShowAlert->setChecked(true);
m_cbTrayAnimateAlert->setChecked(true);
m_spinTrayMaxGroups->setValue(trayMaxGroups);
@ -123,6 +124,7 @@ void IfacePage::onRetranslateUi()
m_cbSplashVisible->setText(tr("Show Splash screen on startup"));
m_cbTrayShowIcon->setText(tr("Show Icon"));
m_cbTrayShowAlert->setText(tr("Show Alert Icon"));
m_cbTrayAnimateAlert->setText(tr("Animate Alert Icon"));
m_labelTrayMaxGroups->setText(tr("Maximum count of Groups in menu:"));
m_labelTrayEvent->setText(tr("Event:"));
@ -452,6 +454,11 @@ void IfacePage::setupTrayBox()
ctrl()->setIniUserEdited(true);
});
m_cbTrayShowAlert = ControlUtil::createCheckBox(iniUser()->trayShowAlert(), [&](bool checked) {
iniUser()->setTrayShowAlert(checked);
ctrl()->setIniUserEdited();
});
m_cbTrayAnimateAlert =
ControlUtil::createCheckBox(iniUser()->trayAnimateAlert(), [&](bool checked) {
iniUser()->setTrayAnimateAlert(checked);
@ -467,6 +474,7 @@ void IfacePage::setupTrayBox()
auto layout = new QVBoxLayout();
layout->addWidget(m_cbTrayShowIcon);
layout->addWidget(m_cbTrayShowAlert);
layout->addWidget(m_cbTrayAnimateAlert);
layout->addLayout(maxGroupsLayout);
layout->addWidget(ControlUtil::createSeparator());

View File

@ -84,6 +84,7 @@ private:
QCheckBox *m_cbHomeAutoShowMenu = nullptr;
QCheckBox *m_cbSplashVisible = nullptr;
QCheckBox *m_cbTrayShowIcon = nullptr;
QCheckBox *m_cbTrayShowAlert = nullptr;
QCheckBox *m_cbTrayAnimateAlert = nullptr;
QLabel *m_labelTrayMaxGroups = nullptr;
QSpinBox *m_spinTrayMaxGroups = nullptr;

View File

@ -258,6 +258,9 @@ void TrayIcon::updateTrayIcon(bool alerted)
if (m_alerted == alerted)
return;
if (alerted && !iniUser()->trayShowAlert())
return;
m_alerted = alerted;
m_animatedAlert = false;

View File

@ -78,6 +78,9 @@ public:
bool trayShowIcon() const { return valueBool("tray/showIcon", true); }
void setTrayShowIcon(bool v) { setValue("tray/showIcon", v, true); }
bool trayShowAlert() const { return valueBool("tray/showAlert", true); }
void setTrayShowAlert(bool v) { setValue("tray/showAlert", v, true); }
bool trayAnimateAlert() const { return valueBool("tray/animateAlert", true); }
void setTrayAnimateAlert(bool v) { setValue("tray/animateAlert", v, true); }