| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
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 <ui/plugins/include/plugin_if.h>
24
25 namespace Ui {
26 class PluginIFDemo_Main;
27}
28
32 class PluginIfType
33{
34 public:
40 PluginIfType(const QString &label, const ext_toolbar_item_t &itemType);
41
46 QString label() const;
47
52 ext_toolbar_item_t itemType() const;
53
54 private:
55 QString m_label;
56 ext_toolbar_item_t m_itemType;
57};
58
59
63 class PluginIfTypeModel : public QAbstractListModel
64{
65 Q_OBJECT
66 public:
71 PluginIfTypeModel(QObject *parent = 0);
72
77 void addPluginIfType(const PluginIfType &pluginIfType);
78
84 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
85
92 QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const override;
93
94 private:
95 QList<PluginIfType> m_pluginIfTypes;
96};
97
98
102 class PluginIfTypeSortFilterProxyModel : public QSortFilterProxyModel
103{
104 Q_OBJECT
105 public:
110 PluginIfTypeSortFilterProxyModel(QObject *parent = 0);
111
118 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
119
124 void setFilterElement(ext_toolbar_item_t filterType);
125
126 private:
127 ext_toolbar_item_t m_filterType;
128};
129
130
135 class PluginIFDemo_Main : public QDialog
136{
137 Q_OBJECT
138
139 public:
144 explicit PluginIFDemo_Main(QWidget *parent = 0);
145
149 ~PluginIFDemo_Main();
150
156 void setToolbar(ext_toolbar_t *&toolbar);
157
158 private slots:
163 void on_buttonBox_clicked(QAbstractButton *button);
164
166 void on_btnSendButtonText_clicked();
167
169 void on_btnSendText_clicked();
170
172 void on_btnSendUpdateItem_clicked();
173
179 void on_chkTestCheckbox_stateChanged(int newState);
180
186 void on_tabInterfaceTypes_currentChanged(int newTab);
187
189 void on_btnAddItem_clicked();
190
192 void on_btnRemoveItem_clicked();
193
195 void on_btnSendList_clicked();
196
201 void on_cmbElements_currentTextChanged(const QString &newText);
202
208 void on_lstItems_clicked(const QModelIndex &idx);
209
211 void on_btnEnable_clicked();
212
214 void on_btnDisable_clicked();
215
220 void logChanged(QString message);
221
223 void closeDialog();
224
225 private:
226 Ui::PluginIFDemo_Main *ui;
227
228 PluginIfTypeModel *sourceModel;
229 PluginIfTypeSortFilterProxyModel *proxyModel;
230 QStandardItemModel *listModel;
231 QStandardItemModel *indexModel;
232
233 ext_toolbar_t *_toolbar;
234};
235
236
237#endif /* PLUGINIFDEMO_MAIN_H_ */
238
239/*
240 * Editor modelines
241 *
242 * Local Variables:
243 * c-basic-offset: 4
244 * tab-width: 8
245 * indent-tabs-mode: nil
246 * End:
247 *
248 * ex: set shiftwidth=4 tabstop=8 expandtab:
249 * :indentSize=4:tabSize=8:noTabs=true:
250 */
PluginIFDemo_Main::~PluginIFDemo_Main
~PluginIFDemo_Main()
Destroys the dialog and releases all associated resources.
Definition pluginifdemo_main.cpp:119
PluginIFDemo_Main::setToolbar
void setToolbar(ext_toolbar_t *&toolbar)
Associates an external toolbar with this dialog so that demo actions can drive toolbar state.
Definition pluginifdemo_main.cpp:124
PluginIFDemo_Main::PluginIFDemo_Main
PluginIFDemo_Main(QWidget *parent=0)
Constructs the main demo dialog.
Definition pluginifdemo_main.cpp:93
PluginIfType
Represents a single toolbar item type with an associated display label.
Definition pluginifdemo_main.h:33
PluginIfType::label
QString label() const
Returns the display label for this item type.
Definition pluginifdemo_main.cpp:28
PluginIfType::PluginIfType
PluginIfType(const QString &label, const ext_toolbar_item_t &itemType)
Constructs a PluginIfType with the given label and toolbar item type.
Definition pluginifdemo_main.cpp:24
PluginIfType::itemType
ext_toolbar_item_t itemType() const
Returns the toolbar item type constant for this entry.
Definition pluginifdemo_main.cpp:29
PluginIfTypeModel
List model that exposes a collection of PluginIfType entries to Qt views.
Definition pluginifdemo_main.h:64
PluginIfTypeModel::data
QVariant data(const QModelIndex &idx, int role=Qt::DisplayRole) const override
Returns data for the given index and role.
Definition pluginifdemo_main.cpp:48
PluginIfTypeModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows (entries) in the model.
Definition pluginifdemo_main.cpp:43
PluginIfTypeModel::addPluginIfType
void addPluginIfType(const PluginIfType &pluginIfType)
Appends a PluginIfType entry to the model.
Definition pluginifdemo_main.cpp:36
PluginIfTypeModel::PluginIfTypeModel
PluginIfTypeModel(QObject *parent=0)
Constructs an empty PluginIfTypeModel.
Definition pluginifdemo_main.cpp:31
PluginIfTypeSortFilterProxyModel
Sort/filter proxy that restricts a PluginIfTypeModel to a single item type.
Definition pluginifdemo_main.h:103
PluginIfTypeSortFilterProxyModel::setFilterElement
void setFilterElement(ext_toolbar_item_t filterType)
Sets the item type to filter on; only rows matching this type will be shown.
Definition pluginifdemo_main.cpp:70
PluginIfTypeSortFilterProxyModel::filterAcceptsRow
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
Determines whether the given source row should be included in the filtered view.
Definition pluginifdemo_main.cpp:83
PluginIfTypeSortFilterProxyModel::PluginIfTypeSortFilterProxyModel
PluginIfTypeSortFilterProxyModel(QObject *parent=0)
Constructs the proxy model with no active filter.
Definition pluginifdemo_main.cpp:64
plugin_if.h
ext_toolbar_t
struct _ext_toolbar_t ext_toolbar_t
Represents a node in the plugin-registered toolbar tree (bar or item).
ext_toolbar_item_t
ext_toolbar_item_t
Specifies the widget type for a toolbar control item.
Definition plugin_if.h:114