UI: IniUser: Refactor HotKey::filterModes

This commit is contained in:
Nodir Temirkhodjaev 2024-04-04 17:43:14 +03:00
parent 30f520e89b
commit 8d2f12bf92
3 changed files with 20 additions and 8 deletions

View File

@ -479,7 +479,7 @@ void TrayIcon::setupTrayMenuFilterMode()
const QStringList iconPaths = FirewallConf::filterModeIconPaths();
for (const QString &name : FirewallConf::filterModeNames()) {
const QString iconPath = iconPaths.at(index);
const QString hotKey = HotKey::filterModeHotKeys[index];
const QString hotKey = HotKey::filterModes[index];
QAction *a = addAction(m_filterModeMenu, iconPath, /*receiver=*/nullptr, /*member=*/nullptr,
ActionNone, /*checkable=*/true);

View File

@ -1,5 +1,17 @@
#include "iniuser.h"
namespace HotKey {
const char *const filterModes[] = {
filterModeAutoLearn,
filterModeAskToConnect,
filterModeBlock,
filterModeAllow,
filterModeIgnore,
};
}
IniUser::IniUser(Settings *settings) : MapSettings(settings) { }
void IniUser::saveDefaultIni()

View File

@ -18,13 +18,13 @@ const char *const blockInetTraffic = "blockInetTraffic";
const char *const appGroupModifier = "appGroupModifier";
const char *const quit = "quit";
const char *const filterModeHotKeys[] = {
"filterModeAutoLearn",
"filterModeAskToConnect",
"filterModeBlock",
"filterModeAllow",
"filterModeIgnore",
};
const char *const filterModeAutoLearn = "filterModeAutoLearn";
const char *const filterModeAskToConnect = "filterModeAskToConnect";
const char *const filterModeBlock = "filterModeBlock";
const char *const filterModeAllow = "filterModeAllow";
const char *const filterModeIgnore = "filterModeIgnore";
extern const char *const filterModes[];
namespace Default {
const char *const filter = "Ctrl+Alt+Shift+F";