mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:35:08 +00:00
UI: Move managers from util/ to manager/.
This commit is contained in:
parent
064b154b52
commit
78fe8b943f
@ -13,10 +13,10 @@
|
||||
#include <log/logbuffer.h>
|
||||
#include <log/logentryblockedip.h>
|
||||
#include <log/logentrytime.h>
|
||||
#include <manager/envmanager.h>
|
||||
#include <util/conf/confappswalker.h>
|
||||
#include <util/conf/confutil.h>
|
||||
#include <util/device.h>
|
||||
#include <util/envmanager.h>
|
||||
#include <util/fileutil.h>
|
||||
#include <util/net/netutil.h>
|
||||
#include <util/osutil.h>
|
||||
|
@ -9,9 +9,9 @@
|
||||
#include <conf/firewallconf.h>
|
||||
#include <driver/drivercommon.h>
|
||||
#include <log/logentryblockedip.h>
|
||||
#include <manager/envmanager.h>
|
||||
#include <util/conf/confappswalker.h>
|
||||
#include <util/conf/confutil.h>
|
||||
#include <util/envmanager.h>
|
||||
#include <util/fileutil.h>
|
||||
#include <util/net/netutil.h>
|
||||
|
||||
|
@ -81,6 +81,12 @@ SOURCES += \
|
||||
log/logentrystattraf.cpp \
|
||||
log/logentrytime.cpp \
|
||||
log/logmanager.cpp \
|
||||
manager/envmanager.cpp \
|
||||
manager/hotkeymanager.cpp \
|
||||
manager/logger.cpp \
|
||||
manager/nativeeventfilter.cpp \
|
||||
manager/serviceinfomanager.cpp \
|
||||
manager/translationmanager.cpp \
|
||||
model/applistmodel.cpp \
|
||||
model/appstatmodel.cpp \
|
||||
model/connlistmodel.cpp \
|
||||
@ -110,28 +116,23 @@ SOURCES += \
|
||||
task/taskupdatechecker.cpp \
|
||||
task/taskworker.cpp \
|
||||
task/taskzonedownloader.cpp \
|
||||
translationmanager.cpp \
|
||||
user/iniuser.cpp \
|
||||
user/usersettings.cpp \
|
||||
util/conf/addressrange.cpp \
|
||||
util/conf/confutil.cpp \
|
||||
util/dateutil.cpp \
|
||||
util/device.cpp \
|
||||
util/envmanager.cpp \
|
||||
util/fileutil.cpp \
|
||||
util/guiutil.cpp \
|
||||
util/hotkeymanager.cpp \
|
||||
util/iconcache.cpp \
|
||||
util/ini/mapsettings.cpp \
|
||||
util/ini/settings.cpp \
|
||||
util/ioc/ioccontainer.cpp \
|
||||
util/json/jsonutil.cpp \
|
||||
util/json/mapwrapper.cpp \
|
||||
util/logger.cpp \
|
||||
util/model/stringlistmodel.cpp \
|
||||
util/model/tableitemmodel.cpp \
|
||||
util/model/tablesqlmodel.cpp \
|
||||
util/nativeeventfilter.cpp \
|
||||
util/net/hostinfo.cpp \
|
||||
util/net/hostinfocache.cpp \
|
||||
util/net/hostinfojob.cpp \
|
||||
@ -229,6 +230,12 @@ HEADERS += \
|
||||
log/logentrystattraf.h \
|
||||
log/logentrytime.h \
|
||||
log/logmanager.h \
|
||||
manager/envmanager.h \
|
||||
manager/hotkeymanager.h \
|
||||
manager/logger.h \
|
||||
manager/nativeeventfilter.h \
|
||||
manager/serviceinfomanager.h \
|
||||
manager/translationmanager.h \
|
||||
model/applistmodel.h \
|
||||
model/appstatmodel.h \
|
||||
model/connlistmodel.h \
|
||||
@ -258,7 +265,6 @@ HEADERS += \
|
||||
task/taskupdatechecker.h \
|
||||
task/taskworker.h \
|
||||
task/taskzonedownloader.h \
|
||||
translationmanager.h \
|
||||
user/iniuser.h \
|
||||
user/usersettings.h \
|
||||
util/classhelpers.h \
|
||||
@ -267,10 +273,8 @@ HEADERS += \
|
||||
util/conf/confutil.h \
|
||||
util/dateutil.h \
|
||||
util/device.h \
|
||||
util/envmanager.h \
|
||||
util/fileutil.h \
|
||||
util/guiutil.h \
|
||||
util/hotkeymanager.h \
|
||||
util/iconcache.h \
|
||||
util/ini/mapsettings.h \
|
||||
util/ini/settings.h \
|
||||
@ -278,11 +282,9 @@ HEADERS += \
|
||||
util/ioc/iocservice.h \
|
||||
util/json/jsonutil.h \
|
||||
util/json/mapwrapper.h \
|
||||
util/logger.h \
|
||||
util/model/stringlistmodel.h \
|
||||
util/model/tableitemmodel.h \
|
||||
util/model/tablesqlmodel.h \
|
||||
util/nativeeventfilter.h \
|
||||
util/net/hostinfo.h \
|
||||
util/net/hostinfocache.h \
|
||||
util/net/hostinfojob.h \
|
||||
|
@ -11,13 +11,13 @@
|
||||
#include "../fortmanager.h"
|
||||
#include "../fortsettings.h"
|
||||
#include "../log/logentryblocked.h"
|
||||
#include "../manager/envmanager.h"
|
||||
#include "../task/taskinfo.h"
|
||||
#include "../task/taskmanager.h"
|
||||
#include "../user/iniuser.h"
|
||||
#include "../user/usersettings.h"
|
||||
#include "../util/conf/confutil.h"
|
||||
#include "../util/dateutil.h"
|
||||
#include "../util/envmanager.h"
|
||||
#include "../util/fileutil.h"
|
||||
#include "../util/ioc/ioccontainer.h"
|
||||
#include "../util/osutil.h"
|
||||
|
@ -5,9 +5,9 @@
|
||||
#include "../../driver/drivermanager.h"
|
||||
#include "../../fortmanager.h"
|
||||
#include "../../fortsettings.h"
|
||||
#include "../../manager/translationmanager.h"
|
||||
#include "../../model/zonelistmodel.h"
|
||||
#include "../../task/taskmanager.h"
|
||||
#include "../../translationmanager.h"
|
||||
#include "../../util/ioc/ioccontainer.h"
|
||||
|
||||
OptionsController::OptionsController(QObject *parent) : QObject(parent)
|
||||
|
@ -17,9 +17,9 @@
|
||||
#include "../../../driver/drivermanager.h"
|
||||
#include "../../../fortmanager.h"
|
||||
#include "../../../fortsettings.h"
|
||||
#include "../../../manager/translationmanager.h"
|
||||
#include "../../../task/taskinfoupdatechecker.h"
|
||||
#include "../../../task/taskmanager.h"
|
||||
#include "../../../translationmanager.h"
|
||||
#include "../../../user/iniuser.h"
|
||||
#include "../../../util/iconcache.h"
|
||||
#include "../../../util/osutil.h"
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "../../conf/confmanager.h"
|
||||
#include "../../conf/firewallconf.h"
|
||||
#include "../../fortmanager.h"
|
||||
#include "../../manager/translationmanager.h"
|
||||
#include "../../model/applistmodel.h"
|
||||
#include "../../translationmanager.h"
|
||||
#include "../../util/ioc/ioccontainer.h"
|
||||
|
||||
ProgramsController::ProgramsController(QObject *parent) :
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "../../conf/confmanager.h"
|
||||
#include "../../conf/firewallconf.h"
|
||||
#include "../../fortmanager.h"
|
||||
#include "../../translationmanager.h"
|
||||
#include "../../manager/translationmanager.h"
|
||||
#include "../../util/ioc/ioccontainer.h"
|
||||
|
||||
StatisticsController::StatisticsController(QObject *parent) : QObject(parent)
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "../../conf/firewallconf.h"
|
||||
#include "../../fortmanager.h"
|
||||
#include "../../fortsettings.h"
|
||||
#include "../../translationmanager.h"
|
||||
#include "../../util/hotkeymanager.h"
|
||||
#include "../../manager/hotkeymanager.h"
|
||||
#include "../../manager/translationmanager.h"
|
||||
#include "../../util/ioc/ioccontainer.h"
|
||||
|
||||
TrayController::TrayController(QObject *parent) : QObject(parent)
|
||||
|
@ -10,9 +10,9 @@
|
||||
#include "../../conf/firewallconf.h"
|
||||
#include "../../fortmanager.h"
|
||||
#include "../../fortsettings.h"
|
||||
#include "../../manager/hotkeymanager.h"
|
||||
#include "../../user/iniuser.h"
|
||||
#include "../../util/guiutil.h"
|
||||
#include "../../util/hotkeymanager.h"
|
||||
#include "../../util/iconcache.h"
|
||||
#include "../controls/mainwindow.h"
|
||||
#include "traycontroller.h"
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include "../../conf/confmanager.h"
|
||||
#include "../../conf/firewallconf.h"
|
||||
#include "../../fortmanager.h"
|
||||
#include "../../manager/translationmanager.h"
|
||||
#include "../../model/zonelistmodel.h"
|
||||
#include "../../task/taskmanager.h"
|
||||
#include "../../translationmanager.h"
|
||||
#include "../../util/ioc/ioccontainer.h"
|
||||
|
||||
ZonesController::ZonesController(QObject *parent) : QObject(parent)
|
||||
|
@ -24,6 +24,11 @@
|
||||
#include "form/zone/zoneswindow.h"
|
||||
#include "fortcompat.h"
|
||||
#include "fortsettings.h"
|
||||
#include "manager/envmanager.h"
|
||||
#include "manager/hotkeymanager.h"
|
||||
#include "manager/logger.h"
|
||||
#include "manager/nativeeventfilter.h"
|
||||
#include "manager/translationmanager.h"
|
||||
#include "model/applistmodel.h"
|
||||
#include "model/zonelistmodel.h"
|
||||
#include "rpc/appinfomanagerrpc.h"
|
||||
@ -35,15 +40,10 @@
|
||||
#include "rpc/statmanagerrpc.h"
|
||||
#include "rpc/taskmanagerrpc.h"
|
||||
#include "task/taskinfozonedownloader.h"
|
||||
#include "translationmanager.h"
|
||||
#include "user/usersettings.h"
|
||||
#include "util/dateutil.h"
|
||||
#include "util/envmanager.h"
|
||||
#include "util/fileutil.h"
|
||||
#include "util/hotkeymanager.h"
|
||||
#include "util/ioc/ioccontainer.h"
|
||||
#include "util/logger.h"
|
||||
#include "util/nativeeventfilter.h"
|
||||
#include "util/net/hostinfocache.h"
|
||||
#include "util/osutil.h"
|
||||
#include "util/startuputil.h"
|
||||
|
@ -6,8 +6,8 @@
|
||||
#include <fort_version.h>
|
||||
|
||||
#include "conf/firewallconf.h"
|
||||
#include "manager/envmanager.h"
|
||||
#include "util/dateutil.h"
|
||||
#include "util/envmanager.h"
|
||||
#include "util/fileutil.h"
|
||||
#include "util/osutil.h"
|
||||
#include "util/startuputil.h"
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
|
||||
#include "fileutil.h"
|
||||
#include "../util/fileutil.h"
|
||||
|
||||
EnvManager::EnvManager(QObject *parent) : QObject(parent)
|
||||
{
|
@ -3,9 +3,9 @@
|
||||
#include <QAction>
|
||||
#include <QKeySequence>
|
||||
|
||||
#include "ioc/ioccontainer.h"
|
||||
#include "../util/ioc/ioccontainer.h"
|
||||
#include "../util/osutil.h"
|
||||
#include "nativeeventfilter.h"
|
||||
#include "osutil.h"
|
||||
|
||||
HotKeyManager::HotKeyManager(QObject *parent) : QObject(parent) { }
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QAction>
|
||||
#include <QList>
|
||||
|
||||
#include "ioc/iocservice.h"
|
||||
#include "../util/ioc/iocservice.h"
|
||||
|
||||
class NativeEventFilter;
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include <fort_version.h>
|
||||
|
||||
#include "dateutil.h"
|
||||
#include "fileutil.h"
|
||||
#include "../util/dateutil.h"
|
||||
#include "../util/fileutil.h"
|
||||
|
||||
namespace {
|
||||
|
@ -5,8 +5,8 @@
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
|
||||
#include "classhelpers.h"
|
||||
#include "ioc/iocservice.h"
|
||||
#include "../util/classhelpers.h"
|
||||
#include "../util/ioc/iocservice.h"
|
||||
|
||||
class NativeEventFilter : public QObject, public QAbstractNativeEventFilter, public IocService
|
||||
{
|
||||
@ -38,8 +38,6 @@ signals:
|
||||
void environmentChanged();
|
||||
void sessionLocked();
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
void setKeyId(int hotKeyId, quint32 nativeMod, quint32 nativeKey);
|
||||
void removeKeyId(int hotKeyId);
|
3
src/ui/manager/serviceinfomanager.cpp
Normal file
3
src/ui/manager/serviceinfomanager.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include "serviceinfomanager.h"
|
||||
|
||||
ServiceInfoManager::ServiceInfoManager(QObject *parent) : QObject(parent) { }
|
14
src/ui/manager/serviceinfomanager.h
Normal file
14
src/ui/manager/serviceinfomanager.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef SERVICEINFOMANAGER_H
|
||||
#define SERVICEINFOMANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class ServiceInfoManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ServiceInfoManager(QObject *parent = nullptr);
|
||||
};
|
||||
|
||||
#endif // SERVICEINFOMANAGER_H
|
@ -6,8 +6,8 @@
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
|
||||
#include "util/classhelpers.h"
|
||||
#include "util/ioc/iocservice.h"
|
||||
#include "../util/classhelpers.h"
|
||||
#include "../util/ioc/iocservice.h"
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QTranslator)
|
||||
|
@ -1,3 +1,83 @@
|
||||
#include "servicelistmodel.h"
|
||||
|
||||
ServiceListModel::ServiceListModel(QObject *parent) : QObject(parent) { }
|
||||
#include "../conf/appgroup.h"
|
||||
#include "../conf/confmanager.h"
|
||||
#include "../conf/firewallconf.h"
|
||||
#include "../util/ioc/ioccontainer.h"
|
||||
|
||||
ServiceListModel::ServiceListModel(QObject *parent) : TableItemModel(parent) { }
|
||||
|
||||
ConfManager *ServiceListModel::confManager() const
|
||||
{
|
||||
return IoC<ConfManager>();
|
||||
}
|
||||
|
||||
FirewallConf *ServiceListModel::conf() const
|
||||
{
|
||||
return confManager()->conf();
|
||||
}
|
||||
|
||||
int ServiceListModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
|
||||
return m_services.size();
|
||||
}
|
||||
|
||||
int ServiceListModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
return parent.isValid() ? 0 : 3;
|
||||
}
|
||||
|
||||
QVariant ServiceListModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (orientation == Qt::Horizontal && (role == Qt::DisplayRole || role == Qt::ToolTipRole)) {
|
||||
switch (section) {
|
||||
case 0:
|
||||
return tr("Service Name");
|
||||
case 1:
|
||||
return tr("Display Name");
|
||||
case 2:
|
||||
return tr("Group");
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant ServiceListModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::DisplayRole || role == Qt::ToolTipRole) {
|
||||
const int row = index.row();
|
||||
const int column = index.column();
|
||||
|
||||
const auto info = serviceInfoAt(row);
|
||||
|
||||
switch (column) {
|
||||
case 0:
|
||||
return info.serviceName;
|
||||
case 1:
|
||||
return info.displayName;
|
||||
case 2:
|
||||
return conf()->appGroupAt(info.groupIndex)->name();
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool ServiceListModel::updateTableRow(int /*row*/) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const ServiceInfo &ServiceListModel::serviceInfoAt(int index) const
|
||||
{
|
||||
if (index < 0 || index >= m_services.size()) {
|
||||
static const ServiceInfo g_nullServiceInfo;
|
||||
return g_nullServiceInfo;
|
||||
}
|
||||
return m_services[index];
|
||||
}
|
||||
|
@ -1,14 +1,50 @@
|
||||
#ifndef SERVICELISTMODEL_H
|
||||
#define SERVICELISTMODEL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
|
||||
class ServiceListModel : public QObject
|
||||
#include "../util/model/tableitemmodel.h"
|
||||
|
||||
class ConfManager;
|
||||
class FirewallConf;
|
||||
|
||||
struct ServiceInfo
|
||||
{
|
||||
int groupIndex = 0;
|
||||
|
||||
quint64 id = 0;
|
||||
|
||||
QString serviceName;
|
||||
QString displayName;
|
||||
};
|
||||
|
||||
class ServiceListModel : public TableItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ServiceListModel(QObject *parent = nullptr);
|
||||
|
||||
ConfManager *confManager() const;
|
||||
FirewallConf *conf() const;
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant headerData(
|
||||
int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
protected:
|
||||
bool updateTableRow(int row) const override;
|
||||
TableRow &tableRow() const override { return m_serviceRow; }
|
||||
|
||||
const ServiceInfo &serviceInfoAt(int index) const;
|
||||
|
||||
private:
|
||||
QVector<ServiceInfo> m_services;
|
||||
|
||||
mutable TableRow m_serviceRow;
|
||||
};
|
||||
|
||||
#endif // SERVICELISTMODEL_H
|
||||
|
@ -10,21 +10,6 @@
|
||||
|
||||
TrafListModel::TrafListModel(QObject *parent) : TableItemModel(parent) { }
|
||||
|
||||
void TrafListModel::setUnit(TrafListModel::TrafUnit unit)
|
||||
{
|
||||
m_unit = unit;
|
||||
}
|
||||
|
||||
void TrafListModel::setType(TrafListModel::TrafType type)
|
||||
{
|
||||
m_type = type;
|
||||
}
|
||||
|
||||
void TrafListModel::setAppId(qint64 appId)
|
||||
{
|
||||
m_appId = appId;
|
||||
}
|
||||
|
||||
StatManager *TrafListModel::statManager() const
|
||||
{
|
||||
return IoC<StatManager>();
|
||||
|
@ -26,13 +26,13 @@ public:
|
||||
explicit TrafListModel(QObject *parent = nullptr);
|
||||
|
||||
TrafListModel::TrafUnit unit() const { return m_unit; }
|
||||
void setUnit(TrafListModel::TrafUnit unit);
|
||||
void setUnit(TrafListModel::TrafUnit unit) { m_unit = unit; }
|
||||
|
||||
TrafListModel::TrafType type() const { return m_type; }
|
||||
void setType(TrafListModel::TrafType type);
|
||||
void setType(TrafListModel::TrafType type) { m_type = type; }
|
||||
|
||||
qint64 appId() const { return m_appId; }
|
||||
void setAppId(qint64 appId);
|
||||
void setAppId(qint64 appId) { m_appId = appId; }
|
||||
|
||||
StatManager *statManager() const;
|
||||
|
||||
|
@ -9,12 +9,12 @@
|
||||
#include "../../conf/appgroup.h"
|
||||
#include "../../conf/firewallconf.h"
|
||||
#include "../../driver/drivercommon.h"
|
||||
#include "../../util/conf/confappswalker.h"
|
||||
#include "../../manager/envmanager.h"
|
||||
#include "../dateutil.h"
|
||||
#include "../envmanager.h"
|
||||
#include "../fileutil.h"
|
||||
#include "../net/ip4range.h"
|
||||
#include "../stringutil.h"
|
||||
#include "confappswalker.h"
|
||||
|
||||
#define APP_GROUP_MAX FORT_CONF_GROUP_MAX
|
||||
#define APP_GROUP_NAME_MAX 128
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "driver/drivercommon.h"
|
||||
#include "fortmanager.h"
|
||||
#include "fortsettings.h"
|
||||
#include "util/envmanager.h"
|
||||
#include "manager/envmanager.h"
|
||||
#include "util/fileutil.h"
|
||||
#include "util/ioc/ioccontainer.h"
|
||||
#include "util/osutil.h"
|
||||
|
Loading…
Reference in New Issue
Block a user