diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-06-11 15:53:51 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-07-16 22:57:31 +0000 |
commit | 255d53dfc11fa49eadd30fefe3ed5950b03e6659 (patch) | |
tree | 1404c49ffb41d4f1245889f24e0e260e4cc011fd /ui/qt/packet_list_model.cpp | |
parent | 3e059c9d1fedf9c890f910fa88cc2ef99fb1e470 (diff) | |
download | wireshark-255d53dfc11fa49eadd30fefe3ed5950b03e6659.tar.gz |
Draw packet colors in the packet list scrollbar.
Inspired by (but not as fancy as) Packet Fence, an enhancement written
for Ethereal a loooong time ago by Martin Visser:
https://www.wireshark.org/lists/ethereal-dev/200011/msg00122.html
Several text editors call this a "minimap".
Color each scrollbar raster line to match the color of up to 7 packets.
Note in the comments why this number was chosen.
If we have any flagged frames (marked, ignored, time ref) indicate them
on either side of the scrolbar.
Handle HiDPI (retina) displays. This means that your window size depends
on the height of your scrollbar *and* your monitor resolution.
Qt's idea of the slider rect doesn't match up with the slider on OS X.
This might be local to my build -- I can replicate it Qt Creator.
Change-Id: Ia089d2d766ce37bab11e22d1a5721b4908935304
Reviewed-on: https://code.wireshark.org/review/8982
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Tested-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/packet_list_model.cpp')
-rw-r--r-- | ui/qt/packet_list_model.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ui/qt/packet_list_model.cpp b/ui/qt/packet_list_model.cpp index 3de636d947..5fb77eecbc 100644 --- a/ui/qt/packet_list_model.cpp +++ b/ui/qt/packet_list_model.cpp @@ -34,7 +34,9 @@ #include "color_filters.h" #include "frame_tvbuff.h" +#include "color_utils.h" #include "wireshark_application.h" + #include <QColor> #include <QFontMetrics> #include <QModelIndex> @@ -398,7 +400,7 @@ QVariant PacketListModel::data(const QModelIndex &d_index, int role) const } else { return QVariant(); } - return QColor(color->red >> 8, color->green >> 8, color->blue >> 8); + return ColorUtils::fromColorT(color); case Qt::ForegroundRole: if (fdata->flags.ignored) { color = &prefs.gui_ignored_fg; @@ -410,7 +412,7 @@ QVariant PacketListModel::data(const QModelIndex &d_index, int role) const } else { return QVariant(); } - return QColor(color->red >> 8, color->green >> 8, color->blue >> 8); + return ColorUtils::fromColorT(color); case Qt::DisplayRole: { int column = d_index.column(); @@ -485,6 +487,18 @@ frame_data *PacketListModel::getRowFdata(int row) { return record->frameData(); } +void PacketListModel::ensureRowColorized(int row) +{ + if (row < 0 || row >= visible_rows_.count()) + return; + PacketListRecord *record = visible_rows_[row]; + if (!record) + return; + if (!record->colorized()) { + record->columnString(cap_file_, 1); + } +} + int PacketListModel::visibleIndexOf(frame_data *fdata) const { int row = 0; |