summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-06-25 11:48:46 -0400
committerMichael Mann <mmann78@netscape.net>2017-06-26 02:48:58 +0000
commit5c60b517a70cab8138312ec39946f18f3ed75f58 (patch)
treeed0882fa1aca052246d207b3dcc81b9c5839f7aa /ui
parent1b7f5d9f798634770656a82aaa2df30f7f01a9b0 (diff)
downloadwireshark-5c60b517a70cab8138312ec39946f18f3ed75f58.tar.gz
Add support for comments for a display filter button
Add a field to the display filter button UAT to allow comments to be displayed as part of the tooltip to the diplay filter button Bug: 13814 Change-Id: I74459e4102856258d31d6429e2fd924a9f798cd5 Reviewed-on: https://code.wireshark.org/review/22390 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk/filter_expression_save_dlg.c13
-rw-r--r--ui/qt/filter_expression_frame.cpp3
-rw-r--r--ui/qt/filter_expression_frame.ui25
-rw-r--r--ui/qt/main_window_slots.cpp10
4 files changed, 46 insertions, 5 deletions
diff --git a/ui/gtk/filter_expression_save_dlg.c b/ui/gtk/filter_expression_save_dlg.c
index d60778d505..6a40dc30d4 100644
--- a/ui/gtk/filter_expression_save_dlg.c
+++ b/ui/gtk/filter_expression_save_dlg.c
@@ -134,10 +134,11 @@ filter_button_add(const char *label, const char *expr, struct filter_expression
{
struct filter_expression *fe;
GtkWidget *button;
+ gchar* tooltip;
/* No duplicate buttons when adding a new one */
if (newfe == NULL)
- fe = filter_expression_new(label, expr, TRUE);
+ fe = filter_expression_new(label, expr, "", TRUE);
else
fe = newfe;
@@ -153,7 +154,15 @@ filter_button_add(const char *label, const char *expr, struct filter_expression
gtk_toolbar_insert(GTK_TOOLBAR(_filter_tb), (GtkToolItem *)button, -1);
gtk_widget_set_sensitive(GTK_WIDGET(button), TRUE);
- gtk_widget_set_tooltip_text(GTK_WIDGET(button), fe->expression);
+ if (strlen(fe->comment) > 0)
+ {
+ tooltip = g_strdup_printf("%s, %s", fe->expression, fe->comment);
+ gtk_widget_set_tooltip_text(GTK_WIDGET(button), tooltip);
+ }
+ else
+ {
+ gtk_widget_set_tooltip_text(GTK_WIDGET(button), fe->expression);
+ }
fe->button = button;
filter_buttons = g_list_append (filter_buttons, button);
diff --git a/ui/qt/filter_expression_frame.cpp b/ui/qt/filter_expression_frame.cpp
index 15fae7eeeb..b67eba6adf 100644
--- a/ui/qt/filter_expression_frame.cpp
+++ b/ui/qt/filter_expression_frame.cpp
@@ -95,8 +95,9 @@ void FilterExpressionFrame::on_buttonBox_accepted()
gchar* err = NULL;
QByteArray label_ba = ui->labelLineEdit->text().toUtf8();
QByteArray expr_ba = ui->displayFilterLineEdit->text().toUtf8();
+ QByteArray comment_ba = ui->commentLineEdit->text().toUtf8();
- filter_expression_new(label_ba.constData(), expr_ba.constData(), TRUE);
+ filter_expression_new(label_ba.constData(), expr_ba.constData(), comment_ba.constData(), TRUE);
on_buttonBox_rejected();
emit filterExpressionsChanged();
diff --git a/ui/qt/filter_expression_frame.ui b/ui/qt/filter_expression_frame.ui
index a20b0ddddc..df9691bfd9 100644
--- a/ui/qt/filter_expression_frame.ui
+++ b/ui/qt/filter_expression_frame.ui
@@ -105,7 +105,30 @@
</property>
</widget>
</item>
- <item>
+ <item>
+ <widget class="QLabel" name="commentLabel">
+ <property name="text">
+ <string>Comment:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SyntaxLineEdit" name="commentLineEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 8f675926d9..1b153ce19a 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -909,7 +909,15 @@ gboolean MainWindow::filter_expression_add_action(const void *key _U_, void *val
return FALSE;
QAction *dfb_action = new QAction(fe->label, data->window->filter_expression_toolbar_);
- dfb_action->setToolTip(fe->expression);
+ if (strlen(fe->comment) > 0)
+ {
+ QString tooltip = QString("%1, %2").arg(fe->expression).arg(fe->comment);
+ dfb_action->setToolTip(tooltip);
+ }
+ else
+ {
+ dfb_action->setToolTip(fe->expression);
+ }
dfb_action->setData(fe->expression);
dfb_action->setProperty(dfe_property_, true);
data->window->filter_expression_toolbar_->addAction(dfb_action);