From 6952c1342a7c4ff1828e0bc1a36cfcfd394ee923 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Thu, 19 May 2016 11:21:02 +0900 Subject: Qt: Add Time and Comment labels to the sequence diagram. Add "Time" and "Comment" labels to the sequence diagram similar to the GTK+ UI. Draw a border around the diagram as well. Widen the default spacing and set it to a simple em-width multiple. Fix our port number alignment. Copy over the sequence diagram colors from the GTK+ UI and add them to ColorUtils. Color sequences according to their respective conversation numbers. To do: - Add zoom. Ping-Bug: 12419 Change-Id: I3f9b4ffbfcc34aae1c38e303cd36ff207be247b1 Reviewed-on: https://code.wireshark.org/review/15554 Reviewed-by: Gerald Combs Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- ui/qt/color_utils.cpp | 70 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 18 deletions(-) (limited to 'ui/qt/color_utils.cpp') diff --git a/ui/qt/color_utils.cpp b/ui/qt/color_utils.cpp index 204aa59f80..cb1bdb7ac6 100644 --- a/ui/qt/color_utils.cpp +++ b/ui/qt/color_utils.cpp @@ -31,24 +31,6 @@ const QColor ColorUtils::expert_color_error = QColor ( 0xff, 0x5c, 0x5c ); const QColor ColorUtils::expert_color_foreground = QColor ( 0x00, 0x00, 0x00 ); /* Black */ const QColor ColorUtils::hidden_proto_item = QColor ( 0x44, 0x44, 0x44 ); /* Gray */ -// Available colors -// XXX - Add custom -const QList ColorUtils::graph_colors_ = QList() - << tango_aluminium_6 // Bar outline (use black instead)? - << tango_sky_blue_5 - << tango_butter_6 - << tango_chameleon_5 - << tango_scarlet_red_5 - << tango_plum_5 - << tango_orange_6 - << tango_aluminium_3 - << tango_sky_blue_3 - << tango_butter_3 - << tango_chameleon_3 - << tango_scarlet_red_3 - << tango_plum_3 - << tango_orange_3; - ColorUtils::ColorUtils(QObject *parent) : QObject(parent) { @@ -109,6 +91,58 @@ QRgb ColorUtils::alphaBlend(const QBrush &brush1, const QBrush &brush2, qreal al return alphaBlend(brush1.color(), brush2.color(), alpha); } +QList ColorUtils::graph_colors_; +const QList ColorUtils::graphColors() +{ + if (graph_colors_.isEmpty()) { + // Available graph colors + // XXX - Add custom + graph_colors_ = QList() + << tango_aluminium_6 // Bar outline (use black instead)? + << tango_sky_blue_5 + << tango_butter_6 + << tango_chameleon_5 + << tango_scarlet_red_5 + << tango_plum_5 + << tango_orange_6 + << tango_aluminium_3 + << tango_sky_blue_3 + << tango_butter_3 + << tango_chameleon_3 + << tango_scarlet_red_3 + << tango_plum_3 + << tango_orange_3; + } + return graph_colors_; +} + +QRgb ColorUtils::graphColor(int item) +{ + if (graph_colors_.isEmpty()) graphColors(); // Init list. + return graph_colors_[item % graph_colors_.size()]; +} + +QList ColorUtils::sequence_colors_; +QRgb ColorUtils::sequenceColor(int item) +{ + if (sequence_colors_.isEmpty()) { + // Available sequence colors. Copied from gtk/graph_analysis.c. + // XXX - Add custom? + sequence_colors_ = QList() + << qRgb(144, 238, 144) + << qRgb(255, 160, 123) + << qRgb(255, 182, 193) + << qRgb(250, 250, 210) + << qRgb(255, 255, 52) + << qRgb(103, 205, 170) + << qRgb(224, 255, 255) + << qRgb(176, 196, 222) + << qRgb(135, 206, 254) + << qRgb(211, 211, 211); + } + return sequence_colors_[item % sequence_colors_.size()]; +} + /* * Editor modelines * -- cgit v1.2.1