diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-03-11 15:22:20 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-05-08 04:29:59 +0000 |
commit | f77e02ccc62c9283eefba416efbb2f94e460066e (patch) | |
tree | 40aa62ed6f8c03e22cdc636e2335f3b810810b65 /ui/qt/proto_tree.cpp | |
parent | 3d7ff97e4fa9211a064acbac0ec0c025a164d69e (diff) |
Expert Info dialog.
Show all expert messages in a combined view. Group top-level items by a
(severity, group, protocol) tuple.
Let the user enable and disable messages via a check menu.
Add ProtoTree::goToField and expert_info_t.hf_index. Use them to jump to
what we hope is the afflicted item.
Enable the context menu only if the user has selected a packet item.
Add a free-form search field that matches expert summaries.
This differs from the GTK+ version but hopefully provides a smoother
workflow.
Bug: 10931
Change-Id: Ia12cb7c27cdea1634fa2798fb7e4c1b23bd16ad2
Reviewed-on: https://code.wireshark.org/review/8294
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt/proto_tree.cpp')
-rw-r--r-- | ui/qt/proto_tree.cpp | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp index ed07e0e36b..7af1956dbc 100644 --- a/ui/qt/proto_tree.cpp +++ b/ui/qt/proto_tree.cpp @@ -26,6 +26,8 @@ #include <epan/ftypes/ftypes.h> #include <epan/prefs.h> +#include "color_utils.h" + #include <QApplication> #include <QContextMenuEvent> #include <QDesktopServices> @@ -33,14 +35,6 @@ #include <QTreeWidgetItemIterator> #include <QUrl> -QColor expert_color_comment ( 0xb7, 0xf7, 0x74 ); /* Green */ -QColor expert_color_chat ( 0x80, 0xb7, 0xf7 ); /* light blue */ -QColor expert_color_note ( 0xa0, 0xff, 0xff ); /* bright turquoise */ -QColor expert_color_warn ( 0xf7, 0xf2, 0x53 ); /* yellow */ -QColor expert_color_error ( 0xff, 0x5c, 0x5c ); /* pale red */ -QColor expert_color_foreground ( 0x00, 0x00, 0x00 ); /* black */ -QColor hidden_proto_item ( 0x44, 0x44, 0x44 ); /* gray */ - /* Fill a single protocol tree item with its string value and set its color. */ static void proto_tree_draw_node(proto_node *node, gpointer data) @@ -117,24 +111,24 @@ proto_tree_draw_node(proto_node *node, gpointer data) if(FI_GET_FLAG(fi, PI_SEVERITY_MASK)) { switch(FI_GET_FLAG(fi, PI_SEVERITY_MASK)) { case(PI_COMMENT): - item->setData(0, Qt::BackgroundRole, expert_color_comment); + item->setData(0, Qt::BackgroundRole, ColorUtils::expert_color_comment); break; case(PI_CHAT): - item->setData(0, Qt::BackgroundRole, expert_color_chat); + item->setData(0, Qt::BackgroundRole, ColorUtils::expert_color_chat); break; case(PI_NOTE): - item->setData(0, Qt::BackgroundRole, expert_color_note); + item->setData(0, Qt::BackgroundRole, ColorUtils::expert_color_note); break; case(PI_WARN): - item->setData(0, Qt::BackgroundRole, expert_color_warn); + item->setData(0, Qt::BackgroundRole, ColorUtils::expert_color_warn); break; case(PI_ERROR): - item->setData(0, Qt::BackgroundRole, expert_color_error); + item->setData(0, Qt::BackgroundRole, ColorUtils::expert_color_error); break; default: g_assert_not_reached(); } - item->setData(0, Qt::ForegroundRole, expert_color_foreground); + item->setData(0, Qt::ForegroundRole, ColorUtils::expert_color_foreground); } item->setText(0, label_ptr); @@ -302,6 +296,25 @@ void ProtoTree::emitRelatedFrame(int related_frame, ft_framenum_type_t framenum_ emit relatedFrame(related_frame, framenum_type); } +// XXX We select the first match, which might not be the desired item. +void ProtoTree::goToField(int hf_id) +{ + if (hf_id < 0) return; + + QTreeWidgetItemIterator iter(this); + while (*iter) { + field_info *fi = (*iter)->data(0, Qt::UserRole).value<field_info *>(); + + if (fi && fi->hfinfo) { + if (fi->hfinfo->id == hf_id) { + setCurrentItem(*iter); + break; + } + } + iter++; + } +} + void ProtoTree::updateSelectionStatus(QTreeWidgetItem* item) { if (item) { |