diff options
author | Roland Knall <roland.knall@br-automation.com> | 2015-12-29 15:35:43 +0100 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2016-01-05 14:41:12 +0000 |
commit | cfd5457ec0575be3b1b8726daf95fdc4da0e50fb (patch) | |
tree | fe3ff5d04d5f0c8d077831b3fb9135ae9520960e /ui/qt/extcap_argument.h | |
parent | a7e3ba03ce6eaeebc762322cb1691adeeda46ff8 (diff) |
extcap: Add regular expression validation support
Regular expressions follow the Qt Regex syntax, which is
formulated after the Perl Regex syntax. A more detailed
overview of the possible rules can be found at:
http://doc.qt.io/qt-4.8/qregexp.html
If a required option is present, even the double-click on
the interface will first start the options dialog (Qt only)
Required fields are marked bold and put first in the dialog.
Additionally if validation failes (which it will if a required
field is kept empty, but also if a non-required textfield is
violating the defined regex), the label of the field is marked
with red.
Change-Id: If04a1146d0dfa778332ab2a39122c7a6ee1e93d2
Reviewed-on: https://code.wireshark.org/review/12914
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'ui/qt/extcap_argument.h')
-rw-r--r-- | ui/qt/extcap_argument.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/ui/qt/extcap_argument.h b/ui/qt/extcap_argument.h index 9287628a7c..017a163378 100644 --- a/ui/qt/extcap_argument.h +++ b/ui/qt/extcap_argument.h @@ -27,9 +27,16 @@ #include <QLabel> #include <QVariant> #include <QList> +#include <QLineEdit> +#include <QComboBox> +#include <QButtonGroup> +#include <QCheckBox> #include <extcap_parser.h> +#define EXTCAP_GUI_BLANK_LABEL "QLabel { color : ; }" +#define EXTCAP_GUI_ERROR_LABEL "QLabel { color : red; }" + class ExtcapValue; typedef QList<ExtcapValue> ExtcapValueList; @@ -108,6 +115,9 @@ protected: extcap_arg * _argument; QVariant * _default; + QWidget * _label; + + const QString label_style; private Q_SLOTS: @@ -117,6 +127,78 @@ private Q_SLOTS: }; +class ExtArgText : public ExtcapArgument +{ + +public: + ExtArgText(extcap_arg * argument); + + virtual QWidget * createEditor(QWidget * parent); + virtual QString value(); + virtual bool isValid(); + virtual QString defaultValue(); + +protected: + + QLineEdit * textBox; +}; + +class ExtArgNumber : public ExtArgText +{ +public: + ExtArgNumber(extcap_arg * argument); + + virtual QWidget * createEditor(QWidget * parent); + virtual QString defaultValue(); +}; + +class ExtArgSelector : public ExtcapArgument +{ +public: + ExtArgSelector(extcap_arg * argument); + + virtual QWidget * createEditor(QWidget * parent); + virtual QString value(); + virtual bool isValid(); + +private: + + QComboBox * boxSelection; +}; + +class ExtArgRadio : public ExtcapArgument +{ +public: + ExtArgRadio(extcap_arg * argument); + + virtual QWidget * createEditor(QWidget * parent); + virtual QString value(); + virtual bool isValid(); + +private: + + QButtonGroup * selectorGroup; + QList<QString> * callStrings; +}; + +class ExtArgBool : public ExtcapArgument +{ +public: + ExtArgBool(extcap_arg * argument); + + virtual QWidget * createLabel(QWidget * parent); + virtual QWidget * createEditor(QWidget * parent); + + virtual QString call(); + virtual QString value(); + virtual bool isValid(); + virtual QString defaultValue(); + +private: + + QCheckBox * boolBox; +}; + #endif /* UI_QT_EXTCAP_ARGUMENT_H_ */ /* |