aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/qt/coloring_rules_dialog.cpp19
-rw-r--r--ui/qt/coloring_rules_dialog.h2
-rw-r--r--ui/qt/main_window_slots.cpp8
-rw-r--r--ui/qt/packet_list.h2
4 files changed, 22 insertions, 9 deletions
diff --git a/ui/qt/coloring_rules_dialog.cpp b/ui/qt/coloring_rules_dialog.cpp
index 877a60390f..e8314f499a 100644
--- a/ui/qt/coloring_rules_dialog.cpp
+++ b/ui/qt/coloring_rules_dialog.cpp
@@ -56,6 +56,10 @@
* Coloring rule editor for the current profile.
*/
+// To do:
+// - Make the filter column narrower? It's easy to run into Qt's annoying
+// habit of horizontally scrolling QTreeWidgets here.
+
// Callback for color_filters_clone.
void
color_filter_add_cb(color_filter_t *colorf, gpointer user_data)
@@ -71,7 +75,7 @@ enum {
filter_col_
};
-const QString new_rule_name_ = QObject::tr("New coloring rule");
+static const QString new_rule_name_ = QObject::tr("New coloring rule");
ColoringRulesDialog::ColoringRulesDialog(QWidget *parent, QString add_filter) :
QDialog(parent),
@@ -130,7 +134,8 @@ void ColoringRulesDialog::addColor(_color_filter *colorf)
} else {
addColoringRule(colorf->disabled, colorf->filter_name, colorf->filter_text,
ColorUtils::fromColorT(colorf->fg_color),
- ColorUtils::fromColorT(colorf->bg_color));
+ ColorUtils::fromColorT(colorf->bg_color),
+ false, false);
}
}
@@ -268,9 +273,9 @@ void ColoringRulesDialog::on_bGPushButton_clicked()
changeColor(false);
}
-void ColoringRulesDialog::addColoringRule(bool disabled, QString name, QString filter, QColor foreground, QColor background, bool start_editing)
+void ColoringRulesDialog::addColoringRule(bool disabled, QString name, QString filter, QColor foreground, QColor background, bool start_editing, bool at_top)
{
- QTreeWidgetItem *ti = new QTreeWidgetItem(ui->coloringRulesTreeWidget);
+ QTreeWidgetItem *ti = new QTreeWidgetItem();
ti->setFlags(ti->flags() | Qt::ItemIsUserCheckable | Qt::ItemIsEditable);
ti->setFlags(ti->flags() & ~(Qt::ItemIsDropEnabled));
@@ -283,7 +288,11 @@ void ColoringRulesDialog::addColoringRule(bool disabled, QString name, QString f
ti->setBackground(i, background);
}
- ui->coloringRulesTreeWidget->addTopLevelItem(ti);
+ if (at_top) {
+ ui->coloringRulesTreeWidget->insertTopLevelItem(0, ti);
+ } else {
+ ui->coloringRulesTreeWidget->addTopLevelItem(ti);
+ }
if (start_editing) {
ui->coloringRulesTreeWidget->setCurrentItem(ti);
diff --git a/ui/qt/coloring_rules_dialog.h b/ui/qt/coloring_rules_dialog.h
index f8997c0607..becdb93727 100644
--- a/ui/qt/coloring_rules_dialog.h
+++ b/ui/qt/coloring_rules_dialog.h
@@ -87,7 +87,7 @@ private:
ColoringRulesTreeDelegate coloring_rules_tree_delegate_;
struct _GSList *conversation_colors_;
- void addColoringRule(bool disabled, QString name, QString filter, QColor foreground, QColor background, bool start_editing = false);
+ void addColoringRule(bool disabled, QString name, QString filter, QColor foreground, QColor background, bool start_editing = false, bool at_top = true);
void changeColor(bool foreground = true);
};
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index ede235c2ba..419b46829a 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -2192,13 +2192,13 @@ void MainWindow::on_actionViewColorizePacketList_triggered(bool checked) {
recent.packet_list_colorize = checked;
color_filters_enable(checked);
packet_list_->packetListModel()->resetColorized();
- packet_list_->update();
}
void MainWindow::on_actionViewColoringRules_triggered()
{
ColoringRulesDialog coloring_rules_dialog(this);
-
+ connect(&coloring_rules_dialog, SIGNAL(accepted()),
+ packet_list_, SLOT(recolorPackets()));
coloring_rules_dialog.exec();
}
@@ -2243,6 +2243,8 @@ void MainWindow::colorizeConversation(bool create_rule)
if (create_rule) {
ColoringRulesDialog coloring_rules_dialog(this, filter);
+ connect(&coloring_rules_dialog, SIGNAL(accepted()),
+ packet_list_, SLOT(recolorPackets()));
coloring_rules_dialog.exec();
} else {
color_filters_set_tmp(cc_num, filter, FALSE);
@@ -2270,6 +2272,8 @@ void MainWindow::colorizeWithFilter()
} else {
// New coloring rule
ColoringRulesDialog coloring_rules_dialog(window(), filter);
+ connect(&coloring_rules_dialog, SIGNAL(accepted()),
+ packet_list_, SLOT(recolorPackets()));
coloring_rules_dialog.exec();
}
main_ui_->actionViewColorizeResetColorization->setEnabled(tmp_color_filters_used());
diff --git a/ui/qt/packet_list.h b/ui/qt/packet_list.h
index c05cece139..61757866b4 100644
--- a/ui/qt/packet_list.h
+++ b/ui/qt/packet_list.h
@@ -71,7 +71,6 @@ public:
QString packetComment();
void setPacketComment(QString new_comment);
QString allPacketComments();
- void recolorPackets();
void setAutoScroll(bool enabled = true);
void setCaptureInProgress(bool in_progress = false) { capture_in_progress_ = in_progress; tail_at_end_ = in_progress; }
void captureFileReadFinished();
@@ -149,6 +148,7 @@ public slots:
void setTimeReference();
void unsetAllTimeReferences();
void applyTimeShift();
+ void recolorPackets();
void redrawVisiblePackets();
void columnsChanged();
void fieldsChanged(capture_file *cf);