aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/color_utils.cpp
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-05-19 11:21:02 +0900
committerAnders Broman <a.broman58@gmail.com>2016-05-25 06:36:25 +0000
commit6952c1342a7c4ff1828e0bc1a36cfcfd394ee923 (patch)
tree433370041cf427f46d6a4d4c56d95726e93ec686 /ui/qt/color_utils.cpp
parentbf628988b655895ef429fa835e77c5fdca9a901b (diff)
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 <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/color_utils.cpp')
-rw-r--r--ui/qt/color_utils.cpp70
1 files changed, 52 insertions, 18 deletions
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<QRgb> ColorUtils::graph_colors_ = QList<QRgb>()
- << 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<QRgb> ColorUtils::graph_colors_;
+const QList<QRgb> ColorUtils::graphColors()
+{
+ if (graph_colors_.isEmpty()) {
+ // Available graph colors
+ // XXX - Add custom
+ graph_colors_ = QList<QRgb>()
+ << 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<QRgb> 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>()
+ << 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
*