mirror of
https://github.com/tnodir/fort
synced 2024-11-14 22:05:12 +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
|
int FirewallConf::blockTrafficIndex() const
|
||||||
{
|
{
|
||||||
if (m_blockInetTraffic)
|
|
||||||
return BlockTrafficInet;
|
|
||||||
if (m_blockLanTraffic)
|
|
||||||
return BlockTrafficLan;
|
|
||||||
if (m_blockTraffic)
|
if (m_blockTraffic)
|
||||||
return BlockTrafficAll;
|
return BlockTrafficAll;
|
||||||
|
if (m_blockLanTraffic)
|
||||||
|
return BlockTrafficLan;
|
||||||
|
if (m_blockInetTraffic)
|
||||||
|
return BlockTrafficInet;
|
||||||
return BlockTrafficNone;
|
return BlockTrafficNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,16 +30,22 @@ void FirewallConf::setBlockTrafficIndex(int index)
|
|||||||
m_blockInetTraffic = false;
|
m_blockInetTraffic = false;
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case BlockTrafficNone: { // Disabled
|
|
||||||
} break;
|
|
||||||
case BlockTrafficAll: { // Block All Traffic
|
case BlockTrafficAll: { // Block All Traffic
|
||||||
m_blockTraffic = true;
|
m_blockTraffic = true;
|
||||||
} break;
|
}
|
||||||
case BlockTrafficLan: { // Block LAN & Internet Traffic
|
Q_FALLTHROUGH();
|
||||||
|
|
||||||
|
case BlockTrafficLan: { // Block Internet & LAN Traffic
|
||||||
m_blockLanTraffic = true;
|
m_blockLanTraffic = true;
|
||||||
} break;
|
}
|
||||||
|
Q_FALLTHROUGH();
|
||||||
|
|
||||||
case BlockTrafficInet: { // Block Internet Traffic
|
case BlockTrafficInet: { // Block Internet Traffic
|
||||||
m_blockInetTraffic = true;
|
m_blockInetTraffic = true;
|
||||||
|
}
|
||||||
|
Q_FALLTHROUGH();
|
||||||
|
|
||||||
|
case BlockTrafficNone: { // Disabled
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,13 +90,13 @@ void FirewallConf::setFilterMode(FirewallConf::FilterMode mode)
|
|||||||
|
|
||||||
QStringList FirewallConf::blockTrafficNames()
|
QStringList FirewallConf::blockTrafficNames()
|
||||||
{
|
{
|
||||||
return { tr("Disabled"), tr("Block All Traffic"), tr("Block LAN and Internet Traffic"),
|
return { tr("No Block"), tr("Block Internet Traffic"), tr("Block Internet and LAN Traffic"),
|
||||||
tr("Block Internet Traffic") };
|
tr("Block All Traffic") };
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList FirewallConf::blockTrafficIconPaths()
|
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()
|
QStringList FirewallConf::filterModeNames()
|
||||||
|
@ -27,9 +27,9 @@ public:
|
|||||||
|
|
||||||
enum BlockTrafficType {
|
enum BlockTrafficType {
|
||||||
BlockTrafficNone = 0,
|
BlockTrafficNone = 0,
|
||||||
BlockTrafficAll,
|
|
||||||
BlockTrafficLan,
|
|
||||||
BlockTrafficInet,
|
BlockTrafficInet,
|
||||||
|
BlockTrafficLan,
|
||||||
|
BlockTrafficAll,
|
||||||
};
|
};
|
||||||
Q_ENUM(BlockTrafficType)
|
Q_ENUM(BlockTrafficType)
|
||||||
|
|
||||||
|
@ -50,9 +50,9 @@ bool processCommandHome(const ProcessCommandArgs &p)
|
|||||||
enum BlockAction : qint8 {
|
enum BlockAction : qint8 {
|
||||||
BlockActionInvalid = -1,
|
BlockActionInvalid = -1,
|
||||||
BlockActionNone = 0,
|
BlockActionNone = 0,
|
||||||
BlockActionAll,
|
|
||||||
BlockActionLan,
|
|
||||||
BlockActionInet,
|
BlockActionInet,
|
||||||
|
BlockActionLan,
|
||||||
|
BlockActionAll,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool processCommandProgBlock(BlockAction blockAction)
|
bool processCommandProgBlock(BlockAction blockAction)
|
||||||
@ -67,17 +67,17 @@ bool processCommandProgBlock(BlockAction blockAction)
|
|||||||
|
|
||||||
BlockAction blockActionByText(const QString &commandText)
|
BlockAction blockActionByText(const QString &commandText)
|
||||||
{
|
{
|
||||||
if (commandText == "none")
|
if (commandText == "no")
|
||||||
return BlockActionNone;
|
return BlockActionNone;
|
||||||
|
|
||||||
if (commandText == "all")
|
if (commandText == "inet")
|
||||||
return BlockActionAll;
|
return BlockActionInet;
|
||||||
|
|
||||||
if (commandText == "lan")
|
if (commandText == "lan")
|
||||||
return BlockActionLan;
|
return BlockActionLan;
|
||||||
|
|
||||||
if (commandText == "internet")
|
if (commandText == "all")
|
||||||
return BlockActionInet;
|
return BlockActionAll;
|
||||||
|
|
||||||
return BlockActionInvalid;
|
return BlockActionInvalid;
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ bool processCommandBlock(const ProcessCommandArgs &p)
|
|||||||
{
|
{
|
||||||
const BlockAction blockAction = blockActionByText(p.args.value(0).toString());
|
const BlockAction blockAction = blockActionByText(p.args.value(0).toString());
|
||||||
if (blockAction == BlockActionInvalid) {
|
if (blockAction == BlockActionInvalid) {
|
||||||
p.errorMessage = "Usage: block none|all|lan|internet";
|
p.errorMessage = "Usage: block no|inet|lan|all";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,9 +519,9 @@ void TrayIcon::setupTrayMenuBlockTraffic()
|
|||||||
{
|
{
|
||||||
static const char *const blockTrafficIniKeys[] = {
|
static const char *const blockTrafficIniKeys[] = {
|
||||||
HotKey::blockTrafficOff,
|
HotKey::blockTrafficOff,
|
||||||
HotKey::blockTraffic,
|
|
||||||
HotKey::blockLanTraffic,
|
|
||||||
HotKey::blockInetTraffic,
|
HotKey::blockInetTraffic,
|
||||||
|
HotKey::blockLanTraffic,
|
||||||
|
HotKey::blockTraffic,
|
||||||
};
|
};
|
||||||
|
|
||||||
m_blockTrafficMenu = ControlUtil::createMenu(m_menu);
|
m_blockTrafficMenu = ControlUtil::createMenu(m_menu);
|
||||||
|
@ -14,9 +14,9 @@ const char *const list[] = {
|
|||||||
graph,
|
graph,
|
||||||
filter,
|
filter,
|
||||||
blockTrafficOff,
|
blockTrafficOff,
|
||||||
blockTraffic,
|
|
||||||
blockLanTraffic,
|
|
||||||
blockInetTraffic,
|
blockInetTraffic,
|
||||||
|
blockLanTraffic,
|
||||||
|
blockTraffic,
|
||||||
filterModeAutoLearn,
|
filterModeAutoLearn,
|
||||||
filterModeAskToConnect,
|
filterModeAskToConnect,
|
||||||
filterModeBlock,
|
filterModeBlock,
|
||||||
|
Loading…
Reference in New Issue
Block a user