-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConnectionModel.h
executable file
·57 lines (48 loc) · 1.36 KB
/
ConnectionModel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef CONNECTIONMODEL_H
#define CONNECTIONMODEL_H
#include <QAbstractTableModel>
#include <QDateTime>
#include <QTimer>
class ConnectionModel : public QAbstractTableModel
{
Q_OBJECT
public:
enum {
HeaderHost,
HeaderUpload,
HeaderDownload,
HeaderChains,
HeaderRule,
HeaderTime,
HeaderSource,
HeaderDestIp,
HeaderType,
HeaderProcess,
HeaderCount
};
explicit ConnectionModel(QObject *parent = nullptr);
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
private:
void sendRequest();
void replyFinished();
private:
struct ConnInfo {
double upload;
double download;
QDateTime start;
QString id;
QString host;
QString chains;
QString rule;
QString process;
QString source;
QString destIp;
QString type;
};
QTimer m_timer;
QVector<ConnInfo> m_connInfos;
};
#endif // CONNECTIONMODEL_H