aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-10-21 22:50:16 -0400
committerMichael Mann <mmann78@netscape.net>2017-10-22 21:34:55 +0000
commit182d9deb08125f9c595bcb32dcb28f745989d615 (patch)
tree6a1702c8b3d1da80ade4881b224d5cdc6b880e40
parenta16126fffbaa8ee854b32cc80f94d6233ee3ef4f (diff)
Add "Apply as filter" button to Coloring Rules Dialog
Add a button to apply currently selected color as the display filter. Bug: 14100 Change-Id: Ife3edeb577075f1fe30b649a5655ef5887684d8a Reviewed-on: https://code.wireshark.org/review/24012 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--ui/qt/coloring_rules_dialog.cpp12
-rw-r--r--ui/qt/coloring_rules_dialog.h5
-rw-r--r--ui/qt/coloring_rules_dialog.ui26
-rw-r--r--ui/qt/main_window_slots.cpp6
4 files changed, 36 insertions, 13 deletions
diff --git a/ui/qt/coloring_rules_dialog.cpp b/ui/qt/coloring_rules_dialog.cpp
index 552e5a1eec..f0112d9aef 100644
--- a/ui/qt/coloring_rules_dialog.cpp
+++ b/ui/qt/coloring_rules_dialog.cpp
@@ -136,6 +136,7 @@ void ColoringRulesDialog::showEvent(QShowEvent *)
{
ui->fGPushButton->setFixedHeight(ui->copyToolButton->geometry().height());
ui->bGPushButton->setFixedHeight(ui->copyToolButton->geometry().height());
+ ui->displayFilterPushButton->setFixedHeight(ui->copyToolButton->geometry().height());
}
void ColoringRulesDialog::updateWidgets()
@@ -164,6 +165,7 @@ void ColoringRulesDialog::updateWidgets()
ui->deleteToolButton->setEnabled(num_selected > 0);
ui->fGPushButton->setVisible(num_selected == 1);
ui->bGPushButton->setVisible(num_selected == 1);
+ ui->displayFilterPushButton->setVisible(num_selected == 1);
QString error_text;
QTreeWidgetItemIterator iter(ui->coloringRulesTreeWidget);
@@ -267,6 +269,16 @@ void ColoringRulesDialog::on_bGPushButton_clicked()
changeColor(false);
}
+void ColoringRulesDialog::on_displayFilterPushButton_clicked()
+{
+ if (!ui->coloringRulesTreeWidget->currentItem()) return;
+
+ QTreeWidgetItem *ti = ui->coloringRulesTreeWidget->currentItem();
+ QString filter = ti->text(filter_col_);
+
+ emit filterAction(filter, FilterAction::ActionApply, FilterAction::ActionTypePlain);
+}
+
void ColoringRulesDialog::addColoringRule(bool disabled, QString name, QString filter, QColor foreground, QColor background, bool start_editing, bool at_top)
{
QTreeWidgetItem *ti = new QTreeWidgetItem();
diff --git a/ui/qt/coloring_rules_dialog.h b/ui/qt/coloring_rules_dialog.h
index 99e42e6510..42b4c76fec 100644
--- a/ui/qt/coloring_rules_dialog.h
+++ b/ui/qt/coloring_rules_dialog.h
@@ -23,6 +23,7 @@
#define COLORING_RULES_DIALOG_H
#include "geometry_state_dialog.h"
+#include "filter_action.h"
class QAbstractButton;
class QTreeWidget;
@@ -64,6 +65,9 @@ public:
void addColor(struct _color_filter *colorf);
+signals:
+ void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
+
protected:
void showEvent(QShowEvent *);
@@ -73,6 +77,7 @@ private slots:
void on_coloringRulesTreeWidget_itemSelectionChanged();
void on_fGPushButton_clicked();
void on_bGPushButton_clicked();
+ void on_displayFilterPushButton_clicked();
void on_newToolButton_clicked();
void on_deleteToolButton_clicked();
void on_copyToolButton_clicked();
diff --git a/ui/qt/coloring_rules_dialog.ui b/ui/qt/coloring_rules_dialog.ui
index a8098bae7b..467aaecc4c 100644
--- a/ui/qt/coloring_rules_dialog.ui
+++ b/ui/qt/coloring_rules_dialog.ui
@@ -98,19 +98,6 @@
</widget>
</item>
<item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
<widget class="QPushButton" name="fGPushButton">
<property name="toolTip">
<string>Set the foreground color for this rule.</string>
@@ -149,6 +136,19 @@
</widget>
</item>
<item>
+ <widget class="QPushButton" name="displayFilterPushButton">
+ <property name="toolTip">
+ <string>Set the display filter using this rule.</string>
+ </property>
+ <property name="text">
+ <string>Apply as filter</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </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 518bd392bf..c61b03abd6 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -2498,6 +2498,8 @@ void MainWindow::on_actionViewColoringRules_triggered()
ColoringRulesDialog coloring_rules_dialog(this);
connect(&coloring_rules_dialog, SIGNAL(accepted()),
packet_list_, SLOT(recolorPackets()));
+ connect(&coloring_rules_dialog, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
+ this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
coloring_rules_dialog.exec();
}
@@ -2520,6 +2522,8 @@ void MainWindow::colorizeConversation(bool create_rule)
ColoringRulesDialog coloring_rules_dialog(this, filter);
connect(&coloring_rules_dialog, SIGNAL(accepted()),
packet_list_, SLOT(recolorPackets()));
+ connect(&coloring_rules_dialog, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
+ this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
coloring_rules_dialog.exec();
} else {
gchar *err_msg = NULL;
@@ -2570,6 +2574,8 @@ void MainWindow::colorizeWithFilter(QByteArray filter, int color_number)
ColoringRulesDialog coloring_rules_dialog(window(), filter);
connect(&coloring_rules_dialog, SIGNAL(accepted()),
packet_list_, SLOT(recolorPackets()));
+ connect(&coloring_rules_dialog, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
+ this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
coloring_rules_dialog.exec();
}
main_ui_->actionViewColorizeResetColorization->setEnabled(tmp_color_filters_used());