diff options
author | Gerald Combs <gerald@wireshark.org> | 2016-09-01 13:51:13 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2016-09-02 23:53:37 +0000 |
commit | 5846524f0ba9389e3f4f03546db21782c2d22183 (patch) | |
tree | 0a557804da07c086f5d4cd6422765d3814e06b5a /ui/qt/conversation_dialog.cpp | |
parent | df3bf9ca796dc2474c55c87f0ff8cb4eab63d2f6 (diff) |
Qt: Conversation time column updates.
Add a checkbox which lets you toggle between absolute and relative start
times. Use the local time for now. Fixes bug 11618.
Adjust our time precision based on the capture file's time precision.
Fixes bug 12803.
Update the User's Guide accordingly.
Bug: 11618
Bug: 12803
Change-Id: I0049d6db6e4d0b6967bf35e6d056a61bfb4de10f
Reviewed-on: https://code.wireshark.org/review/17448
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/conversation_dialog.cpp')
-rw-r--r-- | ui/qt/conversation_dialog.cpp | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/ui/qt/conversation_dialog.cpp b/ui/qt/conversation_dialog.cpp index 4ace205e19..8810223790 100644 --- a/ui/qt/conversation_dialog.cpp +++ b/ui/qt/conversation_dialog.cpp @@ -35,6 +35,7 @@ #include "wireshark_application.h" #include <QCheckBox> +#include <QDateTime> #include <QDialogButtonBox> #include <QPushButton> @@ -58,6 +59,9 @@ // Fixed bugs: // - Friendly unit displays https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9231 // - Misleading bps calculation https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8703 +// - Show Absolute time in conversation tables https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=11618 +// - The value of 'Rel start' and 'Duration' in "Conversations" no need too precise https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=12803 + static const QString table_name_ = QObject::tr("Conversation"); ConversationDialog::ConversationDialog(QWidget &parent, CaptureFile &cf, int cli_proto_id, const char *filter) : @@ -71,6 +75,8 @@ ConversationDialog::ConversationDialog(QWidget &parent, CaptureFile &cf, int cli graph_bt_->setToolTip(tr("Graph a TCP conversation.")); connect(graph_bt_, SIGNAL(clicked()), this, SLOT(graphTcp())); + absoluteTimeCheckBox()->show(); + addProgressFrame(&parent); QList<int> conv_protos; @@ -163,6 +169,9 @@ bool ConversationDialog::addTrafficTable(register_ct_t* table) this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType))); connect(nameResolutionCheckBox(), SIGNAL(toggled(bool)), conv_tree, SLOT(setNameResolutionEnabled(bool))); + connect(absoluteTimeCheckBox(), SIGNAL(toggled(bool)), + conv_tree, SLOT(updateStartTime(bool))); + // XXX Move to ConversationTreeWidget ctor? QByteArray filter_utf8; @@ -365,9 +374,31 @@ public: case CONV_COLUMN_BYTES_BA: return gchar_free_to_qstring(format_size(conv_item->rx_bytes, format_size_unit_none|format_size_prefix_si)); case CONV_COLUMN_START: - return QString::number(nstime_to_sec(&conv_item->start_time), 'f', 9); + { + bool use_ns = treeWidget()->window()->property("nanosecond_precision").toBool(); + int width = use_ns ? 9 : 6; + + if (treeWidget()->window()->property("absolute_start_time").toBool()) { + nstime_t *abs_time = &conv_item->start_abs_time; + QDateTime abs_dt = QDateTime::fromMSecsSinceEpoch(nstime_to_msec(abs_time)); + return QString("%1.%2") + // Mimic column-utils:set_abs_time as best we can + .arg(abs_dt.toString("hh:mm:ss")) + .arg(use_ns ? abs_time->nsecs : abs_time->nsecs / 1000, width, 10, QChar('0')); + } + + return QString::number(nstime_to_sec(&conv_item->start_time), 'f', width); + } case CONV_COLUMN_DURATION: - return QString::number(duration, 'f', 6); + { + // The GTK+ UI uses 9 digit precision for the start time and 4 for the duration. + // Do the same here and above for non-nanosecond precision and add a couple + // of digits for nanosecond precision. + bool use_ns = treeWidget()->window()->property("nanosecond_precision").toBool(); + int width = use_ns ? 6 : 4; + + return QString::number(duration, 'f', width); + } case CONV_COLUMN_BPS_AB: if (duration > min_bw_calc_duration_) { bps_ab = gchar_free_to_qstring(format_size((gint64) conv_item->tx_bytes * 8 / duration, format_size_unit_none|format_size_prefix_si)); @@ -665,6 +696,19 @@ void ConversationTreeWidget::tapDraw(void *conv_hash_ptr) conv_tree->updateItems(); } +void ConversationTreeWidget::updateStartTime(bool absolute) +{ + headerItem()->setText(CONV_COLUMN_START, absolute + ? conv_abs_start_title + : conv_column_titles[CONV_COLUMN_START]); + + dataChanged(QModelIndex(), QModelIndex()); + + if (topLevelItemCount() > 0) { + resizeColumnToContents(CONV_COLUMN_START); + } +} + QMap<FilterAction::ActionDirection, conv_direction_e> fad_to_cd_; void ConversationTreeWidget::initDirectionMap() |