aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/main_welcome.cpp
diff options
context:
space:
mode:
authorRoland Knall <roland.knall@br-automation.com>2015-12-29 15:35:43 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2016-01-05 14:41:12 +0000
commitcfd5457ec0575be3b1b8726daf95fdc4da0e50fb (patch)
treefe3ff5d04d5f0c8d077831b3fb9135ae9520960e /ui/qt/main_welcome.cpp
parenta7e3ba03ce6eaeebc762322cb1691adeeda46ff8 (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/main_welcome.cpp')
-rw-r--r--ui/qt/main_welcome.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp
index 521c2aa6a9..667fbf582a 100644
--- a/ui/qt/main_welcome.cpp
+++ b/ui/qt/main_welcome.cpp
@@ -53,6 +53,10 @@
#define VERSION_FLAVOR ""
#endif
+#if HAVE_EXTCAP
+#include <extcap.h>
+#endif
+
MainWelcome::MainWelcome(QWidget *parent) :
QFrame(parent),
welcome_ui_(new Ui::MainWelcome),
@@ -230,6 +234,19 @@ void MainWelcome::appInitialized()
void MainWelcome::interfaceDoubleClicked(QTreeWidgetItem *item, int)
{
if (item) {
+#if HAVE_EXTCAP
+ QString extcap_string = QVariant(item->data(IFTREE_COL_EXTCAP, Qt::UserRole)).toString();
+ /* We trust the string here. If this interface is really extcap, the string is
+ * being checked immediatly before the dialog is being generated */
+ if ( extcap_string.length() > 0 ) {
+ QString device_name = QVariant(item->data(IFTREE_COL_NAME, Qt::UserRole)).toString();
+ /* this checks if configuration is required and not yet provided or saved via prefs */
+ if ( extcap_has_configuration((const char *)(device_name.toStdString().c_str()), TRUE ) ) {
+ emit showExtcapOptions(device_name);
+ return;
+ }
+ }
+#endif
emit startCapture();
}
}