diff options
author | Gerald Combs <gerald@wireshark.org> | 2016-01-07 09:27:13 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2016-01-08 17:53:28 +0000 |
commit | 0ce9ac4137429ce4d632c1cddd48ef6f36d9d4c2 (patch) | |
tree | 49811f182cf5b45d924f2864895860bcb142f173 /ui/qt/syntax_line_edit.cpp | |
parent | 35a79ffebb1dfa89b92a84482cf7326fddbe6fba (diff) | |
download | wireshark-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/syntax_line_edit.cpp')
-rw-r--r-- | ui/qt/syntax_line_edit.cpp | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/ui/qt/syntax_line_edit.cpp b/ui/qt/syntax_line_edit.cpp index 3d0e6e2cde..ce898b8f58 100644 --- a/ui/qt/syntax_line_edit.cpp +++ b/ui/qt/syntax_line_edit.cpp @@ -39,6 +39,10 @@ #include <QStringListModel> #include <limits> +// To do: +// - Add indicator icons for syntax states to make things more clear for +// color blind people? + const int max_completion_items_ = 20; SyntaxLineEdit::SyntaxLineEdit(QWidget *parent) : @@ -46,6 +50,13 @@ SyntaxLineEdit::SyntaxLineEdit(QWidget *parent) : completer_(NULL), completion_model_(NULL) { + // Try to matche QLineEdit's placeholder text color (which sets the + // alpha channel to 50%, which doesn't work in style sheets). + // Setting the foreground color lets us avoid yet another background + // color preference and should hopefully make things easier to + // distinguish for color blind folk. + busy_fg_ = ColorUtils::alphaBlend(palette().text(), palette().base(), 0.5); + setSyntaxState(); setMaxLength(std::numeric_limits<quint32>::max()); } @@ -75,27 +86,41 @@ void SyntaxLineEdit::setSyntaxState(SyntaxState state) { syntax_state_ = state; state_style_sheet_ = QString( "SyntaxLineEdit[syntaxState=\"%1\"] {" - " color: %4;" - " background-color: %5;" + " color: %5;" + " background-color: %7;" "}" "SyntaxLineEdit[syntaxState=\"%2\"] {" - " color: %4;" - " background-color: %6;" + " color: %5;" + " background-color: %8;" "}" "SyntaxLineEdit[syntaxState=\"%3\"] {" - " color: %4;" - " background-color: %7;" + " color: %5;" + " background-color: %9;" + "}" + + "SyntaxLineEdit[syntaxState=\"%4\"] {" + " color: %10;" + " background-color: %6;" "}" ) + + // CSS selectors .arg(Valid) .arg(Invalid) .arg(Deprecated) - .arg("palette(text)") // Foreground - .arg(ColorUtils::fromColorT(&prefs.gui_text_valid).name()) // Valid - .arg(ColorUtils::fromColorT(&prefs.gui_text_invalid).name()) // Invalid - .arg(ColorUtils::fromColorT(&prefs.gui_text_deprecated).name()) // Deprecated + .arg(Busy) + + // Normal foreground / background + .arg("palette(text)") + .arg("palette(base)") + + // Special foreground / background + .arg(ColorUtils::fromColorT(&prefs.gui_text_valid).name()) + .arg(ColorUtils::fromColorT(&prefs.gui_text_invalid).name()) + .arg(ColorUtils::fromColorT(&prefs.gui_text_deprecated).name()) + .arg(busy_fg_.name()) ; setStyleSheet(style_sheet_); } |