UI: Options: Move "Sound Alert" flag to Programs

This commit is contained in:
Nodir Temirkhodjaev 2024-10-08 17:04:36 +05:00
parent 408f1003e3
commit efcecfdcfb
4 changed files with 16 additions and 18 deletions

View File

@ -60,11 +60,11 @@ void IfacePage::onResetToDefault()
m_cbAppAlertAutoShow->setChecked(true);
m_cbAppAlertAlwaysOnTop->setChecked(true);
m_cbAppAlertAutoActive->setChecked(false);
m_cbAppAlertSound->setChecked(false);
m_cbTrayShowIcon->setChecked(true);
m_cbTrayShowAlert->setChecked(true);
m_cbTrayAnimateAlert->setChecked(true);
m_cbTraySoundAlert->setChecked(false);
m_spinTrayMaxGroups->setValue(trayMaxGroups);
@ -137,11 +137,11 @@ void IfacePage::onRetranslateUi()
m_cbAppAlertAutoShow->setText(tr("Auto-Show Alert Window for New Programs"));
m_cbAppAlertAlwaysOnTop->setText(tr("Alert Window is Always on top"));
m_cbAppAlertAutoActive->setText(tr("Alert Window is auto-active"));
m_cbAppAlertSound->setText(tr("Sound Alert"));
m_cbTrayShowIcon->setText(tr("Show Icon"));
m_cbTrayShowAlert->setText(tr("Show Alert Icon"));
m_cbTrayAnimateAlert->setText(tr("Animate Alert Icon"));
m_cbTraySoundAlert->setText(tr("Sound Alert"));
m_labelTrayMaxGroups->setText(tr("Maximum count of Groups in menu:"));
m_labelTrayEvent->setText(tr("Event:"));
m_labelTrayAction->setText(tr("Action:"));
@ -490,9 +490,14 @@ void IfacePage::setupProgBox()
ctrl()->setIniUserEdited();
});
m_cbAppAlertSound = ControlUtil::createCheckBox(iniUser()->progAlertSound(), [&](bool checked) {
iniUser()->setProgAlertSound(checked);
ctrl()->setIniUserEdited();
});
// Layout
auto layout = ControlUtil::createVLayoutByWidgets({ m_cbAppNotifyMessage, m_cbAppAlertAutoShow,
m_cbAppAlertAlwaysOnTop, m_cbAppAlertAutoActive });
m_cbAppAlertAlwaysOnTop, m_cbAppAlertAutoActive, m_cbAppAlertSound });
m_gbProg = new QGroupBox();
m_gbProg->setLayout(layout);
@ -516,12 +521,6 @@ void IfacePage::setupTrayBox()
ctrl()->setIniUserEdited();
});
m_cbTraySoundAlert =
ControlUtil::createCheckBox(iniUser()->traySoundAlert(), [&](bool checked) {
iniUser()->setTraySoundAlert(checked);
ctrl()->setIniUserEdited();
});
// Tray Max. Groups Row
auto maxGroupsLayout = setupTrayMaxGroupsLayout();
@ -533,7 +532,6 @@ void IfacePage::setupTrayBox()
layout->addWidget(m_cbTrayShowIcon);
layout->addWidget(m_cbTrayShowAlert);
layout->addWidget(m_cbTrayAnimateAlert);
layout->addWidget(m_cbTraySoundAlert);
layout->addLayout(maxGroupsLayout);
layout->addWidget(ControlUtil::createSeparator());
layout->addLayout(eventLayout);

View File

@ -93,11 +93,11 @@ private:
QCheckBox *m_cbAppAlertAutoShow = nullptr;
QCheckBox *m_cbAppAlertAlwaysOnTop = nullptr;
QCheckBox *m_cbAppAlertAutoActive = nullptr;
QCheckBox *m_cbAppAlertSound = nullptr;
QCheckBox *m_cbTrayShowIcon = nullptr;
QCheckBox *m_cbTrayShowAlert = nullptr;
QCheckBox *m_cbTrayAnimateAlert = nullptr;
QCheckBox *m_cbTraySoundAlert = nullptr;
QLabel *m_labelTrayMaxGroups = nullptr;
QSpinBox *m_spinTrayMaxGroups = nullptr;

View File

@ -260,10 +260,6 @@ void TrayIcon::updateTrayIcon(bool alerted)
return;
if (alerted) {
if (iniUser()->traySoundAlert()) {
OsUtil::playSound();
}
if (!iniUser()->trayShowAlert())
return;
}
@ -627,6 +623,10 @@ void TrayIcon::sendAlertMessage()
tr("New program detected!"), WindowManager::TrayMessageAlert);
}
if (iniUser()->progAlertSound()) {
OsUtil::playSound();
}
if (iniUser()->progAlertWindowAutoShow()) {
windowManager()->showProgramAlertWindow(/*activate=*/false);
}

View File

@ -75,6 +75,9 @@ public:
bool progNotifyMessage() const { return valueBool("prog/notifyMessage", true); }
void setProgNotifyMessage(bool v) { setValue("prog/notifyMessage", v, true); }
bool progAlertSound() const { return valueBool("prog/soundAlert"); }
void setProgAlertSound(bool v) { setValue("prog/soundAlert", v); }
bool trayShowIcon() const { return valueBool("tray/showIcon", true); }
void setTrayShowIcon(bool v) { setValue("tray/showIcon", v, true); }
@ -84,9 +87,6 @@ public:
bool trayAnimateAlert() const { return valueBool("tray/animateAlert", true); }
void setTrayAnimateAlert(bool v) { setValue("tray/animateAlert", v, true); }
bool traySoundAlert() const { return valueBool("tray/soundAlert"); }
void setTraySoundAlert(bool v) { setValue("tray/soundAlert", v); }
int trayMaxGroups(int v = 0) const { return valueInt("tray/maxGroups", v); }
void setTrayMaxGroups(int v) { setValue("tray/maxGroups", v); }