diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-11-16 11:00:32 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-11-16 19:01:12 +0000 |
commit | e9dd7c8bd42cbb25ca92dde3cee0383db6c20705 (patch) | |
tree | 11d493ea7b67e728c41632bcb6d0163bbae59f2b /ui/qt/display_filter_edit.cpp | |
parent | 92d487a461414c9b797130e5b845488164c984cd (diff) |
Label the filter in the file open dialog as a "read filter".
This matches what the Windows file open dialog says, and also should
help prevent people thinking that it's a display filter, so that you can
clear it and see all the packets in the file.
I leave translations to native speakers.
Bug: 11708
Change-Id: I060816357bf7958d516429d09708a7ce16d609c5
Reviewed-on: https://code.wireshark.org/review/11877
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/qt/display_filter_edit.cpp')
-rw-r--r-- | ui/qt/display_filter_edit.cpp | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/ui/qt/display_filter_edit.cpp b/ui/qt/display_filter_edit.cpp index 16360856cb..4d55502571 100644 --- a/ui/qt/display_filter_edit.cpp +++ b/ui/qt/display_filter_edit.cpp @@ -95,9 +95,9 @@ UIMiniCancelButton::UIMiniCancelButton(QWidget *pParent /* = 0 */) // proto.c:fld_abbrev_chars static const QString fld_abbrev_chars_ = "-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"; -DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) : +DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, DisplayFilterEditType type) : SyntaxLineEdit(parent), - plain_(plain), + type_(type), bookmark_button_(NULL), clear_button_(NULL), apply_button_(NULL) @@ -108,24 +108,16 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) : setCompleter(new QCompleter(completion_model_, this)); setCompletionTokenChars(fld_abbrev_chars_); - if (plain_) { - placeholder_text_ = QString(tr("Enter a display filter %1")).arg(UTF8_HORIZONTAL_ELLIPSIS); - } else { - placeholder_text_ = QString(tr("Apply a display filter %1 <%2/>")).arg(UTF8_HORIZONTAL_ELLIPSIS) - .arg(DEFAULT_MODIFIER); - } -#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) - setPlaceholderText(placeholder_text_); -#endif + setDefaultPlaceholderText(); // DFCombo // Bookmark - // DispalyFilterEdit + // DisplayFilterEdit // Clear button // Apply (right arrow) // Combo drop-down - if (!plain_) { + if (type_ == DisplayFilterToApply) { bookmark_button_ = new StockIconToolButton(this, "x-filter-bookmark"); bookmark_button_->setCursor(Qt::ArrowCursor); bookmark_button_->setMenu(new QMenu()); @@ -142,7 +134,7 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) : ); } - if (!plain_) { + if (type_ == DisplayFilterToApply) { clear_button_ = new StockIconToolButton(this, "x-filter-clear"); clear_button_->setCursor(Qt::ArrowCursor); clear_button_->setToolTip(QString()); @@ -160,7 +152,7 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) : connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(checkFilter(const QString&))); - if (!plain_) { + if (type_ == DisplayFilterToApply) { apply_button_ = new StockIconToolButton(this, "x-filter-apply"); apply_button_->setCursor(Qt::ArrowCursor); apply_button_->setEnabled(false); @@ -204,6 +196,28 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) : checkFilter(); } +void DisplayFilterEdit::setDefaultPlaceholderText() +{ + switch (type_) { + + case DisplayFilterToApply: + placeholder_text_ = QString(tr("Apply a display filter %1 <%2/>")).arg(UTF8_HORIZONTAL_ELLIPSIS) + .arg(DEFAULT_MODIFIER); + break; + + case DisplayFilterToEnter: + placeholder_text_ = QString(tr("Enter a display filter %1")).arg(UTF8_HORIZONTAL_ELLIPSIS); + break; + + case ReadFilterToApply: + placeholder_text_ = QString(tr("Apply a read filter %1")).arg(UTF8_HORIZONTAL_ELLIPSIS); + break; + } +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + setPlaceholderText(placeholder_text_); +#endif +} + void DisplayFilterEdit::paintEvent(QPaintEvent *evt) { SyntaxLineEdit::paintEvent(evt); @@ -498,16 +512,7 @@ void DisplayFilterEdit::changeEvent(QEvent* event) switch (event->type()) { case QEvent::LanguageChange: - if (plain_) { - placeholder_text_ = QString(tr("Enter a display filter %1")). - arg(UTF8_HORIZONTAL_ELLIPSIS); - } else { - placeholder_text_ = QString(tr("Apply a display filter %1 <%2/>")) - .arg(UTF8_HORIZONTAL_ELLIPSIS).arg(DEFAULT_MODIFIER); - } -#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) - setPlaceholderText(placeholder_text_); -#endif + setDefaultPlaceholderText(); break; default: break; |