UI: Tray: Update Filter Mode's icon

This commit is contained in:
Nodir Temirkhodjaev 2022-05-29 20:15:19 +03:00
parent 03d9e02ef7
commit d456701994
2 changed files with 19 additions and 4 deletions

View File

@ -441,7 +441,7 @@ QLayout *OptionsPage::setupFilterModeLayout()
ControlUtil::createComboBox(FirewallConf::filterModeNames(), [&](int index) { ControlUtil::createComboBox(FirewallConf::filterModeNames(), [&](int index) {
if (conf()->filterModeIndex() != index) { if (conf()->filterModeIndex() != index) {
conf()->setFilterModeIndex(index); conf()->setFilterModeIndex(index);
ctrl()->emitEdited(); ctrl()->setFlagsEdited();
} }
}); });
m_comboFilterMode->setFixedWidth(200); m_comboFilterMode->setFixedWidth(200);

View File

@ -421,7 +421,13 @@ void TrayIcon::updateTrayMenuFlags()
m_autoAllowProgsAction->setChecked(conf()->allowAllNew()); m_autoAllowProgsAction->setChecked(conf()->allowAllNew());
m_filterModeMenu->setEnabled(editEnabled); m_filterModeMenu->setEnabled(editEnabled);
m_filterModeActions->actions().at(conf()->filterModeIndex())->setChecked(true); {
QAction *action = m_filterModeActions->actions().at(conf()->filterModeIndex());
if (!action->isChecked()) {
action->setChecked(true);
m_filterModeMenu->setIcon(action->icon());
}
}
int appGroupIndex = 0; int appGroupIndex = 0;
for (QAction *action : qAsConst(m_appGroupActions)) { for (QAction *action : qAsConst(m_appGroupActions)) {
@ -462,9 +468,18 @@ void TrayIcon::saveTrayFlags()
conf()->setStopTraffic(m_stopTrafficAction->isChecked()); conf()->setStopTraffic(m_stopTrafficAction->isChecked());
conf()->setStopInetTraffic(m_stopInetTrafficAction->isChecked()); conf()->setStopInetTraffic(m_stopInetTrafficAction->isChecked());
conf()->setAllowAllNew(m_autoAllowProgsAction->isChecked()); conf()->setAllowAllNew(m_autoAllowProgsAction->isChecked());
conf()->setFilterModeIndex(
m_filterModeActions->actions().indexOf(m_filterModeActions->checkedAction()));
// Set Filter Mode
{
QAction *action = m_filterModeActions->checkedAction();
const int index = m_filterModeActions->actions().indexOf(action);
if (conf()->filterModeIndex() != index) {
conf()->setFilterModeIndex(index);
m_filterModeMenu->setIcon(action->icon());
}
}
// Set App. Groups' enabled states
int i = 0; int i = 0;
for (AppGroup *appGroup : conf()->appGroups()) { for (AppGroup *appGroup : conf()->appGroups()) {
const QAction *action = m_appGroupActions.at(i++); const QAction *action = m_appGroupActions.at(i++);