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 void onBoolChanged(bool);
107 void onIntChanged(int);
108 void onStringChanged(QString);
109
110Q_SIGNALS:
111 void valueChanged();
112
113protected:
114
115 bool fileExists();
116
117 ExtcapValueList loadValues(QString parent);
118 bool reloadValues();
119
120 ExtcapValueList values;
121
122 extcap_arg * _argument;
123 QLabel * _label;
124 int _number;
125
126 const QString label_style;
127};
128
129
130
132{
133 Q_OBJECT
134
135public:
136 ExtArgText(extcap_arg * argument, QObject *parent = Q_NULLPTR);
137
138 virtual QWidget * createEditor(QWidget * parent);
139 virtual QString value();
140 virtual bool isValid();
141 virtual bool isSetDefaultValueSupported();
142
143public Q_SLOTS:
144 virtual void setDefaultValue();
145
146protected:
147
148 QLineEdit * textBox;
149};
150
151
152
154{
155 Q_OBJECT
156
157public:
158 ExtArgNumber(extcap_arg * argument, QObject *parent = Q_NULLPTR);
159
160 virtual QWidget * createEditor(QWidget * parent);
161 virtual QString defaultValue();
162};
163
164
165
167{
168 Q_OBJECT
169
170public:
171 ExtArgSelector(extcap_arg * argument, QObject *parent = Q_NULLPTR);
172
173 virtual QWidget * createEditor(QWidget * parent);
174 virtual QString value();
175 virtual bool isValid();
176 virtual bool isSetDefaultValueSupported();
177
178public Q_SLOTS:
179 virtual void setDefaultValue();
180
181protected:
182 QComboBox * boxSelection;
183
184private Q_SLOTS:
185 void onReloadTriggered();
186
187};
188
189
191{
192 Q_OBJECT
193
194public:
195 ExtArgEditSelector(extcap_arg * argument, QObject *parent = Q_NULLPTR);
196 virtual QWidget * createEditor(QWidget * parent);
197 virtual QString value();
198
199public Q_SLOTS:
200 virtual void setDefaultValue();
201};
202
203
205{
206 Q_OBJECT
207
208public:
209 ExtArgRadio(extcap_arg * argument, QObject *parent = Q_NULLPTR);
210 virtual ~ExtArgRadio();
211
212 virtual QWidget * createEditor(QWidget * parent);
213 virtual QString value();
214 virtual bool isValid();
215 virtual bool isSetDefaultValueSupported();
216
217public Q_SLOTS:
218 virtual void setDefaultValue();
219
220private:
221
222 QButtonGroup * selectorGroup;
223 QList<QString> * callStrings;
224};
225
226
227
229{
230 Q_OBJECT
231
232public:
233 ExtArgBool(extcap_arg * argument, QObject *parent = Q_NULLPTR);
234
235 virtual QWidget * createLabel(QWidget * parent);
236 virtual QWidget * createEditor(QWidget * parent);
237
238 virtual QString call();
239 virtual QString value();
240 virtual bool isValid();
241 virtual QString defaultValue();
242 virtual QString prefValue();
243 virtual bool isSetDefaultValueSupported();
244
245public Q_SLOTS:
246 virtual void setDefaultValue();
247
248private:
249
250 QCheckBox * boolBox;
251
252 bool defaultBool();
253};
254
255
256
258{
259 Q_OBJECT
260
261public:
262 ExtArgTimestamp(extcap_arg * argument, QObject *parent = Q_NULLPTR);
263 virtual QWidget * createEditor(QWidget * parent);
264
265 virtual bool isValid();
266 virtual QString defaultValue();
267 virtual QString value();
268 virtual QString prefValue();
269 virtual bool isSetDefaultValueSupported();
270
271public Q_SLOTS:
272 virtual void setDefaultValue();
273
274private Q_SLOTS:
275 void onDateTimeChanged(QDateTime);
276
277private:
278 QDateTime ts;
279 QDateTimeEdit *tsBox;
280};
281
282#endif /* UI_QT_EXTCAP_ARGUMENT_H_ */
Definition extcap_argument.h:229
Definition extcap_argument.h:191
Definition extcap_argument.h:154
Definition extcap_argument.h:205
Definition extcap_argument.h:167
Definition extcap_argument.h:132
Definition extcap_argument.h:258
Definition extcap_argument.h:71
Definition extcap_argument.h:34
Definition extcap_parser.h:100