Qt: Color _ANY and _TCP sequence analysis items.

For SEQ_ANALYSIS_ANY, color each sequence diagram item according to its
associated packet. For SEQ_ANALYSIS_TCP, color each item according to
its stream.

Bug: 12065
Change-Id: Ib43490fe55039fbcfa793223b5850233a2694a26
Reviewed-on: https://code.wireshark.org/review/15651
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>
This commit is contained in:
Gerald Combs 2016-05-31 12:11:11 -07:00 committed by Anders Broman
parent 20a41839ab
commit 16c91568bb
4 changed files with 19 additions and 3 deletions

View File

@ -60,6 +60,13 @@ typedef struct _color_filter {
void *color_edit_dlg_info; /* if filter is being edited, ptr to req'd info. GTK+ only. */
} color_filter_t;
inline static unsigned int
color_t_to_rgb(const color_t *color) {
return (((color->red >> 8) << 16)
| ((color->green >> 8) << 8)
| (color->blue >> 8));
}
/** A color filter was added (while importing).
* (color_filters.c calls this for every filter coming in)
*

View File

@ -264,7 +264,10 @@ void SequenceDiagram::draw(QCPPainter *painter)
fg_pen.setColor(sel_pal.color(QPalette::HighlightedText));
bg_color = sel_pal.color(QPalette::Highlight);
selected_key_ = cur_key;
} else {
} else if (sainfo_->type == SEQ_ANALYSIS_ANY) {
fg_pen.setColor(QColor().fromRgb(sai->fg_color));
bg_color = QColor().fromRgb(sai->bg_color);
} else { // SEQ_ANALYSIS_VOIP, SEQ_ANALYSIS_TCP
fg_pen.setColor(Qt::black);
bg_color = ColorUtils::sequenceColor(sai->conv_num);
}

View File

@ -29,6 +29,7 @@
#include "tap-sequence-analysis.h"
#include "epan/addr_resolv.h"
#include "epan/color_filters.h"
#include "epan/packet.h"
#include "epan/tap.h"
#include "epan/proto_data.h"
@ -108,6 +109,9 @@ seq_analysis_frame_packet( void *ptr, packet_info *pinfo, epan_dissect_t *edt _U
sai->frame_number = pinfo->num;
sai->bg_color = color_t_to_rgb(&pinfo->fd->color_filter->bg_color);
sai->fg_color = color_t_to_rgb(&pinfo->fd->color_filter->fg_color);
sai->port_src=pinfo->srcport;
sai->port_dst=pinfo->destport;
sai->protocol = g_strdup(port_type_to_str(pinfo->ptype));
@ -238,7 +242,7 @@ seq_analysis_tcp_packet( void *ptr, packet_info *pinfo, epan_dissect_t *edt _U_,
sai->comment = g_strdup_printf("Seq = %u",tcph->th_seq);
sai->line_style = 1;
sai->conv_num = 0;
sai->conv_num = (guint16) tcph->th_stream;
sai->display = TRUE;
g_queue_push_tail(sainfo->items, sai);

View File

@ -58,7 +58,9 @@ typedef struct _seq_analysis_item {
gchar *frame_label; /**< the label on top of the arrow */
gchar *time_str; /**< timestamp */
gchar *comment; /**< a comment that appears at the right of the graph */
guint16 conv_num; /**< the conversation number, each conversation will be colored */
guint16 conv_num; /**< The conversation number. Used for coloring VoIP calls. */
unsigned fg_color; /**< Foreground color, 0xRRGGBB. Qt only. */
unsigned bg_color; /**< Background color, 0xRRGGBB. Qt only. */
gboolean display; /**< indicate if the packet is displayed or not in the graph */
guint src_node; /**< this is used by graph_analysis.c to identify the node */
guint dst_node; /**< a node is an IP address that will be displayed in columns */