| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
extcap_argument_multiselect.h
Go to the documentation of this file.
1
9
10#ifndef UI_QT_EXTCAP_ARGUMENT_MULTISELECT_H_
11#define UI_QT_EXTCAP_ARGUMENT_MULTISELECT_H_
12
13#include <QObject>
14#include <QWidget>
15#include <QStandardItem>
16#include <QTreeView>
17#include <QAbstractItemModel>
18#include <QItemSelection>
19#include <QLineEdit>
20#include <QPushButton>
21#include <QAction>
22#include <QTableView>
23#include <QToolBar>
24#include <QDialog>
25#include <QMap>
26#include <QSortFilterProxyModel>
27
28#include <extcap_parser.h>
29#include <extcap_argument.h>
30
31#include "extcap_options_dialog.h"
32
36 class TreeSortFilterProxyModel : public QSortFilterProxyModel
37{
38 public:
45 bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
46
50 using QSortFilterProxyModel::QSortFilterProxyModel;
51};
52
56 class ExtArgMultiSelect : public ExtcapArgument
57{
58 Q_OBJECT
59 public:
65 ExtArgMultiSelect(extcap_arg * argument, QObject *parent = Q_NULLPTR);
66
70 virtual ~ExtArgMultiSelect();
71
76 virtual QString value() override;
77
82 virtual bool isValid() override;
83
88 virtual QString defaultValue() override;
89
94 virtual bool isSetDefaultValueSupported() override;
95
96 public Q_SLOTS:
100 virtual void setDefaultValue() override;
101
102 protected:
109 virtual QList<QStandardItem *> valueWalker(ExtcapValueList list, QStringList &defaults);
110
116 void checkItemsWalker(QStandardItem * item, QStringList defaults);
117
123 virtual QWidget * createEditor(QWidget * parent) override;
124
129 virtual QStringList checkedValues();
130
132 QStandardItemModel* viewModel;
133
135 QMap<QString, QString> displayNames;
136
137 private:
139 QTreeView * treeView;
140};
141
145 class ExtArgTable : public ExtArgMultiSelect
146{
147 Q_OBJECT
148
149 public:
155 ExtArgTable(extcap_arg* argument, QObject* parent = Q_NULLPTR);
156
160 virtual ~ExtArgTable();
161
166 virtual QString value() override;
167
168 public Q_SLOTS:
172 virtual void setDefaultValue() override;
173
174 protected:
180 virtual QWidget* createEditor(QWidget* parent) override;
181
185 void addKnown();
186
190 void addCustom();
191
195 void removeSelected();
196
202 void addChecked(QStringList checked, QStringList options);
203
209 virtual void showExtcapOptionsDialogForOptionValue(QStandardItem* item, QString& option_value);
210
215 virtual void extcap_options_finished(QStandardItem* item);
216
217 private:
219 ExtcapOptionsDialog* extcap_options_dialog;
220
222 QDialog* addDialog;
223
225 QStandardItemModel* tableViewModel;
226
228 QTableView* tableView;
229
231 QVBoxLayout* paneLayout;
232
234 QToolBar* toolbar;
235};
236
240 class ExtArgTableAddDialog : public QDialog
241{
242 Q_OBJECT
243
244 public:
250 ExtArgTableAddDialog(QWidget* parent, QWidget* selector);
251};
252
253#endif /* UI_QT_EXTCAP_ARGUMENT_MULTISELECT_H_ */
ExtArgMultiSelect::valueWalker
virtual QList< QStandardItem * > valueWalker(ExtcapValueList list, QStringList &defaults)
Traverses the value list to create standard items.
Definition extcap_argument_multiselect.cpp:40
ExtArgMultiSelect::~ExtArgMultiSelect
virtual ~ExtArgMultiSelect()
Destroys the ExtArgMultiSelect.
Definition extcap_argument_multiselect.cpp:35
ExtArgMultiSelect::value
virtual QString value() override
Retrieves the currently selected values.
Definition extcap_argument_multiselect.cpp:205
ExtArgMultiSelect::isSetDefaultValueSupported
virtual bool isSetDefaultValueSupported() override
Checks if setting default values is supported.
Definition extcap_argument_multiselect.cpp:242
ExtArgMultiSelect::viewModel
QStandardItemModel * viewModel
Definition extcap_argument_multiselect.h:132
ExtArgMultiSelect::checkItemsWalker
void checkItemsWalker(QStandardItem *item, QStringList defaults)
Traverses and checks items recursively based on default values.
Definition extcap_argument_multiselect.cpp:78
ExtArgMultiSelect::ExtArgMultiSelect
ExtArgMultiSelect(extcap_arg *argument, QObject *parent=Q_NULLPTR)
Constructs an ExtArgMultiSelect.
Definition extcap_argument_multiselect.cpp:32
ExtArgMultiSelect::defaultValue
virtual QString defaultValue() override
Retrieves the default values for the selector.
Definition extcap_argument_multiselect.cpp:232
ExtArgMultiSelect::isValid
virtual bool isValid() override
Checks if the current selection is valid.
Definition extcap_argument_multiselect.cpp:210
ExtArgMultiSelect::checkedValues
virtual QStringList checkedValues()
Retrieves a list of all currently checked values.
Definition extcap_argument_multiselect.cpp:182
ExtArgMultiSelect::displayNames
QMap< QString, QString > displayNames
Definition extcap_argument_multiselect.h:135
ExtArgMultiSelect::createEditor
virtual QWidget * createEditor(QWidget *parent) override
Creates the editor widget for the multi-select argument.
Definition extcap_argument_multiselect.cpp:111
ExtArgMultiSelect::setDefaultValue
virtual void setDefaultValue() override
Sets the selector to its default values.
Definition extcap_argument_multiselect.cpp:247
ExtArgTableAddDialog::ExtArgTableAddDialog
ExtArgTableAddDialog(QWidget *parent, QWidget *selector)
Constructs a new ExtArgTableAddDialog.
Definition extcap_argument_multiselect.cpp:275
ExtArgTable::showExtcapOptionsDialogForOptionValue
virtual void showExtcapOptionsDialogForOptionValue(QStandardItem *item, QString &option_value)
Displays the extcap options dialog for a specific item.
Definition extcap_argument_multiselect.cpp:480
ExtArgTable::~ExtArgTable
virtual ~ExtArgTable()
Destroys the ExtArgTable.
Definition extcap_argument_multiselect.cpp:262
ExtArgTable::ExtArgTable
ExtArgTable(extcap_arg *argument, QObject *parent=Q_NULLPTR)
Constructs an ExtArgTable.
Definition extcap_argument_multiselect.cpp:259
ExtArgTable::addCustom
void addCustom()
Opens a dialog to add a custom entry to the table.
Definition extcap_argument_multiselect.cpp:452
ExtArgTable::extcap_options_finished
virtual void extcap_options_finished(QStandardItem *item)
Handles the completion of the extcap options dialog.
Definition extcap_argument_multiselect.cpp:521
ExtArgTable::addChecked
void addChecked(QStringList checked, QStringList options)
Adds a list of checked items to the table.
Definition extcap_argument_multiselect.cpp:374
ExtArgTable::value
virtual QString value() override
Retrieves the serialized string representing the table's values.
Definition extcap_argument_multiselect.cpp:353
ExtArgTable::createEditor
virtual QWidget * createEditor(QWidget *parent) override
Creates the editor widget for the table argument.
Definition extcap_argument_multiselect.cpp:292
ExtArgTable::removeSelected
void removeSelected()
Removes the currently selected entries from the table.
Definition extcap_argument_multiselect.cpp:470
ExtArgTable::setDefaultValue
virtual void setDefaultValue() override
Sets the table to its default state.
Definition extcap_argument_multiselect.cpp:425
ExtArgTable::addKnown
void addKnown()
Adds a known entry to the table.
Definition extcap_argument_multiselect.cpp:437
ExtcapArgument::argument
virtual extcap_arg * argument()
Retrieves the underlying extcap_arg structure.
Definition extcap_argument.h:173
ExtcapArgument::ExtcapArgument
ExtcapArgument(QObject *parent=Q_NULLPTR)
Constructs an empty ExtcapArgument.
Definition extcap_argument.cpp:755
ExtcapOptionsDialog
A dialog for configuring extcap device options.
Definition extcap_options_dialog.h:36
TreeSortFilterProxyModel
A proxy model that filters rows in a tree structure.
Definition extcap_argument_multiselect.h:37
TreeSortFilterProxyModel::filterAcceptsRow
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
Determines if a row from the source model should be included.
Definition extcap_argument_multiselect.cpp:172
extcap_argument.h
extcap_options_dialog.h
extcap_parser.h
extcap_arg
struct _extcap_arg extcap_arg
A fully parsed extcap argument sentence with all its associated options.