Wireshark  4.3.0
The Wireshark network protocol analyzer
pluginifdemo_main.h
1 /* pluginifdemo_main.h
2  *
3  * Author: Roland Knall <rknall@gmail.com>
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
12 #ifndef PLUGINIFDEMO_MAIN_H_
13 #define PLUGINIFDEMO_MAIN_H_
14 
15 #include <QWidget>
16 #include <QDialog>
17 #include <QAbstractButton>
18 #include <QListWidget>
19 #include <QAbstractListModel>
20 #include <QSortFilterProxyModel>
21 #include <QStandardItemModel>
22 
23 #include <epan/plugin_if.h>
24 
25 namespace Ui {
26 class PluginIFDemo_Main;
27 }
28 
30 {
31 public:
32  PluginIfType(const QString &label, const ext_toolbar_item_t &itemType);
33 
34  QString label() const;
35  ext_toolbar_item_t itemType() const;
36 private:
37  QString m_label;
38  ext_toolbar_item_t m_itemType;
39 };
40 
41 class PluginIfTypeModel : public QAbstractListModel
42 {
43  Q_OBJECT
44 public:
45  PluginIfTypeModel(QObject * parent = 0);
46 
47  void addPluginIfType(const PluginIfType & pluginIfType);
48 
49  int rowCount(const QModelIndex & parent = QModelIndex()) const;
50  QVariant data(const QModelIndex & idx, int role = Qt::DisplayRole) const;
51 
52 private:
53  QList<PluginIfType> m_pluginIfTypes;
54 
55 };
56 
57 class PluginIfTypeSortFilterProxyModel : public QSortFilterProxyModel
58 {
59  Q_OBJECT
60 public:
61  PluginIfTypeSortFilterProxyModel(QObject * parent = 0);
62 
63  bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
64 
65  void setFilterElement(ext_toolbar_item_t filterType);
66 
67 private:
68  ext_toolbar_item_t m_filterType;
69 };
70 
71 class PluginIFDemo_Main : public QDialog
72 {
73  Q_OBJECT
74 
75 public:
76  explicit PluginIFDemo_Main(QWidget *parent = 0);
78 
79  void setToolbar(ext_toolbar_t * &toolbar);
80 
81 private slots:
82  void on_buttonBox_clicked(QAbstractButton *button);
83  void on_btnSendButtonText_clicked();
84  void on_btnSendText_clicked();
85  void on_btnSendUpdateItem_clicked();
86  void on_chkTestCheckbox_stateChanged(int newState);
87  void on_tabInterfaceTypes_currentChanged(int newTab);
88  void on_btnAddItem_clicked();
89  void on_btnRemoveItem_clicked();
90  void on_btnSendList_clicked();
91  void on_cmbElements_currentTextChanged(const QString & newText);
92  void on_lstItems_clicked(const QModelIndex &idx);
93  void on_btnEnable_clicked();
94  void on_btnDisable_clicked();
95 
96  void logChanged(QString message);
97  void closeDialog();
98 
99 private:
100  Ui::PluginIFDemo_Main *ui;
101 
102  PluginIfTypeModel * sourceModel;
104  QStandardItemModel * listModel;
105  QStandardItemModel * indexModel;
106 
107  ext_toolbar_t * _toolbar;
108 };
109 
110 
111 #endif /* PLUGINIFDEMO_MAIN_H_ */
112 
113 /*
114  * Editor modelines
115  *
116  * Local Variables:
117  * c-basic-offset: 4
118  * tab-width: 8
119  * indent-tabs-mode: nil
120  * End:
121  *
122  * ex: set shiftwidth=4 tabstop=8 expandtab:
123  * :indentSize=4:tabSize=8:noTabs=true:
124  */
Definition: pluginifdemo_main.h:72
Definition: pluginifdemo_main.h:30
Definition: pluginifdemo_main.h:42
Definition: pluginifdemo_main.h:58
Definition: plugin_if.h:101