summaryrefslogtreecommitdiff
path: root/ui/qt/capture_filter_syntax_worker.cpp
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-01-07 09:27:13 -0800
committerGerald Combs <gerald@wireshark.org>2016-01-08 17:53:28 +0000
commit0ce9ac4137429ce4d632c1cddd48ef6f36d9d4c2 (patch)
tree49811f182cf5b45d924f2864895860bcb142f173 /ui/qt/capture_filter_syntax_worker.cpp
parent35a79ffebb1dfa89b92a84482cf7326fddbe6fba (diff)
downloadwireshark-0ce9ac4137429ce4d632c1cddd48ef6f36d9d4c2.tar.gz
Add a Busy status to SyntaxLineEdit.
For CaptureFilterEdit it's possible to have an indeterminate state while we're waiting on name resolution. Add a Busy status to SyntaxLineEdit and set the text color to a mix of the normal foreground and background colors (gray on most platforms). Make the Busy state valid so that we don't have to wait on an annoyingly-long name resolution to start capturing. Update the global capture option filters using the main welcome capture filter when we start a capture instead of when we've finished checking the filter syntax. Connect the CaptureFilterEdit returnPressed signal no matter what so that we can start a capture by pressing return in the welcome screen CaptureFilterEdit. Add a fake resolution timeout to the CaptureFilterSyntaxWorker debug code to make testing the different states easier. Bug: 11950 Change-Id: I0cf01c0fbc0dd8065cdf5a91f1d6b224291b1ce6 Reviewed-on: https://code.wireshark.org/review/13110 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/capture_filter_syntax_worker.cpp')
-rw-r--r--ui/qt/capture_filter_syntax_worker.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/ui/qt/capture_filter_syntax_worker.cpp b/ui/qt/capture_filter_syntax_worker.cpp
index e38e0e05c9..29cf4c1452 100644
--- a/ui/qt/capture_filter_syntax_worker.cpp
+++ b/ui/qt/capture_filter_syntax_worker.cpp
@@ -44,8 +44,10 @@ static QMutex pcap_compile_mtx_;
#include <QDebug>
#include <QThread>
#define DEBUG_SYNTAX_CHECK(state1, state2) qDebug() << "CF state" << QThread::currentThreadId() << state1 << "->" << state2 << ":" << filter_text_ << ":" << filter
+#define DEBUG_SLEEP_TIME 5000 // ms
#else
#define DEBUG_SYNTAX_CHECK(state1, state2)
+#define DEBUG_SLEEP_TIME 0 // ms
#endif
#define DUMMY_SNAPLENGTH 65535
@@ -102,6 +104,10 @@ void CaptureFilterSyntaxWorker::start() {
pc_err = pcap_compile(pd, &fcode, filter.toUtf8().constData(), 1 /* Do optimize */, 0);
#endif
+#if DEBUG_SLEEP_TIME > 0
+ QThread::msleep(DEBUG_SLEEP_TIME);
+#endif
+
if (pc_err) {
DEBUG_SYNTAX_CHECK("unknown", "known bad");
state = SyntaxLineEdit::Invalid;