diff options
Diffstat (limited to 'ui/qt/iax2_analysis_dialog.cpp')
-rw-r--r-- | ui/qt/iax2_analysis_dialog.cpp | 66 |
1 files changed, 31 insertions, 35 deletions
diff --git a/ui/qt/iax2_analysis_dialog.cpp b/ui/qt/iax2_analysis_dialog.cpp index 7e3fb82e..dfac2ee7 100644 --- a/ui/qt/iax2_analysis_dialog.cpp +++ b/ui/qt/iax2_analysis_dialog.cpp @@ -134,7 +134,7 @@ public: } } - guint32 frameNum() { return frame_num_; } + uint32_t frameNum() { return frame_num_; } bool frameStatus() { return ok_; } QList<QVariant> rowData() { @@ -153,19 +153,14 @@ public: switch (treeWidget()->sortColumn()) { case (packet_col_): return frame_num_ < other_row->frame_num_; - break; case (delta_col_): return delta_ < other_row->delta_; - break; case (jitter_col_): return jitter_ < other_row->jitter_; - break; case (bandwidth_col_): return bandwidth_ < other_row->bandwidth_; - break; case (length_col_): return pkt_len_ < other_row->pkt_len_; - break; default: break; } @@ -174,9 +169,9 @@ public: return QTreeWidgetItem::operator <(other); } private: - guint32 frame_num_; - guint32 pkt_len_; - guint32 flags_; + uint32_t frame_num_; + uint32_t pkt_len_; + uint32_t flags_; double delta_; double jitter_; double bandwidth_; @@ -228,6 +223,9 @@ Iax2AnalysisDialog::Iax2AnalysisDialog(QWidget &parent, CaptureFile &cf) : this, SLOT(graphClicked(QMouseEvent*))); graph_ctx_menu_.addAction(ui->actionSaveGraph); + ui->streamGraph->setContextMenuPolicy(Qt::CustomContextMenu); + connect(ui->streamGraph, &QCustomPlot::customContextMenuRequested, this, + &Iax2AnalysisDialog::showGraphMenu); QStringList header_labels; for (int i = 0; i < ui->forwardTreeWidget->columnCount(); i++) { @@ -289,9 +287,9 @@ Iax2AnalysisDialog::Iax2AnalysisDialog(QWidget &parent, CaptureFile &cf) : #if 0 /* Only accept Voice or MiniPacket packets */ - const gchar filter_text[] = "iax2.call && (ip || ipv6)"; + const char filter_text[] = "iax2.call && (ip || ipv6)"; #else - const gchar filter_text[] = "iax2 && (ip || ipv6)"; + const char filter_text[] = "iax2 && (ip || ipv6)"; #endif dfilter_t *sfcode; df_error_t *df_err; @@ -318,7 +316,7 @@ Iax2AnalysisDialog::Iax2AnalysisDialog(QWidget &parent, CaptureFile &cf) : epan_dissect_t edt; - epan_dissect_init(&edt, cap_file_.capFile()->epan, TRUE, FALSE); + epan_dissect_init(&edt, cap_file_.capFile()->epan, true, false); epan_dissect_prime_with_dfilter(&edt, sfcode); epan_dissect_run(&edt, cap_file_.capFile()->cd_t, &cap_file_.capFile()->rec, frame_tvbuff_new_buffer(&cap_file_.capFile()->provider, fdata, &cap_file_.capFile()->buf), @@ -337,10 +335,10 @@ Iax2AnalysisDialog::Iax2AnalysisDialog(QWidget &parent, CaptureFile &cf) : dfilter_free(sfcode); /* ok, it is a IAX2 frame, so let's get the ip and port values */ - rtpstream_id_copy_pinfo(&(edt.pi),&(fwd_id_),FALSE); + rtpstream_id_copy_pinfo(&(edt.pi),&(fwd_id_),false); /* assume the inverse ip/port combination for the reverse direction */ - rtpstream_id_copy_pinfo(&(edt.pi),&(rev_id_),TRUE); + rtpstream_id_copy_pinfo(&(edt.pi),&(rev_id_),true); epan_dissect_cleanup(&edt); @@ -652,8 +650,8 @@ void Iax2AnalysisDialog::resetStatistics() memset(&fwd_statinfo_, 0, sizeof(fwd_statinfo_)); memset(&rev_statinfo_, 0, sizeof(rev_statinfo_)); - fwd_statinfo_.first_packet = TRUE; - rev_statinfo_.first_packet = TRUE; + fwd_statinfo_.first_packet = true; + rev_statinfo_.first_packet = true; fwd_statinfo_.reg_pt = PT_UNDEFINED; rev_statinfo_.reg_pt = PT_UNDEFINED; @@ -703,17 +701,17 @@ void Iax2AnalysisDialog::addPacket(bool forward, packet_info *pinfo, const struc } // iax2_analysis.c:rtp_packet_save_payload -const guint8 silence_pcmu_ = 0xff; -const guint8 silence_pcma_ = 0x55; +const uint8_t silence_pcmu_ = 0xff; +const uint8_t silence_pcma_ = 0x55; void Iax2AnalysisDialog::savePayload(QTemporaryFile *tmpfile, packet_info *pinfo, const struct _iax2_info_t *iax2info) { /* Is this the first packet we got in this direction? */ // if (statinfo->flags & STAT_FLAG_FIRST) { // if (saveinfo->fp == NULL) { -// saveinfo->saved = FALSE; +// saveinfo->saved = false; // saveinfo->error_type = TAP_RTP_FILE_OPEN_ERROR; // } else { -// saveinfo->saved = TRUE; +// saveinfo->saved = true; // } // } @@ -896,9 +894,9 @@ void Iax2AnalysisDialog::saveAudio(Iax2AnalysisDialog::StreamDirection direction } QFile save_file(file_path); - gint16 sample; - guint8 pd[4]; - gboolean stop_flag = FALSE; + int16_t sample; + uint8_t pd[4]; + bool stop_flag = false; qint64 nchars; save_file.open(QIODevice::WriteOnly); @@ -1009,16 +1007,16 @@ void Iax2AnalysisDialog::saveAudio(Iax2AnalysisDialog::StreamDirection direction case dir_both_: { char f_rawvalue, r_rawvalue; - guint32 f_write_silence = 0; - guint32 r_write_silence = 0; + uint32_t f_write_silence = 0; + uint32_t r_write_silence = 0; /* since conversation in one way can start later than in the other one, * we have to write some silence information for one channel */ if (fwd_statinfo_.start_time > rev_statinfo_.start_time) { - f_write_silence = (guint32) + f_write_silence = (uint32_t) ((fwd_statinfo_.start_time - rev_statinfo_.start_time) * (8000/1000)); } else if (fwd_statinfo_.start_time < rev_statinfo_.start_time) { - r_write_silence = (guint32) + r_write_silence = (uint32_t) ((rev_statinfo_.start_time - fwd_statinfo_.start_time) * (8000/1000)); } @@ -1222,16 +1220,14 @@ bool Iax2AnalysisDialog::eventFilter(QObject *, QEvent *event) return false; } -void Iax2AnalysisDialog::graphClicked(QMouseEvent *event) +void Iax2AnalysisDialog::showGraphMenu(const QPoint &pos) +{ + graph_ctx_menu_.popup(ui->streamGraph->mapToGlobal(pos)); +} + +void Iax2AnalysisDialog::graphClicked(QMouseEvent *) { updateWidgets(); - if (event->button() == Qt::RightButton) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0 ,0) - graph_ctx_menu_.popup(event->globalPosition().toPoint()); -#else - graph_ctx_menu_.popup(event->globalPos()); -#endif - } } void Iax2AnalysisDialog::showStreamMenu(QPoint pos) |