Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
supported_protocols_model.h
Go to the documentation of this file.
1
10#ifndef SUPPORTED_PROTOCOLS_MODEL_H
11#define SUPPORTED_PROTOCOLS_MODEL_H
12
13#include <config.h>
14
16
17#include <epan/proto.h>
18
19#include <QSortFilterProxyModel>
20
21class SupportedProtocolsItem : public ModelHelperTreeItem<SupportedProtocolsItem>
22{
23public:
24 SupportedProtocolsItem(protocol_t* proto, const char *name, const char* filter, ftenum_t ftype, const char* descr, SupportedProtocolsItem* parent);
26
27 protocol_t* protocol() const {return proto_; }
28 QString name() const { return name_; }
29 ftenum_t type() const {return ftype_; }
30 QString filter() const { return filter_; }
31 QString description() const { return descr_; }
32
33private:
34 protocol_t* proto_;
35 QString name_;
36 QString filter_;
37 ftenum_t ftype_;
38 QString descr_;
39};
40
41
42class SupportedProtocolsModel : public QAbstractItemModel
43{
44 Q_OBJECT
45
46public:
47 explicit SupportedProtocolsModel(QObject * parent = Q_NULLPTR);
49
50 enum SupportedProtocolsColumn {
51 colName = 0,
52 colFilter,
53 colType,
54 colDescription,
55 colLast
56 };
57
58 int fieldCount() {return field_count_;}
59
60 QModelIndex index(int row, int column,
61 const QModelIndex & = QModelIndex()) const;
62 QModelIndex parent(const QModelIndex &) const;
63 QVariant data(const QModelIndex &index, int role) const;
64
65 QVariant headerData(int section, Qt::Orientation orientation,
66 int role = Qt::DisplayRole) const;
67
68 int rowCount(const QModelIndex &parent = QModelIndex()) const;
69 int columnCount(const QModelIndex &parent = QModelIndex()) const;
70
71 void populate();
72
73private:
75 int field_count_;
76};
77
78class SupportedProtocolsProxyModel : public QSortFilterProxyModel
79{
80public:
81
82 explicit SupportedProtocolsProxyModel(QObject * parent = Q_NULLPTR);
83
84 virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
85
86 void setFilter(const QString& filter);
87
88protected:
89 bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const;
90 bool filterAcceptItem(SupportedProtocolsItem& item) const;
91
92private:
93
94 QString filter_;
95};
96
97#endif // SUPPORTED_PROTOCOLS_MODEL_H
Definition tree_model_helpers.h:23
Definition supported_protocols_model.h:22
Definition supported_protocols_model.h:43
Definition supported_protocols_model.h:79
Definition proto.c:382