diff --git a/src/ui/conf/firewallconf.cpp b/src/ui/conf/firewallconf.cpp index f3e3b913..299b3024 100644 --- a/src/ui/conf/firewallconf.cpp +++ b/src/ui/conf/firewallconf.cpp @@ -14,12 +14,12 @@ FirewallConf::FirewallConf(Settings *settings, QObject *parent) : QObject(parent int FirewallConf::blockTrafficIndex() const { - if (m_blockInetTraffic) - return BlockTrafficInet; - if (m_blockLanTraffic) - return BlockTrafficLan; if (m_blockTraffic) return BlockTrafficAll; + if (m_blockLanTraffic) + return BlockTrafficLan; + if (m_blockInetTraffic) + return BlockTrafficInet; return BlockTrafficNone; } @@ -30,16 +30,22 @@ void FirewallConf::setBlockTrafficIndex(int index) m_blockInetTraffic = false; switch (index) { - case BlockTrafficNone: { // Disabled - } break; case BlockTrafficAll: { // Block All Traffic m_blockTraffic = true; - } break; - case BlockTrafficLan: { // Block LAN & Internet Traffic + } + Q_FALLTHROUGH(); + + case BlockTrafficLan: { // Block Internet & LAN Traffic m_blockLanTraffic = true; - } break; + } + Q_FALLTHROUGH(); + case BlockTrafficInet: { // Block Internet Traffic m_blockInetTraffic = true; + } + Q_FALLTHROUGH(); + + case BlockTrafficNone: { // Disabled } break; } } @@ -84,13 +90,13 @@ void FirewallConf::setFilterMode(FirewallConf::FilterMode mode) QStringList FirewallConf::blockTrafficNames() { - return { tr("Disabled"), tr("Block All Traffic"), tr("Block LAN and Internet Traffic"), - tr("Block Internet Traffic") }; + return { tr("No Block"), tr("Block Internet Traffic"), tr("Block Internet and LAN Traffic"), + tr("Block All Traffic") }; } QStringList FirewallConf::blockTrafficIconPaths() { - return { QString(), ":/icons/cross.png", ":/icons/computer.png", ":/icons/hostname.png" }; + return { QString(), ":/icons/hostname.png", ":/icons/computer.png", ":/icons/cross.png" }; } QStringList FirewallConf::filterModeNames() diff --git a/src/ui/conf/firewallconf.h b/src/ui/conf/firewallconf.h index b4141551..ccbb7b59 100644 --- a/src/ui/conf/firewallconf.h +++ b/src/ui/conf/firewallconf.h @@ -27,9 +27,9 @@ public: enum BlockTrafficType { BlockTrafficNone = 0, - BlockTrafficAll, - BlockTrafficLan, BlockTrafficInet, + BlockTrafficLan, + BlockTrafficAll, }; Q_ENUM(BlockTrafficType) diff --git a/src/ui/control/controlmanager.cpp b/src/ui/control/controlmanager.cpp index 27029acf..2b7abf6d 100644 --- a/src/ui/control/controlmanager.cpp +++ b/src/ui/control/controlmanager.cpp @@ -50,9 +50,9 @@ bool processCommandHome(const ProcessCommandArgs &p) enum BlockAction : qint8 { BlockActionInvalid = -1, BlockActionNone = 0, - BlockActionAll, - BlockActionLan, BlockActionInet, + BlockActionLan, + BlockActionAll, }; bool processCommandProgBlock(BlockAction blockAction) @@ -67,17 +67,17 @@ bool processCommandProgBlock(BlockAction blockAction) BlockAction blockActionByText(const QString &commandText) { - if (commandText == "none") + if (commandText == "no") return BlockActionNone; - if (commandText == "all") - return BlockActionAll; + if (commandText == "inet") + return BlockActionInet; if (commandText == "lan") return BlockActionLan; - if (commandText == "internet") - return BlockActionInet; + if (commandText == "all") + return BlockActionAll; return BlockActionInvalid; } @@ -86,7 +86,7 @@ bool processCommandBlock(const ProcessCommandArgs &p) { const BlockAction blockAction = blockActionByText(p.args.value(0).toString()); if (blockAction == BlockActionInvalid) { - p.errorMessage = "Usage: block none|all|lan|internet"; + p.errorMessage = "Usage: block no|inet|lan|all"; return false; } diff --git a/src/ui/form/tray/trayicon.cpp b/src/ui/form/tray/trayicon.cpp index 507b117d..50cbdb9d 100644 --- a/src/ui/form/tray/trayicon.cpp +++ b/src/ui/form/tray/trayicon.cpp @@ -519,9 +519,9 @@ void TrayIcon::setupTrayMenuBlockTraffic() { static const char *const blockTrafficIniKeys[] = { HotKey::blockTrafficOff, - HotKey::blockTraffic, - HotKey::blockLanTraffic, HotKey::blockInetTraffic, + HotKey::blockLanTraffic, + HotKey::blockTraffic, }; m_blockTrafficMenu = ControlUtil::createMenu(m_menu); diff --git a/src/ui/user/iniuser.cpp b/src/ui/user/iniuser.cpp index 3ec4cb91..1df39a9d 100644 --- a/src/ui/user/iniuser.cpp +++ b/src/ui/user/iniuser.cpp @@ -14,9 +14,9 @@ const char *const list[] = { graph, filter, blockTrafficOff, - blockTraffic, - blockLanTraffic, blockInetTraffic, + blockLanTraffic, + blockTraffic, filterModeAutoLearn, filterModeAskToConnect, filterModeBlock,