mirror of
https://github.com/tnodir/fort
synced 2024-11-15 12:56:16 +00:00
UI: TrayIcon: Add checks
This commit is contained in:
parent
8b58732fa4
commit
112e6c77f1
@ -47,7 +47,7 @@ void updateComboBox(
|
|||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (const QString &name : names) {
|
for (const QString &name : names) {
|
||||||
const QString iconPath = iconPaths.at(index);
|
const QString &iconPath = iconPaths.at(index);
|
||||||
|
|
||||||
c->setItemText(index, name);
|
c->setItemText(index, name);
|
||||||
c->setItemIcon(index, IconCache::icon(iconPath));
|
c->setItemIcon(index, IconCache::icon(iconPath));
|
||||||
|
@ -487,8 +487,12 @@ void TrayIcon::setupTrayMenuBlockTraffic()
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
const QStringList iconPaths = FirewallConf::blockTrafficIconPaths();
|
const QStringList iconPaths = FirewallConf::blockTrafficIconPaths();
|
||||||
for (const QString &name : FirewallConf::blockTrafficNames()) {
|
for (const QString &name : FirewallConf::blockTrafficNames()) {
|
||||||
const QString iconPath = iconPaths.at(index);
|
const QString &iconPath = iconPaths.at(index);
|
||||||
const auto &iniKey = blockTrafficIniKeys[index];
|
|
||||||
|
if (Q_UNLIKELY(index >= std::size(blockTrafficIniKeys)))
|
||||||
|
break;
|
||||||
|
|
||||||
|
const char *iniKey = blockTrafficIniKeys[index];
|
||||||
|
|
||||||
QAction *a = addAction(m_blockTrafficMenu, iconPath, /*receiver=*/nullptr,
|
QAction *a = addAction(m_blockTrafficMenu, iconPath, /*receiver=*/nullptr,
|
||||||
/*member=*/nullptr, ActionNone, /*checkable=*/true);
|
/*member=*/nullptr, ActionNone, /*checkable=*/true);
|
||||||
@ -520,8 +524,12 @@ void TrayIcon::setupTrayMenuFilterMode()
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
const QStringList iconPaths = FirewallConf::filterModeIconPaths();
|
const QStringList iconPaths = FirewallConf::filterModeIconPaths();
|
||||||
for (const QString &name : FirewallConf::filterModeNames()) {
|
for (const QString &name : FirewallConf::filterModeNames()) {
|
||||||
const QString iconPath = iconPaths.at(index);
|
const QString &iconPath = iconPaths.at(index);
|
||||||
const auto &iniKey = filterModeIniKeys[index];
|
|
||||||
|
if (Q_UNLIKELY(index >= std::size(filterModeIniKeys)))
|
||||||
|
break;
|
||||||
|
|
||||||
|
const char *iniKey = filterModeIniKeys[index];
|
||||||
|
|
||||||
QAction *a = addAction(m_filterModeMenu, iconPath, /*receiver=*/nullptr, /*member=*/nullptr,
|
QAction *a = addAction(m_filterModeMenu, iconPath, /*receiver=*/nullptr, /*member=*/nullptr,
|
||||||
ActionNone, /*checkable=*/true);
|
ActionNone, /*checkable=*/true);
|
||||||
|
Loading…
Reference in New Issue
Block a user