Kerberos: add kerberos_inject_longterm_key() helper function
[wireshark-sm.git] / ui / qt / extcap_argument.h
blobd9e852d7a235b0a73edaf949f8d6f4e0d0a9b85d
1 /** @file
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
10 #ifndef UI_QT_EXTCAP_ARGUMENT_H_
11 #define UI_QT_EXTCAP_ARGUMENT_H_
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>
24 #include <extcap_parser.h>
26 #define EXTCAP_GUI_BLANK_LABEL "QLabel { color : ; }"
27 #define EXTCAP_GUI_ERROR_LABEL "QLabel { color : red; }"
29 class ExtcapValue;
31 typedef QList<ExtcapValue> ExtcapValueList;
33 class ExtcapValue
35 public:
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();
41 void setChildren(ExtcapValueList children);
42 ExtcapValueList children()
44 if (_children.length() == 0)
45 return ExtcapValueList();
46 return _children;
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; }
54 int depth() { return _depth; }
56 private:
57 QString _value;
58 QString _call;
60 bool _enabled;
61 bool _isDefault;
63 int _depth;
65 ExtcapValueList _children;
70 class ExtcapArgument: public QObject
72 Q_OBJECT
74 public:
75 ExtcapArgument(QObject *parent = Q_NULLPTR);
76 ExtcapArgument(extcap_arg * argument, QObject *parent = Q_NULLPTR);
77 ExtcapArgument(const ExtcapArgument &obj);
78 virtual ~ExtcapArgument();
80 virtual QWidget * createLabel(QWidget * parent = 0);
81 virtual QWidget * createEditor(QWidget * parent = 0);
83 virtual extcap_arg * argument() { return _argument; }
84 virtual QString call();
85 virtual QString value();
86 virtual QString defaultValue();
88 bool isDefault();
89 virtual bool isValid();
90 bool isRequired();
91 bool reload();
93 QString prefKey(const QString & device_name);
94 virtual QString prefValue();
96 void resetValue();
98 virtual QString group() const;
99 virtual int argNr() const;
101 static ExtcapArgument * create(extcap_arg * argument = Q_NULLPTR, QObject * parent = Q_NULLPTR);
102 virtual bool isSetDefaultValueSupported();
104 public Q_SLOTS:
105 virtual void setDefaultValue();
107 Q_SIGNALS:
108 void valueChanged();
110 protected:
112 bool fileExists();
114 ExtcapValueList loadValues(QString parent);
115 bool reloadValues();
117 ExtcapValueList values;
119 extcap_arg * _argument;
120 QLabel * _label;
121 int _number;
123 const QString label_style;
125 private Q_SLOTS:
127 void onStringChanged(QString);
128 void onIntChanged(int);
129 void onBoolChanged(bool);
135 class ExtArgText : public ExtcapArgument
137 Q_OBJECT
139 public:
140 ExtArgText(extcap_arg * argument, QObject *parent = Q_NULLPTR);
142 virtual QWidget * createEditor(QWidget * parent);
143 virtual QString value();
144 virtual bool isValid();
145 virtual bool isSetDefaultValueSupported();
147 public Q_SLOTS:
148 virtual void setDefaultValue();
150 protected:
152 QLineEdit * textBox;
157 class ExtArgNumber : public ExtArgText
159 Q_OBJECT
161 public:
162 ExtArgNumber(extcap_arg * argument, QObject *parent = Q_NULLPTR);
164 virtual QWidget * createEditor(QWidget * parent);
165 virtual QString defaultValue();
170 class ExtArgSelector : public ExtcapArgument
172 Q_OBJECT
174 public:
175 ExtArgSelector(extcap_arg * argument, QObject *parent = Q_NULLPTR);
177 virtual QWidget * createEditor(QWidget * parent);
178 virtual QString value();
179 virtual bool isValid();
180 virtual bool isSetDefaultValueSupported();
182 public Q_SLOTS:
183 virtual void setDefaultValue();
185 protected:
186 QComboBox * boxSelection;
188 private Q_SLOTS:
189 void onReloadTriggered();
194 class ExtArgEditSelector : public ExtArgSelector
196 Q_OBJECT
198 public:
199 ExtArgEditSelector(extcap_arg * argument, QObject *parent = Q_NULLPTR);
200 virtual QWidget * createEditor(QWidget * parent);
201 virtual QString value();
203 public Q_SLOTS:
204 virtual void setDefaultValue();
208 class ExtArgRadio : public ExtcapArgument
210 Q_OBJECT
212 public:
213 ExtArgRadio(extcap_arg * argument, QObject *parent = Q_NULLPTR);
214 virtual ~ExtArgRadio();
216 virtual QWidget * createEditor(QWidget * parent);
217 virtual QString value();
218 virtual bool isValid();
219 virtual bool isSetDefaultValueSupported();
221 public Q_SLOTS:
222 virtual void setDefaultValue();
224 private:
226 QButtonGroup * selectorGroup;
227 QList<QString> * callStrings;
232 class ExtArgBool : public ExtcapArgument
234 Q_OBJECT
236 public:
237 ExtArgBool(extcap_arg * argument, QObject *parent = Q_NULLPTR);
239 virtual QWidget * createLabel(QWidget * parent);
240 virtual QWidget * createEditor(QWidget * parent);
242 virtual QString call();
243 virtual QString value();
244 virtual bool isValid();
245 virtual QString defaultValue();
246 virtual QString prefValue();
247 virtual bool isSetDefaultValueSupported();
249 public Q_SLOTS:
250 virtual void setDefaultValue();
252 private:
254 QCheckBox * boolBox;
256 bool defaultBool();
261 class ExtArgTimestamp : public ExtcapArgument
263 Q_OBJECT
265 public:
266 ExtArgTimestamp(extcap_arg * argument, QObject *parent = Q_NULLPTR);
267 virtual QWidget * createEditor(QWidget * parent);
269 virtual bool isValid();
270 virtual QString defaultValue();
271 virtual QString value();
272 virtual QString prefValue();
273 virtual bool isSetDefaultValueSupported();
275 public Q_SLOTS:
276 virtual void setDefaultValue();
278 private Q_SLOTS:
279 void onDateTimeChanged(QDateTime);
281 private:
282 QDateTime ts;
283 QDateTimeEdit *tsBox;
286 #endif /* UI_QT_EXTCAP_ARGUMENT_H_ */