Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
traffic_types_list.h
Go to the documentation of this file.
1
10#ifndef TRAFFIC_TYPES_LIST_H
11#define TRAFFIC_TYPES_LIST_H
12
13#include "config.h"
14
15#include <QTreeView>
16#include <QAbstractListModel>
17#include <QMap>
18#include <QList>
19#include <QString>
20#include <QSortFilterProxyModel>
21
23{
24
25public:
26 TrafficTypesRowData(int protocol, QString name);
27
28 int protocol() const;
29 QString name() const;
30 bool checked() const;
31 void setChecked(bool checked);
32
33private:
34 int _protocol;
35 QString _name;
36 bool _checked;
37};
38
39
40class TrafficTypesModel : public QAbstractListModel
41{
42 Q_OBJECT
43public:
44
45 enum {
46 TRAFFIC_PROTOCOL = Qt::UserRole,
47 TRAFFIC_IS_CHECKED,
48 } eTrafficUserData;
49
50 enum {
51 COL_CHECKED,
52 COL_NAME,
53 COL_NUM,
54 COL_PROTOCOL,
55 } eTrafficColumnNames;
56
57 TrafficTypesModel(GList ** recentList, QObject *parent = nullptr);
58
59 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
60 virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
61 virtual QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const override;
62 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
63
64 virtual bool setData(const QModelIndex &idx, const QVariant &value, int role) override;
65 virtual Qt::ItemFlags flags (const QModelIndex & idx) const override;
66
67 QList<int> protocols() const;
68
69public slots:
70 void selectProtocols(QList<int> protocols);
71
72signals:
73 void protocolsChanged(QList<int> protocols);
74
75private:
76 QList<TrafficTypesRowData> _allTaps;
77 GList ** _recentList;
78
79};
80
81
82class TrafficListSortModel : public QSortFilterProxyModel
83{
84 Q_OBJECT
85public:
86 TrafficListSortModel(QObject * parent = nullptr);
87
88 void setFilter(QString filter = QString());
89
90protected:
91 virtual bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
92 virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
93
94private:
95 QString _filter;
96};
97
98
99class TrafficTypesList : public QTreeView
100{
101 Q_OBJECT
102public:
103
104 TrafficTypesList(QWidget *parent = nullptr);
105
106 void setProtocolInfo(QString name, GList ** recentList);
107 QList<int> protocols(bool onlySelected = false) const;
108
109public slots:
110 void selectProtocols(QList<int> protocols);
111 void filterList(QString);
112
113signals:
114 void protocolsChanged(QList<int> protocols);
115 void clearFilterList();
116
117private:
118 QString _name;
119 TrafficTypesModel * _model;
120 TrafficListSortModel * _sortModel;
121};
122
123#endif // TRAFFIC_TYPES_LIST_H
Definition traffic_types_list.h:83
Definition traffic_types_list.h:100
Definition traffic_types_list.h:41
Definition traffic_types_list.h:23
Definition proto.c:375