Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
pluginifdemo_main.h
1/* pluginifdemo_main.h
2 *
3 * Author: Roland Knall <[email protected]>
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <[email protected]>
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
24
25namespace Ui {
27}
28
33{
34public:
40 PluginIfType(const QString &label, const ext_toolbar_item_t &itemType);
41
46 QString label() const;
47
53
54private:
55 QString m_label;
56 ext_toolbar_item_t m_itemType;
57};
58
59
63class PluginIfTypeModel : public QAbstractListModel
64{
65 Q_OBJECT
66public:
71 PluginIfTypeModel(QObject *parent = 0);
72
77 void addPluginIfType(const PluginIfType &pluginIfType);
78
84 int rowCount(const QModelIndex &parent = QModelIndex()) const;
85
92 QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const;
93
94private:
95 QList<PluginIfType> m_pluginIfTypes;
96};
97
98
102class PluginIfTypeSortFilterProxyModel : public QSortFilterProxyModel
103{
104 Q_OBJECT
105public:
110 PluginIfTypeSortFilterProxyModel(QObject *parent = 0);
111
118 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
119
124 void setFilterElement(ext_toolbar_item_t filterType);
125
126private:
127 ext_toolbar_item_t m_filterType;
128};
129
130
135class PluginIFDemo_Main : public QDialog
136{
137 Q_OBJECT
138
139public:
144 explicit PluginIFDemo_Main(QWidget *parent = 0);
145
150
156 void setToolbar(ext_toolbar_t *&toolbar);
157
158private 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
225private:
226 Ui::PluginIFDemo_Main *ui;
228 PluginIfTypeModel *sourceModel;
230 QStandardItemModel *listModel;
231 QStandardItemModel *indexModel;
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 */
Main dialog for the Plugin Interface Demo, providing interactive controls for exercising all ext_tool...
Definition pluginifdemo_main.h:136
~PluginIFDemo_Main()
Destroys the dialog and releases all associated resources.
Definition pluginifdemo_main.cpp:119
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
Represents a single toolbar item type with an associated display label.
Definition pluginifdemo_main.h:33
QString label() const
Returns the display label for this item type.
Definition pluginifdemo_main.cpp:28
ext_toolbar_item_t itemType() const
Returns the toolbar item type constant for this entry.
Definition pluginifdemo_main.cpp:29
List model that exposes a collection of PluginIfType entries to Qt views.
Definition pluginifdemo_main.h:64
int rowCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of rows (entries) in the model.
Definition pluginifdemo_main.cpp:43
QVariant data(const QModelIndex &idx, int role=Qt::DisplayRole) const
Returns data for the given index and role.
Definition pluginifdemo_main.cpp:48
void addPluginIfType(const PluginIfType &pluginIfType)
Appends a PluginIfType entry to the model.
Definition pluginifdemo_main.cpp:36
Sort/filter proxy that restricts a PluginIfTypeModel to a single item type.
Definition pluginifdemo_main.h:103
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
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
Determines whether the given source row should be included in the filtered view.
Definition pluginifdemo_main.cpp:83
ext_toolbar_item_t
Specifies the widget type for a toolbar control item.
Definition plugin_if.h:114
Represents a node in the plugin-registered toolbar tree (bar or item).
Definition plugin_if.h:135