aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-10-27 09:52:51 -0700
committerGerald Combs <gerald@wireshark.org>2015-10-27 19:28:19 +0000
commite70a23f49d79ec2c6a9db25409de052d64c2ed36 (patch)
treee6888f0f8590db5392bc79cad09b311b2841842a /ui/qt
parent2ccb9d2d957a6c118c00a193d0fbe19712153208 (diff)
Qt: Add a filter expression item to the display filter edit menu.
Add an item to the display filter bookmark menu which opens the filter expression preferences. We also need an expression editor frame similar to the column editor frame, but hopefully this will suffice until that exists. Change-Id: If4c159bb769f0f8e7f89db55f1c6fd7c0bf65c87 Reviewed-on: https://code.wireshark.org/review/11315 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')
-rw-r--r--ui/qt/display_filter_edit.cpp7
-rw-r--r--ui/qt/display_filter_edit.h3
-rw-r--r--ui/qt/filter_expressions_preferences_frame.cpp5
-rw-r--r--ui/qt/filter_expressions_preferences_frame.h2
-rw-r--r--ui/qt/filter_expressions_preferences_frame.ui2
-rw-r--r--ui/qt/main_window.cpp2
6 files changed, 17 insertions, 4 deletions
diff --git a/ui/qt/display_filter_edit.cpp b/ui/qt/display_filter_edit.cpp
index f91203a8ea..16360856cb 100644
--- a/ui/qt/display_filter_edit.cpp
+++ b/ui/qt/display_filter_edit.cpp
@@ -334,6 +334,8 @@ void DisplayFilterEdit::checkFilter(const QString& filter_text)
connect(save_action, SIGNAL(triggered(bool)), this, SLOT(saveFilter()));
QAction *manage_action = bb_menu->addAction(tr("Manage Display Filters"));
connect(manage_action, SIGNAL(triggered(bool)), this, SLOT(showFilters()));
+ QAction *expr_action = bb_menu->addAction(tr("Manage Filter Expressions"));
+ connect(expr_action, SIGNAL(triggered(bool)), this, SLOT(showExpressionPrefs()));
QAction *first_filter = NULL;
for (GList *df_item = get_filter_list_first(DFILTER_LIST); df_item; df_item = g_list_next(df_item)) {
@@ -544,6 +546,11 @@ void DisplayFilterEdit::showFilters()
display_filter_dlg.exec();
}
+void DisplayFilterEdit::showExpressionPrefs()
+{
+ emit showPreferencesDialog(PreferencesDialog::ppFilterExpressions);
+}
+
void DisplayFilterEdit::prepareFilter()
{
QAction *pa = qobject_cast<QAction*>(sender());
diff --git a/ui/qt/display_filter_edit.h b/ui/qt/display_filter_edit.h
index 1c75492b7b..dd1fbca62a 100644
--- a/ui/qt/display_filter_edit.h
+++ b/ui/qt/display_filter_edit.h
@@ -22,6 +22,7 @@
#ifndef DISPLAYFILTEREDIT_H
#define DISPLAYFILTEREDIT_H
+#include "preferences_dialog.h"
#include "syntax_line_edit.h"
class QEvent;
@@ -53,6 +54,7 @@ private slots:
void saveFilter();
void removeFilter();
void showFilters();
+ void showExpressionPrefs();
void prepareFilter();
private:
@@ -69,6 +71,7 @@ signals:
void popFilterSyntaxStatus();
void pushFilterSyntaxWarning(const QString&);
void filterPackets(QString new_filter, bool force);
+ void showPreferencesDialog(PreferencesDialog::PreferencesPane start_pane);
};
#endif // DISPLAYFILTEREDIT_H
diff --git a/ui/qt/filter_expressions_preferences_frame.cpp b/ui/qt/filter_expressions_preferences_frame.cpp
index 3f3e01fcdd..35beeb38fb 100644
--- a/ui/qt/filter_expressions_preferences_frame.cpp
+++ b/ui/qt/filter_expressions_preferences_frame.cpp
@@ -154,7 +154,7 @@ void FilterExpressionsPreferencesFrame::keyPressEvent(QKeyEvent *evt)
QFrame::keyPressEvent(evt);
}
-void FilterExpressionsPreferencesFrame::addExpression(bool enabled, const char *label, char *expression)
+void FilterExpressionsPreferencesFrame::addExpression(bool enabled, const QString label, const QString expression)
{
QTreeWidgetItem *item = new QTreeWidgetItem(ui->expressionTreeWidget);
@@ -267,9 +267,10 @@ void FilterExpressionsPreferencesFrame::expressionEditingFinished()
ui->expressionTreeWidget->removeItemWidget(item, expression_col_);
}
+static const QString new_button_label_ = QObject::tr("My Filter");
void FilterExpressionsPreferencesFrame::on_newToolButton_clicked()
{
- addExpression(true, "My Filter", NULL); //TODO : Fix Translate
+ addExpression(true, new_button_label_, QString());
}
void FilterExpressionsPreferencesFrame::on_deleteToolButton_clicked()
diff --git a/ui/qt/filter_expressions_preferences_frame.h b/ui/qt/filter_expressions_preferences_frame.h
index 45c35dd0a1..a83fb9050b 100644
--- a/ui/qt/filter_expressions_preferences_frame.h
+++ b/ui/qt/filter_expressions_preferences_frame.h
@@ -51,7 +51,7 @@ private:
QLineEdit *cur_line_edit_;
QString saved_col_string_;
- void addExpression(bool enabled, const char *label, char *expression);
+ void addExpression(bool enabled, const QString label, const QString expression);
private slots:
void updateWidgets(void);
diff --git a/ui/qt/filter_expressions_preferences_frame.ui b/ui/qt/filter_expressions_preferences_frame.ui
index d56e1b4a49..ee22e9b43b 100644
--- a/ui/qt/filter_expressions_preferences_frame.ui
+++ b/ui/qt/filter_expressions_preferences_frame.ui
@@ -26,7 +26,7 @@
</column>
<column>
<property name="text">
- <string>Label</string>
+ <string>Button Label</string>
</property>
</column>
<column>
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index fb723573d3..e0f1c1f5b0 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -281,6 +281,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(df_edit, SIGNAL(pushFilterSyntaxWarning(const QString&)),
main_ui_->statusBar, SLOT(pushTemporaryStatus(const QString&)));
connect(df_edit, SIGNAL(filterPackets(QString,bool)), this, SLOT(filterPackets(QString,bool)));
+ connect(df_edit, SIGNAL(showPreferencesDialog(PreferencesDialog::PreferencesPane)),
+ this, SLOT(showPreferencesDialog(PreferencesDialog::PreferencesPane)));
connect(wsApp, SIGNAL(preferencesChanged()), df_edit, SLOT(checkFilter()));
connect(df_edit, SIGNAL(textChanged(QString)), funnel_statistics_, SLOT(displayFilterTextChanged(QString)));