diff options
author | erikdejong <erikdejong@gmail.com> | 2016-10-22 11:32:51 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-10-25 04:14:59 +0000 |
commit | ae88dbcc2a990218549e06e143908eed1223ad8a (patch) | |
tree | b44a16c45fc3fccbc6d1823b5bb2847dcef0b5e0 | |
parent | 5b216db2876904400e7442805d6a7b52ddb4e0bc (diff) | |
download | wireshark-ae88dbcc2a990218549e06e143908eed1223ad8a.tar.gz |
Qt: Enhancements to VoIP call dialog:
1) Added checkbox to toggle format in start and stop time columns from
relative time to time of day.
2) Added column to show duration of call in between the protocol and
packets column.
Change-Id: I56347fa36885e3a71646e2c9cdde2b8b5fb88846
Reviewed-on: https://code.wireshark.org/review/18383
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | ui/qt/voip_calls_dialog.cpp | 38 | ||||
-rw-r--r-- | ui/qt/voip_calls_dialog.h | 1 | ||||
-rw-r--r-- | ui/qt/voip_calls_dialog.ui | 29 |
3 files changed, 61 insertions, 7 deletions
diff --git a/ui/qt/voip_calls_dialog.cpp b/ui/qt/voip_calls_dialog.cpp index 20f6488b22..73282a02f4 100644 --- a/ui/qt/voip_calls_dialog.cpp +++ b/ui/qt/voip_calls_dialog.cpp @@ -59,9 +59,10 @@ const int initial_speaker_col_ = 2; const int from_col_ = 3; const int to_col_ = 4; const int protocol_col_ = 5; -const int packets_col_ = 6; -const int state_col_ = 7; -const int comments_col_ = 8; +const int duration_col_ = 6; +const int packets_col_ = 7; +const int state_col_ = 8; +const int comments_col_ = 9; Q_DECLARE_METATYPE(voip_calls_info_t*) @@ -72,7 +73,8 @@ class VoipCallsTreeWidgetItem : public QTreeWidgetItem public: VoipCallsTreeWidgetItem(QTreeWidget *tree, voip_calls_info_t *call_info) : QTreeWidgetItem(tree, voip_calls_type_), - call_info_(call_info) + call_info_(call_info), + mTimeOfDay_(false) { drawData(); } @@ -84,19 +86,27 @@ public: } void drawData() { + guint callDuration = nstime_to_sec(&(call_info_->stop_fd->abs_ts)) - nstime_to_sec(&(call_info_->start_fd->abs_ts)); if (!call_info_) { setText(start_time_col_, QObject::tr("Error")); return; } - // XXX Pull digit count from capture file precision - setText(start_time_col_, QString::number(nstime_to_sec(&(call_info_->start_rel_ts)), 'f', 6)); - setText(stop_time_col_, QString::number(nstime_to_sec(&(call_info_->stop_rel_ts)), 'f', 6)); + if (mTimeOfDay_) { + setText(start_time_col_, QDateTime::fromTime_t(nstime_to_sec(&(call_info_->start_fd->abs_ts))).toTimeSpec(Qt::LocalTime).toString("yyyy-MM-dd hh:mm:ss")); + setText(stop_time_col_, QDateTime::fromTime_t(nstime_to_sec(&(call_info_->stop_fd->abs_ts))).toTimeSpec(Qt::LocalTime).toString("yyyy-MM-dd hh:mm:ss")); + } else { + // XXX Pull digit count from capture file precision + setText(start_time_col_, QString::number(nstime_to_sec(&(call_info_->start_rel_ts)), 'f', 6)); + setText(stop_time_col_, QString::number(nstime_to_sec(&(call_info_->stop_rel_ts)), 'f', 6)); + } + setText(initial_speaker_col_, address_to_display_qstring(&(call_info_->initial_speaker))); setText(from_col_, call_info_->from_identity); setText(to_col_, call_info_->to_identity); setText(protocol_col_, ((call_info_->protocol == VOIP_COMMON) && call_info_->protocol_name) ? call_info_->protocol_name : voip_protocol_name[call_info_->protocol]); + setText(duration_col_, QString("%1:%2:%3").arg(callDuration / 3600, 2, 10, QChar('0')).arg((callDuration % 3600) / 60, 2, 10, QChar('0')).arg(callDuration % 60, 2, 10, QChar('0'))); setText(packets_col_, QString::number(call_info_->npackets)); setText(state_col_, voip_call_state_name[call_info_->call_state]); @@ -157,6 +167,7 @@ public: case from_col_: case to_col_: case protocol_col_: + case duration_col_: case state_col_: case comments_col_: return text(col); @@ -199,8 +210,15 @@ public: // Fall back to string comparison return QTreeWidgetItem::operator <(other); } + + void setTimeOfDay(bool timeOfDay) + { + mTimeOfDay_ = timeOfDay; + } + private: voip_calls_info_t *call_info_; + bool mTimeOfDay_; }; VoipCallsDialog::VoipCallsDialog(QWidget &parent, CaptureFile &cf, bool all_flows) : @@ -357,6 +375,7 @@ void VoipCallsDialog::updateCalls() QTreeWidgetItemIterator iter(ui->callTreeWidget); while (*iter) { VoipCallsTreeWidgetItem *vcti = static_cast<VoipCallsTreeWidgetItem*>(*iter); + vcti->setTimeOfDay(ui->todCheckBox->isChecked()); vcti->drawData(); ++iter; } @@ -661,6 +680,11 @@ void VoipCallsDialog::on_buttonBox_helpRequested() wsApp->helpTopicAction(HELP_TELEPHONY_VOIP_CALLS_DIALOG); } +void VoipCallsDialog::on_todCheckBox_clicked() +{ + updateCalls(); +} + /* * Editor modelines * diff --git a/ui/qt/voip_calls_dialog.h b/ui/qt/voip_calls_dialog.h index a6c2f76cc6..f9b9b22e69 100644 --- a/ui/qt/voip_calls_dialog.h +++ b/ui/qt/voip_calls_dialog.h @@ -100,6 +100,7 @@ private slots: void on_actionCopyAsYaml_triggered(); void on_buttonBox_clicked(QAbstractButton *button); void on_buttonBox_helpRequested(); + void on_todCheckBox_clicked(); }; #endif // VOIP_CALLS_DIALOG_H diff --git a/ui/qt/voip_calls_dialog.ui b/ui/qt/voip_calls_dialog.ui index e145393272..a9dc747c6c 100644 --- a/ui/qt/voip_calls_dialog.ui +++ b/ui/qt/voip_calls_dialog.ui @@ -60,6 +60,11 @@ </column> <column> <property name="text"> + <string>Duration</string> + </property> + </column> + <column> + <property name="text"> <string>Packets</string> </property> </column> @@ -83,6 +88,30 @@ </widget> </item> <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="todCheckBox"> + <property name="text"> + <string>Time of Day</string> + </property> + </widget> + </item> + </layout> + </item> + <item> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> |