diff options
author | Gerald Combs <gerald@wireshark.org> | 2012-12-07 01:46:20 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2012-12-07 01:46:20 +0000 |
commit | 59cd52b5caae3806fbaba984833a8edd2752f2c4 (patch) | |
tree | f886df01065a589edecb4617770e7f599ef396cf /ui/qt/display_filter_edit.cpp | |
parent | 2b240a299b3cf26a5ef52e400588bb2e56d2a57f (diff) |
Implement the items under "Edit→Copy", "Analyze→Apply as Filter" and
"Analyze→Prepare a Filter". Add a context menu to the protocol tree and
fill in the items we've implemented so far.
Add an "applyAllPreferences" method and corresponding
"preferencesUpdated" signal to wsApp. Use it to set the maximum display
filter combo count.
Move the packet filtering code from the display filter edit to the main
window (which makes more sense and matches what we're doing in the GTK+
version and gets rid of more global cfile references). Try to center the
display filter edit button images.
Use a different "close" button in the main toolbar. It looks better but
is still wrong (on OS X at least).
svn path=/trunk/; revision=46434
Diffstat (limited to 'ui/qt/display_filter_edit.cpp')
-rw-r--r-- | ui/qt/display_filter_edit.cpp | 62 |
1 files changed, 19 insertions, 43 deletions
diff --git a/ui/qt/display_filter_edit.cpp b/ui/qt/display_filter_edit.cpp index 48e60a15ac..916d035292 100644 --- a/ui/qt/display_filter_edit.cpp +++ b/ui/qt/display_filter_edit.cpp @@ -88,7 +88,9 @@ UIMiniCancelButton::UIMiniCancelButton(QWidget *pParent /* = 0 */) DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) : SyntaxLineEdit(parent), plain_(plain), - field_name_only_(false) + field_name_only_(false), + apply_button_(NULL) + { setAccessibleName(tr("Display filter entry")); @@ -118,16 +120,16 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) : " border-top-left-radius: 3px;" " border-bottom-left-radius: 3px;" " padding-left: 1px;" - " image: url(:/dfilter/dfilter_bookmark_normal.png);" + " background: palette(base) url(:/dfilter/dfilter_bookmark_normal.png) no-repeat center;" // " background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," // " stop: 0 #f6f7fa, stop: 1 #dadbde);" "}" "QToolButton:hover {" - " image: url(:/dfilter/dfilter_bookmark_hover.png);" + " background: palette(base) url(:/dfilter/dfilter_bookmark_hover.png) no-repeat center;" "}" "QToolButton:pressed {" - " image: url(:/dfilter/dfilter_bookmark_pressed.png);" + " background: palette(base) url(:/dfilter/dfilter_bookmark_pressed.png) no-repeat center;" "}" // "QToolButton:pressed {" @@ -143,39 +145,39 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) : clear_button_->setCursor(Qt::ArrowCursor); clear_button_->setStyleSheet( "QToolButton {" - " image: url(:/dfilter/dfilter_erase_normal.png);" + " background: palette(base) url(:/dfilter/dfilter_erase_normal.png) no-repeat center;" " border: none;" " width: 16px;" "}" "QToolButton:hover {" - " image: url(:/dfilter/dfilter_erase_active.png);" + " background: palette(base) url(:/dfilter/dfilter_erase_active.png) no-repeat center;" "}" "QToolButton:pressed {" - " image: url(:/dfilter/dfilter_erase_selected.png);" + " background: palette(base) url(:/dfilter/dfilter_erase_selected.png) no-repeat center;" "}" ); clear_button_->hide(); connect(clear_button_, SIGNAL(clicked()), this, SLOT(clear())); connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(checkFilter(const QString&))); - apply_button_ = NULL; if (!plain_) { apply_button_ = new QToolButton(this); apply_button_->setCursor(Qt::ArrowCursor); + apply_button_->setEnabled(false); apply_button_->setStyleSheet( "QToolButton { /* all types of tool button */" " border 0 0 0 0;" " border-top-right-radius: 3px;" " border-bottom-right-radius: 3px;" " padding-right: 1px;" - " image: url(:/dfilter/dfilter_apply_normal.png);" + " background: palette(base) url(:/dfilter/dfilter_apply_normal.png) no-repeat center;" "}" "QToolButton:hover {" - " image: url(:/dfilter/dfilter_apply_hover.png);" + " background: palette(base) url(:/dfilter/dfilter_apply_hover.png) no-repeat center;" "}" "QToolButton:pressed {" - " image: url(:/dfilter/dfilter_apply_pressed.png);" + " background: palette(base) url(:/dfilter/dfilter_apply_pressed.png) no-repeat center;" "}" ); connect(apply_button_, SIGNAL(clicked()), this, SLOT(applyDisplayFilter())); @@ -301,43 +303,17 @@ void DisplayFilterEdit::showDisplayFilterDialog() void DisplayFilterEdit::applyDisplayFilter() { - QString dfString(text()); - gchar *dftext = NULL; - cf_status_t cf_status; - if (syntaxState() != Valid && syntaxState() != Empty) { return; } - if (dfString.length() > 0) - dftext = g_strdup(dfString.toUtf8().constData()); - cf_status = cf_filter_packets(&cfile, dftext, FALSE); - g_free(dftext); - - if (cf_status == CF_OK) { - if (apply_button_) { - apply_button_->setEnabled(false); - } - if (dfString.length() < 1) { -// gtk_widget_set_sensitive (g_object_get_data (G_OBJECT(filter_cm), E_DFILTER_CLEAR_KEY), FALSE); -// gtk_widget_set_sensitive (g_object_get_data (G_OBJECT(filter_cm), E_DFILTER_SAVE_KEY), FALSE); - } - } - - if (cf_status == CF_OK && dfString.length() > 0) { -// int index; - - g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: add \"%s\" to recent display filters", this->text().toUtf8().constData()); + QString new_filter = text(); + emit filterPackets(new_filter, true); +} -// if(!dfilter_entry_match(filter_cm,s, &index)){ -// gtk_combo_box_text_prepend_text(GTK_COMBO_BOX_TEXT(filter_cm), s); -// index++; -// } -// while ((guint)index >= prefs.gui_recent_df_entries_max){ -// gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(filter_cm), index); -// index--; -// } - } +void DisplayFilterEdit::displayFilterSuccess(bool success) +{ + apply_button_->setEnabled(!success); } /* |