Qt: Coloring Rules dialog fixups.
Insert new rules at the top. This matches the GTK+ UI behavior. Recolor the packet list when we press "OK". Add a "to do" item about setting the filter column width. Change-Id: I2a9e58fe8642a89f12e1c34622b96613f3ec4c05 Reviewed-on: https://code.wireshark.org/review/11781 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
9fe7102b3a
commit
f5d7548497
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue