diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2017-06-07 10:08:46 +0200 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2017-06-07 13:09:03 +0000 |
commit | f1496b6dff0460e5137673bf55bd49a1f19d361d (patch) | |
tree | b1150487c0070b69b6829a24371e57bf7605ff20 /ui | |
parent | 34a6b71342d49d835c8c5d368cb41a70d0c1269b (diff) | |
download | wireshark-f1496b6dff0460e5137673bf55bd49a1f19d361d.tar.gz |
Qt: Wireless Timeline improvements
- Change keyboard shortcuts to Ctrl+Shift+[IOU]
- Use UTF8_MICRO_SIGN in tooltip text
- Change 0xffffffffffffffff with G_MAXUINT64
- Check for valid wlan_radio *ri before use
- Small whitespace cleanups
Change-Id: I9fa85c0d675ef3837510afaf5f1b723d89ac134c
Ping-Bug: 13769
Reviewed-on: https://code.wireshark.org/review/21993
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Simon Barber <simon.barber@meraki.net>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/main_window.ui | 6 | ||||
-rw-r--r-- | ui/qt/wireless_timeline.cpp | 26 |
2 files changed, 17 insertions, 15 deletions
diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui index 7c359249c5..83f45517c9 100644 --- a/ui/qt/main_window.ui +++ b/ui/qt/main_window.ui @@ -2994,7 +2994,7 @@ <string>Zoom in on the wireless timeline</string> </property> <property name="shortcut"> - <string>Ctrl+I</string> + <string>Ctrl+Shift+I</string> </property> </action> <action name="actionWirelessTimelineZoomOut"> @@ -3005,7 +3005,7 @@ <string>Zoom out on the wireless timeline</string> </property> <property name="shortcut"> - <string>Ctrl+O</string> + <string>Ctrl+Shift+O</string> </property> </action> <action name="actionWirelessTimelineZoomFullOut"> @@ -3016,7 +3016,7 @@ <string>Fully zoom out on the wireless timeline</string> </property> <property name="shortcut"> - <string>Ctrl+U</string> + <string>Ctrl+Shift+U</string> </property> </action> </widget> diff --git a/ui/qt/wireless_timeline.cpp b/ui/qt/wireless_timeline.cpp index 97fc3255c0..3e29a4d3e3 100644 --- a/ui/qt/wireless_timeline.cpp +++ b/ui/qt/wireless_timeline.cpp @@ -45,6 +45,7 @@ #include "color_utils.h" #include "qt_ui_utils.h" #include "wireshark_application.h" +#include "wsutil/utf8_entities.h" #ifdef Q_OS_WIN #include "wsutil/file_util.h" @@ -76,14 +77,14 @@ public: static void reset_rgb(float rgb[TIMELINE_HEIGHT][3]) { int i; - for(i = 0; i < TIMELINE_HEIGHT; i++) + for (i = 0; i < TIMELINE_HEIGHT; i++) rgb[i][0] = rgb[i][1] = rgb[i][2] = 1.0; } static void render_pixels(QPainter &p, gint x, gint width, float rgb[TIMELINE_HEIGHT][3], float ratio) { int previous = 0, i; - for(i = 1; i <= TIMELINE_HEIGHT; i++) { + for (i = 1; i <= TIMELINE_HEIGHT; i++) { if (i != TIMELINE_HEIGHT && rgb[previous][0] == rgb[i][0] && rgb[previous][1] == rgb[i][1] && @@ -105,7 +106,7 @@ static void render_rectangle(QPainter &p, gint x, gint width, guint height, int static void accumulate_rgb(float rgb[TIMELINE_HEIGHT][3], int height, int dfilter, float width, float red, float green, float blue) { int i; - for(i = TIMELINE_HEIGHT/2-height; i < (TIMELINE_HEIGHT/2 + (dfilter ? height : 0)); i++) { + for (i = TIMELINE_HEIGHT/2-height; i < (TIMELINE_HEIGHT/2 + (dfilter ? height : 0)); i++) { rgb[i][0] = rgb[i][0] - width + width * red; rgb[i][1] = rgb[i][1] - width + width * green; rgb[i][2] = rgb[i][2] - width + width * blue; @@ -301,7 +302,7 @@ int WirelessTimeline::position(guint64 tsf, float ratio) { int position = -100; - if (tsf != 0xffffffffffffffff) { + if (tsf != G_MAXUINT64) { position = ((double) tsf - start_tsf)*width()*ratio/(end_tsf-start_tsf); } return position; @@ -357,10 +358,10 @@ struct wlan_radio* WirelessTimeline::get_wlan_radio(guint32 packet_num) void WirelessTimeline::doToolTip(struct wlan_radio *wr, QPoint pos, int x) { if (x < position(wr->start_tsf, 1.0)) { - QToolTip::showText(pos, QString("inter frame space %1 us").arg(wr->ifs)); + QToolTip::showText(pos, QString("Inter frame space %1 " UTF8_MICRO_SIGN "s").arg(wr->ifs)); } else { - QToolTip::showText(pos, QString("total duration %1 us\nNAV %2 us").arg(wr->end_tsf-wr->start_tsf) - .arg(wr->nav)); + QToolTip::showText(pos, QString("Total duration %1 " UTF8_MICRO_SIGN "s\nNAV %2 " UTF8_MICRO_SIGN "s") + .arg(wr->end_tsf-wr->start_tsf).arg(wr->nav)); } } @@ -464,7 +465,7 @@ int WirelessTimeline::find_packet_tsf(guint64 tsf) guint64 min_tsf = get_wlan_radio(min_count)->end_tsf; guint64 max_tsf = get_wlan_radio(max_count)->end_tsf; - for(;;) { + for (;;) { if (tsf >= max_tsf) return max_count+1; @@ -527,16 +528,17 @@ WirelessTimeline::paintEvent(QPaintEvent *qpe) } QGraphicsScene qs; - for(packet = find_packet_tsf(start_tsf + left/zoom - 40000); packet <= cfile.count; packet++) { + for (packet = find_packet_tsf(start_tsf + left/zoom - 40000); packet <= cfile.count; packet++) { frame_data *fdata = frame_data_sequence_find(cfile.frames, packet); struct wlan_radio *ri = get_wlan_radio(fdata->num); - float x, width, red,green,blue; + float x, width, red, green, blue; + + if (ri == NULL) continue; + gint8 rssi = ri->aggregate ? ri->aggregate->rssi : ri->rssi; guint height = (rssi+100)/2; gint end_nav; - if (ri == NULL) continue; - /* leave a margin above the packets so the selected packet can be seen */ if (height > TIMELINE_HEIGHT/2-6) height = TIMELINE_HEIGHT/2-6; |