diff options
-rw-r--r-- | ui/qt/decode_as_dialog.ui | 3 | ||||
-rw-r--r-- | ui/qt/rtp_analysis_dialog.cpp | 47 | ||||
-rw-r--r-- | ui/qt/rtp_analysis_dialog.h | 8 | ||||
-rw-r--r-- | ui/qt/rtp_player_dialog.cpp | 10 | ||||
-rw-r--r-- | ui/qt/rtp_player_dialog.h | 9 | ||||
-rw-r--r-- | ui/qt/voip_calls_dialog.cpp | 3 |
6 files changed, 69 insertions, 11 deletions
diff --git a/ui/qt/decode_as_dialog.ui b/ui/qt/decode_as_dialog.ui index 37153693f3..ced46ed447 100644 --- a/ui/qt/decode_as_dialog.ui +++ b/ui/qt/decode_as_dialog.ui @@ -16,9 +16,6 @@ <property name="indentation"> <number>0</number> </property> - <property name="uniformRowHeights"> - <bool>true</bool> - </property> <column> <property name="text"> <string>Field</string> diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp index 10d374628f..caf54d0839 100644 --- a/ui/qt/rtp_analysis_dialog.cpp +++ b/ui/qt/rtp_analysis_dialog.cpp @@ -45,6 +45,7 @@ #include "color_utils.h" #include "qt_ui_utils.h" +#include "rtp_player_dialog.h" #include "stock_icon.h" #include "wireshark_application.h" @@ -247,9 +248,11 @@ RtpAnalysisDialog::RtpAnalysisDialog(QWidget &parent, CaptureFile &cf) : port_src_fwd_(0), port_dst_fwd_(0), ssrc_fwd_(0), + stream_fwd_(0), port_src_rev_(0), port_dst_rev_(0), - ssrc_rev_(0) + ssrc_rev_(0), + stream_rev_(0) { ui->setupUi(this); setWindowSubtitle(tr("RTP Stream Analysis")); @@ -258,6 +261,8 @@ RtpAnalysisDialog::RtpAnalysisDialog(QWidget &parent, CaptureFile &cf) : resize(parent.width() * 4 / 5, parent.height() * 4 / 5); ui->progressFrame->hide(); + player_button_ = RtpPlayerDialog::addPlayerButton(ui->buttonBox); + stream_ctx_menu_.addAction(ui->actionGoToPacket); stream_ctx_menu_.addAction(ui->actionNextProblem); stream_ctx_menu_.addSeparator(); @@ -337,7 +342,7 @@ RtpAnalysisDialog::RtpAnalysisDialog(QWidget &parent, CaptureFile &cf) : save_menu->addAction(ui->actionSaveGraph); ui->buttonBox->button(QDialogButtonBox::Save)->setMenu(save_menu); - const gchar *filter_text = "rtp && rtp.version && rtp.ssrc && (ip || ipv6)"; + const gchar *filter_text = "rtp && rtp.version && rtp.ssrc"; dfilter_t *sfcode; gchar *err_msg; @@ -411,7 +416,6 @@ RtpAnalysisDialog::RtpAnalysisDialog(QWidget &parent, CaptureFile &cf) : rtpstream_scan(&tapinfo_, cap_file_.capFile(), NULL); num_streams_ = 0; - GList *filtered_list = NULL; for (GList *strinfo_list = g_list_first(tapinfo_.strinfo_list); strinfo_list; strinfo_list = g_list_next(strinfo_list)) { rtp_stream_info_t * strinfo = (rtp_stream_info_t*)(strinfo_list->data); if (ADDRESSES_EQUAL(&(strinfo->src_addr), &(src_fwd_)) @@ -420,7 +424,7 @@ RtpAnalysisDialog::RtpAnalysisDialog(QWidget &parent, CaptureFile &cf) : && (strinfo->dest_port == port_dst_fwd_)) { ++num_streams_; - filtered_list = g_list_prepend(filtered_list, strinfo); + stream_fwd_ = strinfo; } if (ADDRESSES_EQUAL(&(strinfo->src_addr), &(src_rev_)) @@ -429,9 +433,10 @@ RtpAnalysisDialog::RtpAnalysisDialog(QWidget &parent, CaptureFile &cf) : && (strinfo->dest_port == port_dst_rev_)) { ++num_streams_; - filtered_list = g_list_append(filtered_list, strinfo); - if (ssrc_rev_ == 0) + if (ssrc_rev_ == 0) { ssrc_rev_ = strinfo->ssrc; + stream_rev_ = strinfo; + } } } @@ -501,6 +506,13 @@ void RtpAnalysisDialog::updateWidgets() ui->actionSaveForwardCsv->setEnabled(enable_save_fwd_csv); ui->actionSaveReverseCsv->setEnabled(enable_save_rev_csv); +#if defined(QT_MULTIMEDIA_LIB) + player_button_->setEnabled(stream_fwd_ != 0); +#else + player_button_->setEnabled(false); + player_button_->setText(tr("No Audio")); +#endif + ui->tabWidget->setEnabled(enable_tab); hint.prepend("<small><i>"); hint.append("</i></small>"); @@ -657,6 +669,13 @@ void RtpAnalysisDialog::on_actionSaveGraph_triggered() } } +void RtpAnalysisDialog::on_buttonBox_clicked(QAbstractButton *button) +{ + if (button == player_button_) { + showPlayer(); + } +} + void RtpAnalysisDialog::on_buttonBox_helpRequested() { wsApp->helpTopicAction(HELP_RTP_ANALYSIS_DIALOG); @@ -1026,6 +1045,22 @@ void RtpAnalysisDialog::updateGraph() ui->streamGraph->replot(); } +void RtpAnalysisDialog::showPlayer() +{ +#ifdef QT_MULTIMEDIA_LIB + if (!stream_fwd_) return; + + RtpPlayerDialog rtp_player_dialog(*this, cap_file_); + + rtp_player_dialog.addRtpStream(stream_fwd_); + if (stream_rev_) rtp_player_dialog.addRtpStream(stream_rev_); + + connect(&rtp_player_dialog, SIGNAL(goToPacket(int)), this, SIGNAL(goToPacket(int))); + + rtp_player_dialog.exec(); +#endif // QT_MULTIMEDIA_LIB +} + // rtp_analysis.c:copy_file enum { save_audio_none_, save_audio_au_, save_audio_raw_ }; void RtpAnalysisDialog::saveAudio(RtpAnalysisDialog::StreamDirection direction) diff --git a/ui/qt/rtp_analysis_dialog.h b/ui/qt/rtp_analysis_dialog.h index cd83a6cd2a..68a749ff75 100644 --- a/ui/qt/rtp_analysis_dialog.h +++ b/ui/qt/rtp_analysis_dialog.h @@ -73,6 +73,7 @@ private slots: void on_actionSaveForwardCsv_triggered(); void on_actionSaveReverseCsv_triggered(); void on_actionSaveGraph_triggered(); + void on_buttonBox_clicked(QAbstractButton *button); void on_buttonBox_helpRequested(); void showStreamMenu(QPoint pos); void graphClicked(QMouseEvent *event); @@ -86,16 +87,21 @@ private: address dst_fwd_; guint32 port_dst_fwd_; guint32 ssrc_fwd_; + struct _rtp_stream_info *stream_fwd_; + address src_rev_; guint32 port_src_rev_; address dst_rev_; guint32 port_dst_rev_; guint32 ssrc_rev_; + struct _rtp_stream_info *stream_rev_; int num_streams_; tap_rtp_stat_t fwd_statinfo_; tap_rtp_stat_t rev_statinfo_; + QPushButton *player_button_; + QTemporaryFile *fwd_tempfile_; QTemporaryFile *rev_tempfile_; @@ -128,6 +134,8 @@ private: void updateStatistics(); void updateGraph(); + void showPlayer(); + void saveAudio(StreamDirection direction); void saveCsv(StreamDirection direction); diff --git a/ui/qt/rtp_player_dialog.cpp b/ui/qt/rtp_player_dialog.cpp index 716824f033..1b485df86b 100644 --- a/ui/qt/rtp_player_dialog.cpp +++ b/ui/qt/rtp_player_dialog.cpp @@ -294,6 +294,16 @@ void RtpPlayerDialog::addRtpStream(struct _rtp_stream_info *rtp_stream) // RTP_STREAM_DEBUG("adding stream %s to layout, %u packets, start %u", stream_key.toUtf8().constData(), rtp_stream->packet_count, rtp_stream->start_fd->num); } +QPushButton *RtpPlayerDialog::addPlayerButton(QDialogButtonBox *button_box) +{ + if (!button_box) return NULL; + + QPushButton *player_button; + player_button = button_box->addButton(tr("Play Streams"), QDialogButtonBox::ApplyRole); + player_button->setIcon(StockIcon("media-playback-start")); + return player_button; +} + void RtpPlayerDialog::showEvent(QShowEvent *) { QList<int> split_sizes = ui->splitter->sizes(); diff --git a/ui/qt/rtp_player_dialog.h b/ui/qt/rtp_player_dialog.h index 61a916e9b0..a218cede1b 100644 --- a/ui/qt/rtp_player_dialog.h +++ b/ui/qt/rtp_player_dialog.h @@ -39,6 +39,7 @@ class RtpPlayerDialog; struct _rtp_stream_info; class QCPItemStraightLine; +class QDialogButtonBox; class QMenu; class RtpAudioStream; @@ -59,6 +60,14 @@ public: */ void addRtpStream(struct _rtp_stream_info *rtp_stream); + /** + * @brief Common routine to add a "Play call" button to a QDialogButtonBox. + * @param button_box Caller's QDialogButtonBox. + * @return The new "Play call" button. + */ + // XXX We might want to move this to qt_ui_utils. + static QPushButton *addPlayerButton(QDialogButtonBox *button_box); + public slots: signals: diff --git a/ui/qt/voip_calls_dialog.cpp b/ui/qt/voip_calls_dialog.cpp index 8a49fe07fc..ee15caf6ca 100644 --- a/ui/qt/voip_calls_dialog.cpp +++ b/ui/qt/voip_calls_dialog.cpp @@ -185,8 +185,7 @@ VoipCallsDialog::VoipCallsDialog(QWidget &parent, CaptureFile &cf, bool all_flow prepare_button_ = ui->buttonBox->addButton(tr("Prepare Filter"), QDialogButtonBox::ApplyRole); sequence_button_ = ui->buttonBox->addButton(tr("Flow Sequence"), QDialogButtonBox::ApplyRole); - player_button_ = ui->buttonBox->addButton(tr("Play Call"), QDialogButtonBox::ApplyRole); - player_button_->setIcon(StockIcon("media-playback-start")); + player_button_ = RtpPlayerDialog::addPlayerButton(ui->buttonBox); // XXX Use recent settings instead resize(parent.width() * 4 / 5, parent.height() * 2 / 3); |