fort/src/ui/conf/firewallconf.h

78 lines
2.3 KiB
C
Raw Normal View History

2017-08-28 10:35:15 +00:00
#ifndef FIREWALLCONF_H
#define FIREWALLCONF_H
#include <QObject>
#include <QQmlListProperty>
2017-08-30 07:03:28 +00:00
#include <QVariant>
2017-08-28 10:35:15 +00:00
2017-09-02 10:17:51 +00:00
class AddressGroup;
2017-08-29 08:40:23 +00:00
class AppGroup;
2017-08-28 10:35:15 +00:00
class FirewallConf : public QObject
{
Q_OBJECT
Q_PROPERTY(bool filterEnabled READ filterEnabled WRITE setFilterEnabled NOTIFY filterEnabledChanged)
2017-08-28 10:35:15 +00:00
Q_PROPERTY(bool appLogBlocked READ appLogBlocked WRITE setAppLogBlocked NOTIFY appLogBlockedChanged)
Q_PROPERTY(bool appBlockAll READ appBlockAll WRITE setAppBlockAll NOTIFY appBlockAllChanged)
Q_PROPERTY(bool appAllowAll READ appAllowAll WRITE setAppAllowAll NOTIFY appAllowAllChanged)
2017-09-02 10:17:51 +00:00
Q_PROPERTY(AddressGroup *ipInclude READ ipInclude CONSTANT)
Q_PROPERTY(AddressGroup *ipExclude READ ipExclude CONSTANT)
2017-08-28 10:35:15 +00:00
Q_PROPERTY(QQmlListProperty<AppGroup> appGroups READ appGroups NOTIFY appGroupsChanged)
Q_CLASSINFO("DefaultProperty", "appGroups")
public:
explicit FirewallConf(QObject *parent = nullptr);
bool filterEnabled() const { return m_filterEnabled; }
void setFilterEnabled(bool filterEnabled);
2017-08-28 10:35:15 +00:00
bool appLogBlocked() const { return m_appLogBlocked; }
void setAppLogBlocked(bool appLogBlocked);
bool appBlockAll() const { return m_appBlockAll; }
void setAppBlockAll(bool appBlockAll);
bool appAllowAll() const { return m_appAllowAll; }
void setAppAllowAll(bool appAllowAll);
2017-08-30 16:20:31 +00:00
quint32 appGroupBits() const;
void setAppGroupBits(quint32 groupBits);
2017-09-02 10:17:51 +00:00
AddressGroup *ipInclude() const { return m_ipInclude; }
AddressGroup *ipExclude() const { return m_ipExclude; }
2017-08-28 10:35:15 +00:00
2017-08-29 08:40:23 +00:00
const QList<AppGroup *> &appGroupsList() const { return m_appGroups; }
2017-08-28 10:35:15 +00:00
QQmlListProperty<AppGroup> appGroups();
2017-08-30 07:03:28 +00:00
QVariant toVariant() const;
void fromVariant(const QVariant &v);
2017-08-28 10:35:15 +00:00
signals:
void filterEnabledChanged();
2017-08-28 10:35:15 +00:00
void appLogBlockedChanged();
void appBlockAllChanged();
void appAllowAllChanged();
void appGroupsChanged();
public slots:
2017-09-02 12:52:39 +00:00
void addAppGroup(AppGroup *appGroup, int to = -1);
void addAppGroupByName(const QString &name);
void moveAppGroup(int from, int to);
void removeAppGroup(int from, int to);
2017-08-28 10:35:15 +00:00
private:
uint m_filterEnabled : 1;
2017-08-28 10:35:15 +00:00
uint m_appLogBlocked : 1; // transient
2017-08-28 10:35:15 +00:00
uint m_appBlockAll : 1;
uint m_appAllowAll : 1;
2017-09-02 10:17:51 +00:00
AddressGroup *m_ipInclude;
AddressGroup *m_ipExclude;
2017-08-28 10:35:15 +00:00
QList<AppGroup *> m_appGroups;
};
#endif // FIREWALLCONF_H