mirror of
https://github.com/tnodir/fort
synced 2024-11-14 16:23:03 +00:00
UI: Reorganize "Block Traffic" options
This commit is contained in:
parent
f999630485
commit
d4ceeb3d95
@ -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()
|
||||
|
@ -27,9 +27,9 @@ public:
|
||||
|
||||
enum BlockTrafficType {
|
||||
BlockTrafficNone = 0,
|
||||
BlockTrafficAll,
|
||||
BlockTrafficLan,
|
||||
BlockTrafficInet,
|
||||
BlockTrafficLan,
|
||||
BlockTrafficAll,
|
||||
};
|
||||
Q_ENUM(BlockTrafficType)
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -14,9 +14,9 @@ const char *const list[] = {
|
||||
graph,
|
||||
filter,
|
||||
blockTrafficOff,
|
||||
blockTraffic,
|
||||
blockLanTraffic,
|
||||
blockInetTraffic,
|
||||
blockLanTraffic,
|
||||
blockTraffic,
|
||||
filterModeAutoLearn,
|
||||
filterModeAskToConnect,
|
||||
filterModeBlock,
|
||||
|
Loading…
Reference in New Issue
Block a user