mirror of
https://github.com/tnodir/fort
synced 2024-11-15 07:25:18 +00:00
UI: Rename Policies to Rules
This commit is contained in:
parent
8a5b72a752
commit
f13700614e
@ -83,14 +83,14 @@ SOURCES += \
|
||||
form/opt/pages/optmainpage.cpp \
|
||||
form/opt/pages/schedulepage.cpp \
|
||||
form/opt/pages/statisticspage.cpp \
|
||||
form/policy/policiescontroller.cpp \
|
||||
form/policy/policieswindow.cpp \
|
||||
form/policy/policyeditdialog.cpp \
|
||||
form/policy/policylistbox.cpp \
|
||||
form/prog/programalertwindow.cpp \
|
||||
form/prog/programeditdialog.cpp \
|
||||
form/prog/programscontroller.cpp \
|
||||
form/prog/programswindow.cpp \
|
||||
form/rule/ruleeditdialog.cpp \
|
||||
form/rule/rulelistbox.cpp \
|
||||
form/rule/rulescontroller.cpp \
|
||||
form/rule/ruleswindow.cpp \
|
||||
form/stat/pages/connectionspage.cpp \
|
||||
form/stat/pages/statbasepage.cpp \
|
||||
form/stat/pages/statmainpage.cpp \
|
||||
@ -287,14 +287,14 @@ HEADERS += \
|
||||
form/opt/pages/optmainpage.h \
|
||||
form/opt/pages/schedulepage.h \
|
||||
form/opt/pages/statisticspage.h \
|
||||
form/policy/policiescontroller.h \
|
||||
form/policy/policieswindow.h \
|
||||
form/policy/policyeditdialog.h \
|
||||
form/policy/policylistbox.h \
|
||||
form/prog/programalertwindow.h \
|
||||
form/prog/programeditdialog.h \
|
||||
form/prog/programscontroller.h \
|
||||
form/prog/programswindow.h \
|
||||
form/rule/ruleeditdialog.h \
|
||||
form/rule/rulelistbox.h \
|
||||
form/rule/rulescontroller.h \
|
||||
form/rule/ruleswindow.h \
|
||||
form/stat/pages/connectionspage.h \
|
||||
form/stat/pages/statbasepage.h \
|
||||
form/stat/pages/statmainpage.h \
|
||||
|
@ -1,7 +0,0 @@
|
||||
#include "policiescontroller.h"
|
||||
|
||||
#include <util/ioc/ioccontainer.h>
|
||||
|
||||
PoliciesController::PoliciesController(QObject *parent) : BaseController(parent) { }
|
||||
|
||||
void PoliciesController::initialize() { }
|
@ -1,16 +0,0 @@
|
||||
#ifndef POLICIESCONTROLLER_H
|
||||
#define POLICIESCONTROLLER_H
|
||||
|
||||
#include <form/basecontroller.h>
|
||||
|
||||
class PoliciesController : public BaseController
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PoliciesController(QObject *parent = nullptr);
|
||||
|
||||
void initialize();
|
||||
};
|
||||
|
||||
#endif // POLICIESCONTROLLER_H
|
@ -1,5 +0,0 @@
|
||||
#include "policyeditdialog.h"
|
||||
|
||||
#include <conf/rules/policyset.h>
|
||||
|
||||
PolicyEditDialog::PolicyEditDialog(QObject *parent) : QObject(parent) { }
|
@ -1,28 +0,0 @@
|
||||
#ifndef POLICYEDITDIALOG_H
|
||||
#define POLICYEDITDIALOG_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QGroupBox)
|
||||
QT_FORWARD_DECLARE_CLASS(QLineEdit)
|
||||
|
||||
class PolicySet;
|
||||
|
||||
class PolicyEditDialog : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PolicyEditDialog(QObject *parent = nullptr);
|
||||
|
||||
PolicySet *policySet() { return m_policySet; }
|
||||
|
||||
private:
|
||||
PolicySet *m_policySet = nullptr;
|
||||
|
||||
QGroupBox *m_gbRuleList = nullptr;
|
||||
QGroupBox *m_gbPolicyList = nullptr;
|
||||
QLineEdit *m_editName = nullptr;
|
||||
};
|
||||
|
||||
#endif // POLICYEDITDIALOG_H
|
5
src/ui/form/rule/ruleeditdialog.cpp
Normal file
5
src/ui/form/rule/ruleeditdialog.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include "ruleeditdialog.h"
|
||||
|
||||
#include <conf/rules/policyset.h>
|
||||
|
||||
RuleEditDialog::RuleEditDialog(QObject *parent) : QObject(parent) { }
|
28
src/ui/form/rule/ruleeditdialog.h
Normal file
28
src/ui/form/rule/ruleeditdialog.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef RULEEDITDIALOG_H
|
||||
#define RULEEDITDIALOG_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QGroupBox)
|
||||
QT_FORWARD_DECLARE_CLASS(QLineEdit)
|
||||
|
||||
class RuleSet;
|
||||
|
||||
class RuleEditDialog : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RuleEditDialog(QObject *parent = nullptr);
|
||||
|
||||
RuleSet *policySet() { return m_ruleSet; }
|
||||
|
||||
private:
|
||||
RuleSet *m_ruleSet = nullptr;
|
||||
|
||||
QGroupBox *m_gbRuleList = nullptr;
|
||||
QGroupBox *m_gbPolicyList = nullptr;
|
||||
QLineEdit *m_editName = nullptr;
|
||||
};
|
||||
|
||||
#endif // RULEEDITDIALOG_H
|
@ -1,4 +1,4 @@
|
||||
#include "policylistbox.h"
|
||||
#include "rulelistbox.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QHeaderView>
|
||||
@ -10,27 +10,27 @@
|
||||
#include <form/controls/tableview.h>
|
||||
#include <model/policylistmodel.h>
|
||||
|
||||
PolicyListBox::PolicyListBox(Policy::PolicyType policyType, QWidget *parent) :
|
||||
QWidget(parent), m_listModel(new PolicyListModel(policyType, this))
|
||||
RuleListBox::RuleListBox(Policy::PolicyType policyType, QWidget *parent) :
|
||||
QWidget(parent), m_listModel(new RuleListModel(policyType, this))
|
||||
{
|
||||
setupUi();
|
||||
|
||||
listModel()->initialize();
|
||||
}
|
||||
|
||||
Policy::PolicyType PolicyListBox::policyType() const
|
||||
Policy::PolicyType RuleListBox::policyType() const
|
||||
{
|
||||
return listModel()->policyType();
|
||||
}
|
||||
|
||||
void PolicyListBox::onRetranslateUi()
|
||||
void RuleListBox::onRetranslateUi()
|
||||
{
|
||||
m_btAddPolicy->setToolTip(tr("Add Policy"));
|
||||
m_btRemovePolicy->setToolTip(tr("Remove Policy"));
|
||||
m_btEditPolicy->setToolTip(tr("Edit Policy"));
|
||||
}
|
||||
|
||||
void PolicyListBox::setupUi()
|
||||
void RuleListBox::setupUi()
|
||||
{
|
||||
auto layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
@ -46,7 +46,7 @@ void PolicyListBox::setupUi()
|
||||
this->setLayout(layout);
|
||||
}
|
||||
|
||||
QLayout *PolicyListBox::setupHeader()
|
||||
QLayout *RuleListBox::setupHeader()
|
||||
{
|
||||
m_label = ControlUtil::createLabel();
|
||||
|
||||
@ -67,7 +67,7 @@ QLayout *PolicyListBox::setupHeader()
|
||||
return layout;
|
||||
}
|
||||
|
||||
void PolicyListBox::setupTableView()
|
||||
void RuleListBox::setupTableView()
|
||||
{
|
||||
m_tableView = new TableView();
|
||||
m_tableView->setAlternatingRowColors(true);
|
@ -1,5 +1,5 @@
|
||||
#ifndef POLICYLISTBOX_H
|
||||
#define POLICYLISTBOX_H
|
||||
#ifndef RULELISTBOX_H
|
||||
#define RULELISTBOX_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
@ -8,17 +8,17 @@
|
||||
QT_FORWARD_DECLARE_CLASS(QLabel)
|
||||
QT_FORWARD_DECLARE_CLASS(QToolButton)
|
||||
|
||||
class PolicyListModel;
|
||||
class RuleListModel;
|
||||
class TableView;
|
||||
|
||||
class PolicyListBox : public QWidget
|
||||
class RuleListBox : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PolicyListBox(Policy::PolicyType policyType, QWidget *parent = nullptr);
|
||||
explicit RuleListBox(Policy::PolicyType policyType, QWidget *parent = nullptr);
|
||||
|
||||
PolicyListModel *listModel() const { return m_listModel; }
|
||||
RuleListModel *listModel() const { return m_listModel; }
|
||||
Policy::PolicyType policyType() const;
|
||||
|
||||
QLabel *label() const { return m_label; }
|
||||
@ -38,7 +38,7 @@ private:
|
||||
void setupTableView();
|
||||
|
||||
private:
|
||||
PolicyListModel *m_listModel = nullptr;
|
||||
RuleListModel *m_listModel = nullptr;
|
||||
|
||||
QLabel *m_label = nullptr;
|
||||
QToolButton *m_btAddPolicy = nullptr;
|
||||
@ -47,4 +47,4 @@ private:
|
||||
TableView *m_tableView = nullptr;
|
||||
};
|
||||
|
||||
#endif // POLICYLISTBOX_H
|
||||
#endif // RULELISTBOX_H
|
7
src/ui/form/rule/rulescontroller.cpp
Normal file
7
src/ui/form/rule/rulescontroller.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include "rulescontroller.h"
|
||||
|
||||
#include <util/ioc/ioccontainer.h>
|
||||
|
||||
RulesController::RulesController(QObject *parent) : BaseController(parent) { }
|
||||
|
||||
void RulesController::initialize() { }
|
16
src/ui/form/rule/rulescontroller.h
Normal file
16
src/ui/form/rule/rulescontroller.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef RULESCONTROLLER_H
|
||||
#define RULESCONTROLLER_H
|
||||
|
||||
#include <form/basecontroller.h>
|
||||
|
||||
class RulesController : public BaseController
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RulesController(QObject *parent = nullptr);
|
||||
|
||||
void initialize();
|
||||
};
|
||||
|
||||
#endif // RULESCONTROLLER_H
|
@ -1,4 +1,4 @@
|
||||
#include "policieswindow.h"
|
||||
#include "ruleswindow.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QHeaderView>
|
||||
@ -16,8 +16,8 @@
|
||||
#include <util/iconcache.h>
|
||||
#include <util/window/widgetwindowstatewatcher.h>
|
||||
|
||||
#include "policiescontroller.h"
|
||||
#include "policylistbox.h"
|
||||
#include "rulescontroller.h"
|
||||
#include "rulelistbox.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -25,9 +25,9 @@ constexpr int POLICIES_SPLIT_VERSION = 1;
|
||||
|
||||
}
|
||||
|
||||
PoliciesWindow::PoliciesWindow(QWidget *parent) :
|
||||
RulesWindow::RulesWindow(QWidget *parent) :
|
||||
WidgetWindow(parent),
|
||||
m_ctrl(new PoliciesController(this)),
|
||||
m_ctrl(new RulesController(this)),
|
||||
m_stateWatcher(new WidgetWindowStateWatcher(this))
|
||||
{
|
||||
setupUi();
|
||||
@ -35,71 +35,71 @@ PoliciesWindow::PoliciesWindow(QWidget *parent) :
|
||||
setupStateWatcher();
|
||||
}
|
||||
|
||||
ConfManager *PoliciesWindow::confManager() const
|
||||
ConfManager *RulesWindow::confManager() const
|
||||
{
|
||||
return ctrl()->confManager();
|
||||
}
|
||||
|
||||
FirewallConf *PoliciesWindow::conf() const
|
||||
FirewallConf *RulesWindow::conf() const
|
||||
{
|
||||
return ctrl()->conf();
|
||||
}
|
||||
|
||||
IniOptions *PoliciesWindow::ini() const
|
||||
IniOptions *RulesWindow::ini() const
|
||||
{
|
||||
return ctrl()->ini();
|
||||
}
|
||||
|
||||
IniUser *PoliciesWindow::iniUser() const
|
||||
IniUser *RulesWindow::iniUser() const
|
||||
{
|
||||
return ctrl()->iniUser();
|
||||
}
|
||||
|
||||
WindowManager *PoliciesWindow::windowManager() const
|
||||
WindowManager *RulesWindow::windowManager() const
|
||||
{
|
||||
return ctrl()->windowManager();
|
||||
}
|
||||
|
||||
void PoliciesWindow::saveWindowState(bool /*wasVisible*/)
|
||||
void RulesWindow::saveWindowState(bool /*wasVisible*/)
|
||||
{
|
||||
iniUser()->setPolicyWindowGeometry(m_stateWatcher->geometry());
|
||||
iniUser()->setPolicyWindowMaximized(m_stateWatcher->maximized());
|
||||
iniUser()->setRuleWindowGeometry(m_stateWatcher->geometry());
|
||||
iniUser()->setRuleWindowMaximized(m_stateWatcher->maximized());
|
||||
|
||||
iniUser()->setPolicyWindowSplit(m_splitter->saveState());
|
||||
iniUser()->setPolicyWindowPresetSplit(m_presetSplitter->saveState());
|
||||
iniUser()->setPolicyWindowGlobalSplit(m_globalSplitter->saveState());
|
||||
iniUser()->setPolicyWindowSplitVersion(POLICIES_SPLIT_VERSION);
|
||||
iniUser()->setRuleWindowSplit(m_splitter->saveState());
|
||||
iniUser()->setRuleWindowPresetSplit(m_presetSplitter->saveState());
|
||||
iniUser()->setRuleWindowGlobalSplit(m_globalSplitter->saveState());
|
||||
iniUser()->setRuleWindowSplitVersion(POLICIES_SPLIT_VERSION);
|
||||
|
||||
confManager()->saveIniUser();
|
||||
}
|
||||
|
||||
void PoliciesWindow::restoreWindowState()
|
||||
void RulesWindow::restoreWindowState()
|
||||
{
|
||||
m_stateWatcher->restore(this, QSize(800, 600), iniUser()->policyWindowGeometry(),
|
||||
iniUser()->policyWindowMaximized());
|
||||
m_stateWatcher->restore(this, QSize(800, 600), iniUser()->ruleWindowGeometry(),
|
||||
iniUser()->ruleWindowMaximized());
|
||||
|
||||
if (iniUser()->policyWindowSplitVersion() == POLICIES_SPLIT_VERSION) {
|
||||
m_splitter->restoreState(iniUser()->policyWindowSplit());
|
||||
m_presetSplitter->restoreState(iniUser()->policyWindowPresetSplit());
|
||||
m_globalSplitter->restoreState(iniUser()->policyWindowGlobalSplit());
|
||||
if (iniUser()->ruleWindowSplitVersion() == POLICIES_SPLIT_VERSION) {
|
||||
m_splitter->restoreState(iniUser()->ruleWindowSplit());
|
||||
m_presetSplitter->restoreState(iniUser()->ruleWindowPresetSplit());
|
||||
m_globalSplitter->restoreState(iniUser()->ruleWindowGlobalSplit());
|
||||
}
|
||||
}
|
||||
|
||||
void PoliciesWindow::setupController()
|
||||
void RulesWindow::setupController()
|
||||
{
|
||||
ctrl()->initialize();
|
||||
|
||||
connect(ctrl(), &PoliciesController::retranslateUi, this, &PoliciesWindow::retranslateUi);
|
||||
connect(ctrl(), &RulesController::retranslateUi, this, &RulesWindow::retranslateUi);
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
void PoliciesWindow::setupStateWatcher()
|
||||
void RulesWindow::setupStateWatcher()
|
||||
{
|
||||
m_stateWatcher->install(this);
|
||||
}
|
||||
|
||||
void PoliciesWindow::retranslateUi()
|
||||
void RulesWindow::retranslateUi()
|
||||
{
|
||||
this->unsetLocale();
|
||||
|
||||
@ -116,7 +116,7 @@ void PoliciesWindow::retranslateUi()
|
||||
this->setWindowTitle(tr("Policies"));
|
||||
}
|
||||
|
||||
void PoliciesWindow::setupUi()
|
||||
void RulesWindow::setupUi()
|
||||
{
|
||||
auto layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(6, 6, 6, 6);
|
||||
@ -142,13 +142,13 @@ void PoliciesWindow::setupUi()
|
||||
|
||||
// Icon
|
||||
this->setWindowIcon(
|
||||
GuiUtil::overlayIcon(":/icons/fort.png", ":/icons/traffic_lights.png"));
|
||||
GuiUtil::overlayIcon(":/icons/fort.png", ":/icons/checklist.png"));
|
||||
|
||||
// Size
|
||||
this->setMinimumSize(500, 400);
|
||||
}
|
||||
|
||||
void PoliciesWindow::setupPresetSplitter()
|
||||
void RulesWindow::setupPresetSplitter()
|
||||
{
|
||||
// Preset Lib Group Box
|
||||
setupPresetLibBox();
|
||||
@ -164,17 +164,17 @@ void PoliciesWindow::setupPresetSplitter()
|
||||
m_presetSplitter->addWidget(m_presetAppBox);
|
||||
}
|
||||
|
||||
void PoliciesWindow::setupPresetLibBox()
|
||||
void RulesWindow::setupPresetLibBox()
|
||||
{
|
||||
m_presetLibBox = new PolicyListBox(Policy::TypePresetLibrary);
|
||||
m_presetLibBox = new RuleListBox(Policy::TypePresetLibrary);
|
||||
}
|
||||
|
||||
void PoliciesWindow::setupPresetAppBox()
|
||||
void RulesWindow::setupPresetAppBox()
|
||||
{
|
||||
m_presetAppBox = new PolicyListBox(Policy::TypePresetApp);
|
||||
m_presetAppBox = new RuleListBox(Policy::TypePresetApp);
|
||||
}
|
||||
|
||||
void PoliciesWindow::setupGlobalSplitter()
|
||||
void RulesWindow::setupGlobalSplitter()
|
||||
{
|
||||
// Global Pre Group Box
|
||||
setupGlobalPreBox();
|
||||
@ -190,12 +190,12 @@ void PoliciesWindow::setupGlobalSplitter()
|
||||
m_globalSplitter->addWidget(m_globalPostBox);
|
||||
}
|
||||
|
||||
void PoliciesWindow::setupGlobalPreBox()
|
||||
void RulesWindow::setupGlobalPreBox()
|
||||
{
|
||||
m_globalPreBox = new PolicyListBox(Policy::TypeGlobalBeforeApp);
|
||||
m_globalPreBox = new RuleListBox(Policy::TypeGlobalBeforeApp);
|
||||
}
|
||||
|
||||
void PoliciesWindow::setupGlobalPostBox()
|
||||
void RulesWindow::setupGlobalPostBox()
|
||||
{
|
||||
m_globalPostBox = new PolicyListBox(Policy::TypeGlobalAfterApp);
|
||||
m_globalPostBox = new RuleListBox(Policy::TypeGlobalAfterApp);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
#ifndef POLICIESWINDOW_H
|
||||
#define POLICIESWINDOW_H
|
||||
#ifndef RULESWINDOW_H
|
||||
#define RULESWINDOW_H
|
||||
|
||||
#include <form/windowtypes.h>
|
||||
#include <util/window/widgetwindow.h>
|
||||
@ -10,22 +10,22 @@ class ConfManager;
|
||||
class FirewallConf;
|
||||
class IniOptions;
|
||||
class IniUser;
|
||||
class PoliciesController;
|
||||
class PolicyListBox;
|
||||
class RulesController;
|
||||
class RuleListBox;
|
||||
class TableView;
|
||||
class WidgetWindowStateWatcher;
|
||||
class WindowManager;
|
||||
|
||||
class PoliciesWindow : public WidgetWindow
|
||||
class RulesWindow : public WidgetWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PoliciesWindow(QWidget *parent = nullptr);
|
||||
explicit RulesWindow(QWidget *parent = nullptr);
|
||||
|
||||
quint32 windowCode() const override { return WindowPolicies; }
|
||||
quint32 windowCode() const override { return WindowRules; }
|
||||
|
||||
PoliciesController *ctrl() const { return m_ctrl; }
|
||||
RulesController *ctrl() const { return m_ctrl; }
|
||||
ConfManager *confManager() const;
|
||||
FirewallConf *conf() const;
|
||||
IniOptions *ini() const;
|
||||
@ -50,16 +50,16 @@ private:
|
||||
void setupGlobalPostBox();
|
||||
|
||||
private:
|
||||
PoliciesController *m_ctrl = nullptr;
|
||||
RulesController *m_ctrl = nullptr;
|
||||
WidgetWindowStateWatcher *m_stateWatcher = nullptr;
|
||||
|
||||
PolicyListBox *m_presetLibBox = nullptr;
|
||||
PolicyListBox *m_presetAppBox = nullptr;
|
||||
PolicyListBox *m_globalPreBox = nullptr;
|
||||
PolicyListBox *m_globalPostBox = nullptr;
|
||||
RuleListBox *m_presetLibBox = nullptr;
|
||||
RuleListBox *m_presetAppBox = nullptr;
|
||||
RuleListBox *m_globalPreBox = nullptr;
|
||||
RuleListBox *m_globalPostBox = nullptr;
|
||||
QSplitter *m_splitter = nullptr;
|
||||
QSplitter *m_presetSplitter = nullptr;
|
||||
QSplitter *m_globalSplitter = nullptr;
|
||||
};
|
||||
|
||||
#endif // POLICIESWINDOW_H
|
||||
#endif // RULESWINDOW_H
|
@ -329,7 +329,7 @@ void TrayIcon::retranslateUi()
|
||||
m_programsAction->setText(tr("Programs"));
|
||||
m_optionsMenu->setTitle(tr("Options"));
|
||||
m_optionsAction->setText(tr("Options"));
|
||||
m_policiesAction->setText(tr("Policies"));
|
||||
m_rulesAction->setText(tr("Rules"));
|
||||
m_zonesAction->setText(tr("Zones"));
|
||||
m_statisticsAction->setText(tr("Statistics"));
|
||||
m_graphAction->setText(tr("Traffic Graph"));
|
||||
@ -455,12 +455,12 @@ void TrayIcon::setupTrayMenuOptions()
|
||||
|
||||
connect(m_optionsMenu, &ClickableMenu::clicked, m_optionsAction, &QAction::trigger);
|
||||
|
||||
m_policiesAction = addAction(m_optionsMenu, ":/icons/traffic_lights.png", windowManager(),
|
||||
SLOT(showPoliciesWindow()));
|
||||
addHotKey(m_policiesAction, iniUser()->hotKeyPolicies());
|
||||
m_rulesAction = addAction(m_optionsMenu, ":/icons/checklist.png", windowManager(),
|
||||
SLOT(showRulesWindow()));
|
||||
addHotKey(m_rulesAction, iniUser()->hotKeyRules());
|
||||
|
||||
// TODO: Implement Policies
|
||||
m_policiesAction->setEnabled(false);
|
||||
// TODO: Implement Rules
|
||||
m_rulesAction->setEnabled(false);
|
||||
|
||||
m_zonesAction = addAction(
|
||||
m_optionsMenu, ":/icons/ip_class.png", windowManager(), SLOT(showZonesWindow()));
|
||||
|
@ -143,7 +143,7 @@ private:
|
||||
QAction *m_programsOrAlertAction = nullptr;
|
||||
ClickableMenu *m_optionsMenu = nullptr;
|
||||
QAction *m_optionsAction = nullptr;
|
||||
QAction *m_policiesAction = nullptr;
|
||||
QAction *m_rulesAction = nullptr;
|
||||
QAction *m_statisticsAction = nullptr;
|
||||
QAction *m_graphAction = nullptr;
|
||||
QAction *m_zonesAction = nullptr;
|
||||
|
@ -9,7 +9,7 @@ enum WindowCode {
|
||||
WindowProgramAlert = (1 << 2),
|
||||
WindowServices = (1 << 3),
|
||||
WindowOptions = (1 << 4),
|
||||
WindowPolicies = (1 << 5),
|
||||
WindowRules = (1 << 5),
|
||||
WindowStatistics = (1 << 6),
|
||||
WindowZones = (1 << 7),
|
||||
WindowGraph = (1 << 8),
|
||||
@ -17,6 +17,6 @@ enum WindowCode {
|
||||
};
|
||||
|
||||
constexpr quint32 WindowPasswordProtected = (WindowPrograms | WindowProgramAlert | WindowServices
|
||||
| WindowOptions | WindowPolicies | WindowStatistics | WindowZones);
|
||||
| WindowOptions | WindowRules | WindowStatistics | WindowZones);
|
||||
|
||||
#endif // WINDOWTYPES_H
|
||||
|
@ -57,7 +57,6 @@
|
||||
<file>icons/standby.png</file>
|
||||
<file>icons/tick.png</file>
|
||||
<file>icons/time.png</file>
|
||||
<file>icons/traffic_lights.png</file>
|
||||
<file>icons/widgets.png</file>
|
||||
<file>icons/windows-48.png</file>
|
||||
</qresource>
|
||||
|
@ -17,9 +17,9 @@
|
||||
#include <form/graph/graphwindow.h>
|
||||
#include <form/home/homewindow.h>
|
||||
#include <form/opt/optionswindow.h>
|
||||
#include <form/policy/policieswindow.h>
|
||||
#include <form/prog/programalertwindow.h>
|
||||
#include <form/prog/programswindow.h>
|
||||
#include <form/rule/ruleswindow.h>
|
||||
#include <form/stat/statisticswindow.h>
|
||||
#include <form/svc/serviceswindow.h>
|
||||
#include <form/tray/trayicon.h>
|
||||
@ -178,13 +178,12 @@ void WindowManager::setupOptionsWindow()
|
||||
connect(m_optWindow, &OptionsWindow::aboutToClose, this, &WindowManager::closeOptionsWindow);
|
||||
}
|
||||
|
||||
void WindowManager::setupPoliciesWindow()
|
||||
void WindowManager::setupRulesWindow()
|
||||
{
|
||||
m_policiesWindow = new PoliciesWindow();
|
||||
m_policiesWindow->restoreWindowState();
|
||||
m_rulesWindow = new RulesWindow();
|
||||
m_rulesWindow->restoreWindowState();
|
||||
|
||||
connect(m_policiesWindow, &PoliciesWindow::aboutToClose, this,
|
||||
&WindowManager::closePoliciesWindow);
|
||||
connect(m_rulesWindow, &RulesWindow::aboutToClose, this, &WindowManager::closeRulesWindow);
|
||||
}
|
||||
|
||||
void WindowManager::setupServicesWindow()
|
||||
@ -428,22 +427,22 @@ void WindowManager::reloadOptionsWindow(const QString &reason)
|
||||
showTrayMessage(reason);
|
||||
}
|
||||
|
||||
void WindowManager::showPoliciesWindow()
|
||||
void WindowManager::showRulesWindow()
|
||||
{
|
||||
if (!checkWindowPassword(WindowPolicies))
|
||||
if (!checkWindowPassword(WindowRules))
|
||||
return;
|
||||
|
||||
if (!m_policiesWindow) {
|
||||
setupPoliciesWindow();
|
||||
if (!m_rulesWindow) {
|
||||
setupRulesWindow();
|
||||
}
|
||||
|
||||
showWindow(m_policiesWindow);
|
||||
showWindow(m_rulesWindow);
|
||||
}
|
||||
|
||||
void WindowManager::closePoliciesWindow()
|
||||
void WindowManager::closeRulesWindow()
|
||||
{
|
||||
if (closeWindow(m_policiesWindow)) {
|
||||
m_policiesWindow = nullptr;
|
||||
if (closeWindow(m_rulesWindow)) {
|
||||
m_rulesWindow = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -554,7 +553,7 @@ void WindowManager::closeAllWindows()
|
||||
closeHomeWindow();
|
||||
closeProgramsWindow();
|
||||
closeOptionsWindow();
|
||||
closePoliciesWindow();
|
||||
closeRulesWindow();
|
||||
closeServicesWindow();
|
||||
closeZonesWindow();
|
||||
closeStatisticsWindow();
|
||||
|
@ -13,9 +13,9 @@ class HomeWindow;
|
||||
class IniUser;
|
||||
class MainWindow;
|
||||
class OptionsWindow;
|
||||
class PoliciesWindow;
|
||||
class ProgramAlertWindow;
|
||||
class ProgramsWindow;
|
||||
class RulesWindow;
|
||||
class ServicesWindow;
|
||||
class StatisticsWindow;
|
||||
class TrayIcon;
|
||||
@ -41,7 +41,7 @@ public:
|
||||
HomeWindow *homeWindow() const { return m_homeWindow; }
|
||||
ProgramsWindow *progWindow() const { return m_progWindow; }
|
||||
ProgramAlertWindow *progAlertWindow() const { return m_progAlertWindow; }
|
||||
PoliciesWindow *policiesWindow() const { return m_policiesWindow; }
|
||||
RulesWindow *rulesWindow() const { return m_rulesWindow; }
|
||||
OptionsWindow *optWindow() const { return m_optWindow; }
|
||||
StatisticsWindow *connWindow() const { return m_statWindow; }
|
||||
ServicesWindow *servicesWindow() const { return m_servicesWindow; }
|
||||
@ -91,8 +91,8 @@ public slots:
|
||||
void closeOptionsWindow();
|
||||
void reloadOptionsWindow(const QString &reason);
|
||||
|
||||
void showPoliciesWindow();
|
||||
void closePoliciesWindow();
|
||||
void showRulesWindow();
|
||||
void closeRulesWindow();
|
||||
|
||||
void showStatisticsWindow();
|
||||
void closeStatisticsWindow();
|
||||
@ -146,7 +146,7 @@ private:
|
||||
void setupProgramsWindow();
|
||||
void setupProgramAlertWindow();
|
||||
void setupOptionsWindow();
|
||||
void setupPoliciesWindow();
|
||||
void setupRulesWindow();
|
||||
void setupServicesWindow();
|
||||
void setupZonesWindow();
|
||||
void setupGraphWindow();
|
||||
@ -184,7 +184,7 @@ private:
|
||||
ProgramsWindow *m_progWindow = nullptr;
|
||||
ProgramAlertWindow *m_progAlertWindow = nullptr;
|
||||
OptionsWindow *m_optWindow = nullptr;
|
||||
PoliciesWindow *m_policiesWindow = nullptr;
|
||||
RulesWindow *m_rulesWindow = nullptr;
|
||||
StatisticsWindow *m_statWindow = nullptr;
|
||||
ServicesWindow *m_servicesWindow = nullptr;
|
||||
ZonesWindow *m_zonesWindow = nullptr;
|
||||
|
@ -6,32 +6,32 @@
|
||||
#include <conf/confmanager.h>
|
||||
#include <util/ioc/ioccontainer.h>
|
||||
|
||||
PolicyListModel::PolicyListModel(Policy::PolicyType policyType, QObject *parent) :
|
||||
RuleListModel::RuleListModel(Policy::PolicyType policyType, QObject *parent) :
|
||||
TableSqlModel(parent), m_policyType(policyType)
|
||||
{
|
||||
}
|
||||
|
||||
ConfManager *PolicyListModel::confManager() const
|
||||
ConfManager *RuleListModel::confManager() const
|
||||
{
|
||||
return IoC<ConfManager>();
|
||||
}
|
||||
|
||||
SqliteDb *PolicyListModel::sqliteDb() const
|
||||
SqliteDb *RuleListModel::sqliteDb() const
|
||||
{
|
||||
return confManager()->sqliteDb();
|
||||
}
|
||||
|
||||
void PolicyListModel::initialize()
|
||||
void RuleListModel::initialize()
|
||||
{
|
||||
connect(confManager(), &ConfManager::confChanged, this, &TableItemModel::reset);
|
||||
}
|
||||
|
||||
int PolicyListModel::columnCount(const QModelIndex &parent) const
|
||||
int RuleListModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
return parent.isValid() ? 0 : 1;
|
||||
}
|
||||
|
||||
QVariant PolicyListModel::data(const QModelIndex &index, int role) const
|
||||
QVariant RuleListModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
@ -50,7 +50,7 @@ QVariant PolicyListModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant PolicyListModel::dataDisplay(const QModelIndex &index) const
|
||||
QVariant RuleListModel::dataDisplay(const QModelIndex &index) const
|
||||
{
|
||||
const int row = index.row();
|
||||
|
||||
@ -59,7 +59,7 @@ QVariant PolicyListModel::dataDisplay(const QModelIndex &index) const
|
||||
return policyRow.name;
|
||||
}
|
||||
|
||||
QVariant PolicyListModel::dataCheckState(const QModelIndex &index) const
|
||||
QVariant RuleListModel::dataCheckState(const QModelIndex &index) const
|
||||
{
|
||||
if (index.column() == 0) {
|
||||
const auto policyRow = policyRowAt(index.row());
|
||||
@ -69,7 +69,7 @@ QVariant PolicyListModel::dataCheckState(const QModelIndex &index) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool PolicyListModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
bool RuleListModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
Q_UNUSED(value);
|
||||
|
||||
@ -85,24 +85,24 @@ bool PolicyListModel::setData(const QModelIndex &index, const QVariant &value, i
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::ItemFlags PolicyListModel::flagIsUserCheckable(const QModelIndex &index) const
|
||||
Qt::ItemFlags RuleListModel::flagIsUserCheckable(const QModelIndex &index) const
|
||||
{
|
||||
return index.column() == 0 ? Qt::ItemIsUserCheckable : Qt::NoItemFlags;
|
||||
}
|
||||
|
||||
const PolicyRow &PolicyListModel::policyRowAt(int row) const
|
||||
const PolicyRow &RuleListModel::policyRowAt(int row) const
|
||||
{
|
||||
updateRowCache(row);
|
||||
|
||||
return m_policyRow;
|
||||
}
|
||||
|
||||
bool PolicyListModel::updateTableRow(int row) const
|
||||
bool RuleListModel::updateTableRow(int row) const
|
||||
{
|
||||
return updatePolicyRow(sql(), { row }, m_policyRow);
|
||||
}
|
||||
|
||||
bool PolicyListModel::updatePolicyRow(
|
||||
bool RuleListModel::updatePolicyRow(
|
||||
const QString &sql, const QVariantList &vars, PolicyRow &policyRow) const
|
||||
{
|
||||
SqliteStmt stmt;
|
||||
@ -119,7 +119,7 @@ bool PolicyListModel::updatePolicyRow(
|
||||
return true;
|
||||
}
|
||||
|
||||
QString PolicyListModel::sqlBase() const
|
||||
QString RuleListModel::sqlBase() const
|
||||
{
|
||||
return "SELECT"
|
||||
" policy_id,"
|
||||
@ -129,12 +129,12 @@ QString PolicyListModel::sqlBase() const
|
||||
" FROM policy t";
|
||||
}
|
||||
|
||||
QString PolicyListModel::sqlWhere() const
|
||||
QString RuleListModel::sqlWhere() const
|
||||
{
|
||||
return QString::fromLatin1(" WHERE t.type = %1").arg(policyType());
|
||||
}
|
||||
|
||||
QString PolicyListModel::sqlOrder() const
|
||||
QString RuleListModel::sqlOrder() const
|
||||
{
|
||||
return " t.name";
|
||||
}
|
||||
|
@ -15,12 +15,12 @@ struct PolicyRow : TableRow, public Policy
|
||||
{
|
||||
};
|
||||
|
||||
class PolicyListModel : public TableSqlModel
|
||||
class RuleListModel : public TableSqlModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PolicyListModel(Policy::PolicyType policyType, QObject *parent = nullptr);
|
||||
explicit RuleListModel(Policy::PolicyType policyType, QObject *parent = nullptr);
|
||||
|
||||
Policy::PolicyType policyType() const { return m_policyType; }
|
||||
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
QString hotKeyHome() const { return valueText("hotKey/home"); }
|
||||
QString hotKeyPrograms() const { return valueText("hotKey/programs"); }
|
||||
QString hotKeyOptions() const { return valueText("hotKey/options"); }
|
||||
QString hotKeyPolicies() const { return valueText("hotKey/policies"); }
|
||||
QString hotKeyRules() const { return valueText("hotKey/rules"); }
|
||||
QString hotKeyStatistics() const { return valueText("hotKey/statistics"); }
|
||||
QString hotKeyGraph() const { return valueText("hotKey/graph"); }
|
||||
QString hotKeyZones() const { return valueText("hotKey/zones"); }
|
||||
@ -119,35 +119,23 @@ public:
|
||||
QByteArray optWindowAppsSplit() const { return valueByteArray("optWindow/appsSplit"); }
|
||||
void setOptWindowAppsSplit(const QByteArray &v) { setValue("optWindow/appsSplit", v); }
|
||||
|
||||
QRect policyWindowGeometry() const { return value("policyWindow/geometry").toRect(); }
|
||||
void setPolicyWindowGeometry(const QRect &v) { setValue("policyWindow/geometry", v); }
|
||||
QRect ruleWindowGeometry() const { return value("ruleWindow/geometry").toRect(); }
|
||||
void setRuleWindowGeometry(const QRect &v) { setValue("ruleWindow/geometry", v); }
|
||||
|
||||
bool policyWindowMaximized() const { return valueBool("policyWindow/maximized"); }
|
||||
void setPolicyWindowMaximized(bool on) { setValue("policyWindow/maximized", on); }
|
||||
bool ruleWindowMaximized() const { return valueBool("ruleWindow/maximized"); }
|
||||
void setRuleWindowMaximized(bool on) { setValue("ruleWindow/maximized", on); }
|
||||
|
||||
QByteArray policyWindowPresetSplit() const
|
||||
{
|
||||
return valueByteArray("policyWindow/presetSplit");
|
||||
}
|
||||
void setPolicyWindowPresetSplit(const QByteArray &v)
|
||||
{
|
||||
setValue("policyWindow/presetSplit", v);
|
||||
}
|
||||
QByteArray ruleWindowPresetSplit() const { return valueByteArray("ruleWindow/presetSplit"); }
|
||||
void setRuleWindowPresetSplit(const QByteArray &v) { setValue("ruleWindow/presetSplit", v); }
|
||||
|
||||
QByteArray policyWindowGlobalSplit() const
|
||||
{
|
||||
return valueByteArray("policyWindow/globalSplit");
|
||||
}
|
||||
void setPolicyWindowGlobalSplit(const QByteArray &v)
|
||||
{
|
||||
setValue("policyWindow/globalSplit", v);
|
||||
}
|
||||
QByteArray ruleWindowGlobalSplit() const { return valueByteArray("ruleWindow/globalSplit"); }
|
||||
void setRuleWindowGlobalSplit(const QByteArray &v) { setValue("ruleWindow/globalSplit", v); }
|
||||
|
||||
QByteArray policyWindowSplit() const { return valueByteArray("policyWindow/split"); }
|
||||
void setPolicyWindowSplit(const QByteArray &v) { setValue("policyWindow/split", v); }
|
||||
QByteArray ruleWindowSplit() const { return valueByteArray("ruleWindow/split"); }
|
||||
void setRuleWindowSplit(const QByteArray &v) { setValue("ruleWindow/split", v); }
|
||||
|
||||
int policyWindowSplitVersion() const { return valueInt("policyWindow/splitVersion"); }
|
||||
void setPolicyWindowSplitVersion(int v) { setValue("policyWindow/splitVersion", v); }
|
||||
int ruleWindowSplitVersion() const { return valueInt("ruleWindow/splitVersion"); }
|
||||
void setRuleWindowSplitVersion(int v) { setValue("ruleWindow/splitVersion", v); }
|
||||
|
||||
QRect serviceWindowGeometry() const { return value("serviceWindow/geometry").toRect(); }
|
||||
void setServiceWindowGeometry(const QRect &v) { setValue("serviceWindow/geometry", v); }
|
||||
|
Loading…
Reference in New Issue
Block a user