mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:15:10 +00:00
UI: FirewallConf: Improve EditedFlags
This commit is contained in:
parent
3cb713331b
commit
9e0e1a13c6
@ -459,7 +459,7 @@ QVariant FirewallConf::toVariant(bool onlyFlags) const
|
|||||||
{
|
{
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
|
|
||||||
const uint flags = onlyFlags ? editedFlags() : AllEdited;
|
const EditedFlags flags = onlyFlags ? editedFlags() : AllEdited;
|
||||||
|
|
||||||
if (onlyFlags) {
|
if (onlyFlags) {
|
||||||
map = editedFlagsToVariant(flags).toMap();
|
map = editedFlagsToVariant(flags).toMap();
|
||||||
|
@ -16,16 +16,17 @@ class FirewallConf : public QObject
|
|||||||
public:
|
public:
|
||||||
enum EditedFlag {
|
enum EditedFlag {
|
||||||
NoneEdited = 0,
|
NoneEdited = 0,
|
||||||
OptEdited = 0x01,
|
OptEdited = (1 << 0),
|
||||||
FlagsEdited = 0x02,
|
FlagsEdited = (1 << 1),
|
||||||
IniEdited = 0x04,
|
IniEdited = (1 << 2),
|
||||||
TaskEdited = 0x10,
|
TaskEdited = (1 << 3),
|
||||||
AllEdited = (OptEdited | FlagsEdited | IniEdited | TaskEdited)
|
AllEdited = (OptEdited | FlagsEdited | IniEdited | TaskEdited)
|
||||||
};
|
};
|
||||||
|
Q_DECLARE_FLAGS(EditedFlags, EditedFlag)
|
||||||
|
|
||||||
explicit FirewallConf(Settings *settings = nullptr, QObject *parent = nullptr);
|
explicit FirewallConf(Settings *settings = nullptr, QObject *parent = nullptr);
|
||||||
|
|
||||||
uint editedFlags() const { return m_editedFlags; }
|
EditedFlags editedFlags() const { return EditedFlags(m_editedFlags); }
|
||||||
|
|
||||||
bool optEdited() const { return (m_editedFlags & OptEdited) != 0; }
|
bool optEdited() const { return (m_editedFlags & OptEdited) != 0; }
|
||||||
void setOptEdited() { m_editedFlags |= OptEdited; }
|
void setOptEdited() { m_editedFlags |= OptEdited; }
|
||||||
@ -196,4 +197,6 @@ private:
|
|||||||
IniOptions m_ini;
|
IniOptions m_ini;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS(FirewallConf::EditedFlags)
|
||||||
|
|
||||||
#endif // FIREWALLCONF_H
|
#endif // FIREWALLCONF_H
|
||||||
|
Loading…
Reference in New Issue
Block a user