From fe01f0109d890ba673772cbfcc1ec101120f98c6 Mon Sep 17 00:00:00 2001 From: Joerg Mayer Date: Sun, 21 Nov 2021 22:05:36 +0100 Subject: [PATCH] Readd feature to make QtXMultimedia optional again In order to be able to defer solving all Qt6 API differences at once I tried to reactivate the QT_MULTIMEDIA_LIB feature. I managed to fix most problems but one problem remains in both Qt5 and Qt6 builds. Without Qt[56]Multimedia, the following error exceeds my non-existing C++ knowledge: jmayer/work/wireshark/git/ui/qt/rtp_player_dialog.cpp:154:18: error: out-of-line definition of 'RtpPlayerDialog' does not match any declaration in 'RtpPlayerDialog' RtpPlayerDialog::RtpPlayerDialog(QWidget &parent, CaptureFile &cf, bool capture_running) : ^~~~~~~~~~~~~~~ --- CMakeLists.txt | 7 ++++++- cmakeconfig.h.in | 2 +- ui/qt/main_window_slots.cpp | 4 ++++ ui/qt/rtp_player_dialog.cpp | 4 +++- ui/qt/rtp_player_dialog.h | 3 +++ 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 133f16a6c4..b795333273 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1251,7 +1251,8 @@ if(BUILD_wireshark) Qt${qtver}Core Qt${qtver}Gui Qt${qtver}LinguistTools - Qt${qtver}Multimedia + # Our code currently does not compile with Qt6Multimedia + # Qt${qtver}Multimedia Qt${qtver}PrintSupport Qt${qtver}Widgets ) @@ -1268,6 +1269,7 @@ if(BUILD_wireshark) set(MIN_MACOS_VERSION 10.14) endif() else() + list(APPEND QT_PACKAGELIST Qt5Multimedia) if(WIN32) list(APPEND QT_PACKAGELIST Qt5WinExtras) endif() @@ -1291,6 +1293,9 @@ if(BUILD_wireshark) if(APPLE) ws_find_package(Sparkle ENABLE_SPARKLE HAVE_SOFTWARE_UPDATE) endif() + if(Qt${qtver}Multimedia_FOUND) + set(QT_MULTIMEDIA_LIB 1) + endif() endif() # MaxMind DB address resolution diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in index 0ff116c162..6b920ad75b 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -281,7 +281,7 @@ #cmakedefine HAVE_UNISTD_H 1 /* Define if we have QtMultimedia */ -#define QT_MULTIMEDIA_LIB 1 +#cmakedefine QT_MULTIMEDIA_LIB 1 /* Build androiddump with libpcap instead of wireshark stuff */ #cmakedefine ANDROIDDUMP_USE_LIBPCAP 1 diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index cb7ee278d3..f17f1e4a84 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -3576,8 +3576,10 @@ void MainWindow::on_actionTelephonyRtpPlayer_triggered() QMessageBox::warning(this, tr("RTP packet search failed"), err, QMessageBox::Ok); +#ifdef QT_MULTIMEDIA_LIB } else { openTelephonyRtpPlayerDialog()->addRtpStreams(stream_ids); +#endif // QT_MULTIMEDIA_LIB } foreach(rtpstream_id_t *id, stream_ids) { rtpstream_id_free(id); @@ -4165,6 +4167,7 @@ void MainWindow::activatePluginIFToolbar(bool) } } +#ifdef QT_MULTIMEDIA_LIB void MainWindow::rtpPlayerDialogReplaceRtpStreams(QVector stream_ids) { openTelephonyRtpPlayerDialog()->replaceRtpStreams(stream_ids); @@ -4179,6 +4182,7 @@ void MainWindow::rtpPlayerDialogRemoveRtpStreams(QVector strea { openTelephonyRtpPlayerDialog()->removeRtpStreams(stream_ids); } +#endif // QT_MULTIMEDIA_LIB void MainWindow::rtpAnalysisDialogReplaceRtpStreams(QVector stream_ids) { diff --git a/ui/qt/rtp_player_dialog.cpp b/ui/qt/rtp_player_dialog.cpp index d4dec83638..7372b789aa 100644 --- a/ui/qt/rtp_player_dialog.cpp +++ b/ui/qt/rtp_player_dialog.cpp @@ -134,6 +134,7 @@ public: }; +#ifdef QT_MULTIMEDIA_LIB RtpPlayerDialog *RtpPlayerDialog::pinstance_{nullptr}; std::mutex RtpPlayerDialog::mutex_; @@ -148,6 +149,7 @@ RtpPlayerDialog *RtpPlayerDialog::openRtpPlayerDialog(QWidget &parent, CaptureFi } return pinstance_; } +#endif // QT_MULTIMEDIA_LIB RtpPlayerDialog::RtpPlayerDialog(QWidget &parent, CaptureFile &cf, bool capture_running) : WiresharkDialog(parent, cf) @@ -158,7 +160,6 @@ RtpPlayerDialog::RtpPlayerDialog(QWidget &parent, CaptureFile &cf, bool capture_ , first_stream_rel_stop_time_(0.0) , streams_length_(0.0) , start_marker_time_(0.0) -#endif // QT_MULTIMEDIA_LIB , number_ticker_(new QCPAxisTicker) , datetime_ticker_(new QCPAxisTickerDateTime) , stereo_available_(false) @@ -170,6 +171,7 @@ RtpPlayerDialog::RtpPlayerDialog(QWidget &parent, CaptureFile &cf, bool capture_ , lock_ui_(0) , read_capture_enabled_(capture_running) , silence_skipped_time_(0.0) +#endif // QT_MULTIMEDIA_LIB { ui->setupUi(this); loadGeometry(parent.width(), parent.height()); diff --git a/ui/qt/rtp_player_dialog.h b/ui/qt/rtp_player_dialog.h index cc3d20b516..a9902b3773 100644 --- a/ui/qt/rtp_player_dialog.h +++ b/ui/qt/rtp_player_dialog.h @@ -26,7 +26,10 @@ #include #include #include + +#ifdef QT_MULTIMEDIA_LIB #include +#endif namespace Ui { class RtpPlayerDialog;