Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
extcap_argument.h
Go to the documentation of this file.
1
10#ifndef UI_QT_EXTCAP_ARGUMENT_H_
11#define UI_QT_EXTCAP_ARGUMENT_H_
12
13#include <QObject>
14#include <QWidget>
15#include <QLabel>
16#include <QVariant>
17#include <QList>
18#include <QLineEdit>
19#include <QComboBox>
20#include <QButtonGroup>
21#include <QCheckBox>
22#include <QDateTime>
23
24#include <extcap_parser.h>
25
26#define EXTCAP_GUI_BLANK_LABEL "QLabel { color : ; }"
27#define EXTCAP_GUI_ERROR_LABEL "QLabel { color : red; }"
28
29class ExtcapValue;
30
31typedef QList<ExtcapValue> ExtcapValueList;
32
34{
35public:
36 ExtcapValue(QString value, QString call, bool enabled, bool isDefault) :
37 _value(value), _call(call), _enabled(enabled),
38 _isDefault(isDefault), _depth(0) {}
39 virtual ~ExtcapValue();
40
41 void setChildren(ExtcapValueList children);
42 ExtcapValueList children()
43 {
44 if (_children.length() == 0)
45 return ExtcapValueList();
46 return _children;
47 }
48
49 QString value() const { return _value; }
50 const QString call() const { return _call; }
51 bool enabled() const { return _enabled; }
52 bool isDefault() const { return _isDefault; }
53
54 int depth() { return _depth; }
55
56private:
57 QString _value;
58 QString _call;
59
60 bool _enabled;
61 bool _isDefault;
62
63 int _depth;
64
65 ExtcapValueList _children;
66};
67
68
69
70class ExtcapArgument: public QObject
71{
72 Q_OBJECT
73
74public:
75 ExtcapArgument(QObject *parent = Q_NULLPTR);
76 ExtcapArgument(extcap_arg * argument, QObject *parent = Q_NULLPTR);
78 virtual ~ExtcapArgument();
79
80 virtual QWidget * createLabel(QWidget * parent = 0);
81 virtual QWidget * createEditor(QWidget * parent = 0);
82
83 virtual extcap_arg * argument() { return _argument; }
84 virtual QString call();
85 virtual QString value();
86 virtual QString defaultValue();
87
88 bool isDefault();
89 virtual bool isValid();
90 bool isRequired();
91 bool reload();
92
93 QString prefKey(const QString & device_name);
94 virtual QString prefValue();
95
96 void resetValue();
97
98 virtual QString group() const;
99 virtual int argNr() const;
100
101 static ExtcapArgument * create(extcap_arg * argument = Q_NULLPTR, QObject * parent = Q_NULLPTR);
102 virtual bool isSetDefaultValueSupported();
103
104public Q_SLOTS:
105 virtual void setDefaultValue();
106
107Q_SIGNALS:
108 void valueChanged();
109
110protected:
111
112 bool fileExists();
113
114 ExtcapValueList loadValues(QString parent);
115 bool reloadValues();
116
117 ExtcapValueList values;
118
119 extcap_arg * _argument;
120 QLabel * _label;
121 int _number;
122
123 const QString label_style;
124
125private Q_SLOTS:
126
127 void onStringChanged(QString);
128 void onIntChanged(int);
129 void onBoolChanged(bool);
130
131};
132
133
134
136{
137 Q_OBJECT
138
139public:
140 ExtArgText(extcap_arg * argument, QObject *parent = Q_NULLPTR);
141
142 virtual QWidget * createEditor(QWidget * parent);
143 virtual QString value();
144 virtual bool isValid();
145 virtual bool isSetDefaultValueSupported();
146
147public Q_SLOTS:
148 virtual void setDefaultValue();
149
150protected:
151
152 QLineEdit * textBox;
153};
154
155
156
158{
159 Q_OBJECT
160
161public:
162 ExtArgNumber(extcap_arg * argument, QObject *parent = Q_NULLPTR);
163
164 virtual QWidget * createEditor(QWidget * parent);
165 virtual QString defaultValue();
166};
167
168
169
171{
172 Q_OBJECT
173
174public:
175 ExtArgSelector(extcap_arg * argument, QObject *parent = Q_NULLPTR);
176
177 virtual QWidget * createEditor(QWidget * parent);
178 virtual QString value();
179 virtual bool isValid();
180 virtual bool isSetDefaultValueSupported();
181
182public Q_SLOTS:
183 virtual void setDefaultValue();
184
185protected:
186 QComboBox * boxSelection;
187
188private Q_SLOTS:
189 void onReloadTriggered();
190
191};
192
193
195{
196 Q_OBJECT
197
198public:
199 ExtArgEditSelector(extcap_arg * argument, QObject *parent = Q_NULLPTR);
200 virtual QWidget * createEditor(QWidget * parent);
201 virtual QString value();
202
203public Q_SLOTS:
204 virtual void setDefaultValue();
205};
206
207
209{
210 Q_OBJECT
211
212public:
213 ExtArgRadio(extcap_arg * argument, QObject *parent = Q_NULLPTR);
214 virtual ~ExtArgRadio();
215
216 virtual QWidget * createEditor(QWidget * parent);
217 virtual QString value();
218 virtual bool isValid();
219 virtual bool isSetDefaultValueSupported();
220
221public Q_SLOTS:
222 virtual void setDefaultValue();
223
224private:
225
226 QButtonGroup * selectorGroup;
227 QList<QString> * callStrings;
228};
229
230
231
233{
234 Q_OBJECT
235
236public:
237 ExtArgBool(extcap_arg * argument, QObject *parent = Q_NULLPTR);
238
239 virtual QWidget * createLabel(QWidget * parent);
240 virtual QWidget * createEditor(QWidget * parent);
241
242 virtual QString call();
243 virtual QString value();
244 virtual bool isValid();
245 virtual QString defaultValue();
246 virtual QString prefValue();
247 virtual bool isSetDefaultValueSupported();
248
249public Q_SLOTS:
250 virtual void setDefaultValue();
251
252private:
253
254 QCheckBox * boolBox;
255
256 bool defaultBool();
257};
258
259
260
262{
263 Q_OBJECT
264
265public:
266 ExtArgTimestamp(extcap_arg * argument, QObject *parent = Q_NULLPTR);
267 virtual QWidget * createEditor(QWidget * parent);
268
269 virtual bool isValid();
270 virtual QString defaultValue();
271 virtual QString value();
272 virtual QString prefValue();
273 virtual bool isSetDefaultValueSupported();
274
275public Q_SLOTS:
276 virtual void setDefaultValue();
277
278private Q_SLOTS:
279 void onDateTimeChanged(QDateTime);
280
281private:
282 QDateTime ts;
283 QDateTimeEdit *tsBox;
284};
285
286#endif /* UI_QT_EXTCAP_ARGUMENT_H_ */
Definition extcap_argument.h:233
Definition extcap_argument.h:195
Definition extcap_argument.h:158
Definition extcap_argument.h:209
Definition extcap_argument.h:171
Definition extcap_argument.h:136
Definition extcap_argument.h:262
Definition extcap_argument.h:71
Definition extcap_argument.h:34
Definition extcap_parser.h:100