UI: FirewallConf: Improve EditedFlags

This commit is contained in:
Nodir Temirkhodjaev 2022-06-04 19:39:08 +03:00
parent 3cb713331b
commit 9e0e1a13c6
2 changed files with 9 additions and 6 deletions

View File

@ -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();

View File

@ -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