diff --git a/contrib/src/mpcdec/0006-adapted-patch-0001-shared.patch-from-buildroot.patch b/contrib/src/mpcdec/0006-adapted-patch-0001-shared.patch-from-buildroot.patch index b02e17a8501ae9f2c544c31896cc3de8dceeedae..78223c415ec07ca556742c44251c12fe3c2873f2 100644 --- a/contrib/src/mpcdec/0006-adapted-patch-0001-shared.patch-from-buildroot.patch +++ b/contrib/src/mpcdec/0006-adapted-patch-0001-shared.patch-from-buildroot.patch @@ -1,7 +1,7 @@ -From 617c72c7df93da5bcca2febbad066e31a411d976 Mon Sep 17 00:00:00 2001 +From 714e0e572ea7746831b5fa5434ea2669180e702f Mon Sep 17 00:00:00 2001 From: r2d <r2d@c51c8d5e-032a-db11-a0f2-0002b3467eef> Date: Sun, 14 Feb 2016 22:07:10 +0000 -Subject: [PATCH 6/6] adapted patch 0001-shared.patch from buildroot: +Subject: [PATCH 6/7] adapted patch 0001-shared.patch from buildroot: https://git.busybox.net/buildroot/tree/package/musepack/0001-shared.patch original changelog : @@ -16,7 +16,7 @@ git-svn-id: http://svn.musepack.net/libmpc/trunk@491 c51c8d5e-032a-db11-a0f2-000 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libmpcdec/CMakeLists.txt b/libmpcdec/CMakeLists.txt -index fb18968..fa9c800 100644 +index 5579d55..7ce5e94 100644 --- a/libmpcdec/CMakeLists.txt +++ b/libmpcdec/CMakeLists.txt @@ -4,7 +4,6 @@ SET(mpcdec_VERSION_PATCH 1) @@ -29,7 +29,7 @@ index fb18968..fa9c800 100644 ${libmpc_SOURCE_DIR}/include/mpc/reader.h @@ -12,12 +11,16 @@ install(FILES ${libmpc_SOURCE_DIR}/include/mpc/mpc_types.h - DESTINATION include/mpcdec COMPONENT headers) + DESTINATION include/mpc COMPONENT headers) +include_directories(${libmpc_SOURCE_DIR}/include) if(SHARED) @@ -49,5 +49,5 @@ index fb18968..fa9c800 100644 endif(SHARED) -- -2.37.3.windows.1 +2.45.0.windows.1 diff --git a/contrib/src/mpcdec/0007-only-build-libmpcdec.patch b/contrib/src/mpcdec/0007-only-build-libmpcdec.patch new file mode 100644 index 0000000000000000000000000000000000000000..28cb2bf888ce2531784a9610c2750328bab634cd --- /dev/null +++ b/contrib/src/mpcdec/0007-only-build-libmpcdec.patch @@ -0,0 +1,24 @@ +From 0b5a35b4a87952465717a76d5dcdadf52b930ba9 Mon Sep 17 00:00:00 2001 +From: Steve Lhomme <robux4@ycbcr.xyz> +Date: Wed, 13 Nov 2024 14:25:36 +0100 +Subject: [PATCH 7/7] only build libmpcdec + +We don't need anything else for VLC +--- + CMakeLists.txt | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 50666fe..237daf1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -25,6 +25,3 @@ if(NOT MSVC) + endif(NOT MSVC) + + add_subdirectory(libmpcdec) +-add_subdirectory(libmpcpsy) +-add_subdirectory(libmpcenc) +-add_subdirectory(libwavformat) +-- +2.45.0.windows.1 + diff --git a/contrib/src/mpcdec/musepack-asinh-msvc.patch b/contrib/src/mpcdec/musepack-asinh-msvc.patch index c6bb01e2c468eacfc8db46d53139e8744c2a4da2..7efc3eb6302a458e3c4c296eb5b0ef8a24760197 100644 --- a/contrib/src/mpcdec/musepack-asinh-msvc.patch +++ b/contrib/src/mpcdec/musepack-asinh-msvc.patch @@ -1,11 +1,25 @@ ---- musepack.clean/libmpcpsy/psy_tab.c 2014-12-03 15:25:37.877616700 +0100 -+++ musepack/libmpcpsy/psy_tab.c 2014-12-03 15:20:59.300071300 +0100 -@@ -186,7 +187,7 @@ +From db238381db9763ca1a7fc066a613a087b37d87e2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr> +Date: Wed, 3 Dec 2014 15:47:33 +0100 +Subject: [PATCH 3/7] contribs: Fix mpcdec build with MSVC + +--- + libmpcpsy/psy_tab.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libmpcpsy/psy_tab.c b/libmpcpsy/psy_tab.c +index 35c56ac..698601c 100644 +--- a/libmpcpsy/psy_tab.c ++++ b/libmpcpsy/psy_tab.c +@@ -187,7 +187,7 @@ Ruhehoerschwelle ( PsyModel* m, } } - + -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER < 1800 static double asinh ( double x ) { +-- +2.45.0.windows.1 + diff --git a/contrib/src/mpcdec/musepack-no-binaries.patch b/contrib/src/mpcdec/musepack-no-binaries.patch index bb48e8515f6697bb1c869ae64aca5a59a2965f84..0bf76c45f1a1815afa2cb4c2b2896a81450afba7 100644 --- a/contrib/src/mpcdec/musepack-no-binaries.patch +++ b/contrib/src/mpcdec/musepack-no-binaries.patch @@ -1,7 +1,17 @@ -diff -urN musepack_src_r475.clean/CMakeLists.txt musepack_src_r475/CMakeLists.txt ---- musepack_src_r475.clean/CMakeLists.txt 2012-04-17 15:16:37.000000000 +0400 -+++ musepack_src_r475/CMakeLists.txt 2012-04-17 15:17:07.000000000 +0400 -@@ -23,11 +23,4 @@ +From 22bfcda42e120ffe18b727a53b346fb489ebd88f Mon Sep 17 00:00:00 2001 +From: Pavlov Konstantin <thresh@videolan.org> +Date: Tue, 17 Apr 2012 13:18:34 +0200 +Subject: [PATCH 2/7] don't build binaries + +--- + CMakeLists.txt | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a6478c5..06d4363 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -23,11 +23,4 @@ add_subdirectory(libmpcdec) add_subdirectory(libmpcpsy) add_subdirectory(libmpcenc) add_subdirectory(libwavformat) @@ -13,3 +23,6 @@ diff -urN musepack_src_r475.clean/CMakeLists.txt musepack_src_r475/CMakeLists.tx -add_subdirectory(mpcchap) -add_subdirectory(wavcmp) add_subdirectory(include) +-- +2.45.0.windows.1 + diff --git a/contrib/src/mpcdec/musepack-no-cflags-clobber.patch b/contrib/src/mpcdec/musepack-no-cflags-clobber.patch index 2a376e33b8fd6279b548e9db2044d2b865bb19b7..f2e5251faee64be2f2dac096cf052191c427301e 100644 --- a/contrib/src/mpcdec/musepack-no-cflags-clobber.patch +++ b/contrib/src/mpcdec/musepack-no-cflags-clobber.patch @@ -1,7 +1,17 @@ -diff -ru musepack.orig/CMakeLists.txt musepack/CMakeLists.txt ---- musepack.orig/CMakeLists.txt 2011-08-08 10:21:17.000000000 +0300 -+++ musepack/CMakeLists.txt 2011-08-08 10:21:03.000000000 +0300 -@@ -16,7 +16,7 @@ +From 1f177a63ae04331f07be40b6cbfda312c51ac0c8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net> +Date: Mon, 8 Aug 2011 17:31:04 +0200 +Subject: [PATCH 1/7] do not clobber our precious CFLAGS + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b13f78c..a6478c5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -16,7 +16,7 @@ endif(WIN32) add_definitions(-DFAST_MATH -DCVD_FASTLOG) if(NOT MSVC) @@ -10,3 +20,6 @@ diff -ru musepack.orig/CMakeLists.txt musepack/CMakeLists.txt endif(NOT MSVC) add_subdirectory(libmpcdec) +-- +2.45.0.windows.1 + diff --git a/contrib/src/mpcdec/rules.mak b/contrib/src/mpcdec/rules.mak index 3452f1205fa68254b30f37b59919ea8c389fa4a5..f12959694671f2d2f5222fdabce6f0a4aa4a8f38 100644 --- a/contrib/src/mpcdec/rules.mak +++ b/contrib/src/mpcdec/rules.mak @@ -32,6 +32,7 @@ musepack: musepack_src_r$(MUSE_REV).tar.gz .sum-mpcdec $(APPLY) $(SRC)/mpcdec/0004-libmpcdec-added-install-and-soversion.patch $(APPLY) $(SRC)/mpcdec/0005-If-BUILD_SHARED_LIBS-is-set-and-SHARED-undefined-the.patch $(APPLY) $(SRC)/mpcdec/0006-adapted-patch-0001-shared.patch-from-buildroot.patch + $(APPLY) $(SRC)/mpcdec/0007-only-build-libmpcdec.patch $(MOVE) .mpcdec: musepack toolchain.cmake diff --git a/extras/ci/gitlab-ci.yml b/extras/ci/gitlab-ci.yml index f3282108ddfb029496e30d1805e7046aa52529cb..eaeadf824cd9830d03ac039feb2615d0c291a5b5 100644 --- a/extras/ci/gitlab-ci.yml +++ b/extras/ci/gitlab-ci.yml @@ -18,6 +18,7 @@ variables: VLC_UWP_LLVM_IMAGE: registry.videolan.org/vlc-debian-llvm-uwp:20211020111246 VLC_WIN_LLVM_UCRT_IMAGE: registry.videolan.org/vlc-debian-llvm-ucrt:20241111035123 VLC_DEBIAN_IMAGE: registry.videolan.org/vlc-debian-unstable:20200229201904 + VLC_DEBIAN_QT6_IMAGE: registry.videolan.org/vlc-debian-unstable:20241112155431 VLC_ANDROID_IMAGE: registry.videolan.org/vlc-debian-android-3.0:20230621085943 VLC_SNAP_IMAGE: registry.videolan.org/vlc-ubuntu-bionic:20190627090437 @@ -268,6 +269,37 @@ debian: fi variables: *variables-debian +debian-qt6: + extends: .docker-template + image: + name: $VLC_DEBIAN_QT6_IMAGE + script: | + export NCPU=$(getconf _NPROCESSORS_ONLN) + + # Build tools + ( cd extras/tools && ./bootstrap && make -j$NCPU --output-sync=recurse ) + export PATH="$(pwd)/extras/tools/build/bin:$PATH" + + # Build contribs + mkdir -p contrib/contrib-$TRIPLET && cd contrib/contrib-$TRIPLET + ../bootstrap + make list + if [ -n "$VLC_PREBUILT_CONTRIBS_URL" ]; then + echo "Building using prebuilt contribs at $VLC_PREBUILT_CONTRIBS_URL" + make prebuilt PREBUILT_URL="${VLC_PREBUILT_CONTRIBS_URL}" + else + make -j$NCPU --output-sync=recurse fetch + make -j$NCPU --output-sync=recurse + make package + fi + cd ../../ + + # Build VLC + ./bootstrap + ./configure + make -j$NCPU + variables: *variables-debian + nightly-debian: extends: debian only: diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am index c67f4afc1387207b8bd075aadd092c18ae590b4e..e97caed4927af2bc53991e7142e993504caa08ea 100644 --- a/modules/gui/qt/Makefile.am +++ b/modules/gui/qt/Makefile.am @@ -12,6 +12,8 @@ SUFFIXES += .ui .h .hpp .moc.cpp libqt_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \ + -DQT_USE_QSTRINGBUILDER \ + -DQT_NO_CAST_FROM_BYTEARRAY \ -I$(srcdir)/gui/qt -I$(builddir)/gui/qt libqt_plugin_la_CXXFLAGS = $(AM_CXXFLAGS) $(QT_CFLAGS) $(CXXFLAGS_qt) libqt_plugin_la_LIBADD = $(QT_LIBS) $(LIBS_qt) $(LIBM) diff --git a/modules/gui/qt/components/controller.cpp b/modules/gui/qt/components/controller.cpp index 59d84ad344e72e9d924c3721f467063fda135e25..2e327e5ab9d8ad46ec30120a0780017b68318aa5 100644 --- a/modules/gui/qt/components/controller.cpp +++ b/modules/gui/qt/components/controller.cpp @@ -52,6 +52,9 @@ #include <QApplication> #include <QWindow> #include <QScreen> +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) +#include <QDesktopWidget> +#endif //#define DEBUG_LAYOUT 1 @@ -721,7 +724,6 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, #ifdef DEBUG_LAYOUT setStyleSheet( "background: red "); #endif - setAttribute( Qt::WA_MacBrushedMetal); controlLayout = new QVBoxLayout( this ); controlLayout->setContentsMargins( 3, 1, 0, 1 ); controlLayout->setSpacing( 0 ); @@ -894,7 +896,7 @@ void FullscreenControllerWidget::restoreFSC() if ( targetScreen() < 0 ) return; - QRect currentRes = QApplication::desktop()->screenGeometry( targetScreen() ); + QRect currentRes = QGuiApplication::screens()[ targetScreen() ]->geometry(); QWindow *wh = windowHandle(); if ( wh != Q_NULLPTR ) { @@ -930,7 +932,7 @@ void FullscreenControllerWidget::restoreFSC() void FullscreenControllerWidget::centerFSC( int number ) { - QRect currentRes = QApplication::desktop()->screenGeometry( number ); + QRect currentRes = QGuiApplication::screens()[ number ]->geometry(); /* screen has changed, calculate new position */ QPoint pos = QPoint( currentRes.x() + (currentRes.width() / 2) - (width() / 2), @@ -1004,7 +1006,7 @@ void FullscreenControllerWidget::slowHideFSC() void FullscreenControllerWidget::updateFullwidthGeometry( int number ) { - QRect screenGeometry = QApplication::desktop()->screenGeometry( number ); + QRect screenGeometry = QGuiApplication::screens()[ number ]->geometry(); setMinimumWidth( screenGeometry.width() ); setGeometry( screenGeometry.x(), screenGeometry.y() + screenGeometry.height() - height(), screenGeometry.width(), height() ); adjustSize(); @@ -1027,8 +1029,23 @@ void FullscreenControllerWidget::setTargetScreen(int screennumber) int FullscreenControllerWidget::targetScreen() { - if( i_screennumber < 0 || i_screennumber >= QApplication::desktop()->screenCount() ) + if( i_screennumber < 0 || i_screennumber >= QGuiApplication::screens().length() ) + { +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + auto *screen = QGuiApplication::screenAt( p_intf->p_sys->p_mi->pos() ); + if (screen != nullptr) + { + for (qsizetype i = 0; i < QGuiApplication::screens().length(); i++) + { + if (screen == QGuiApplication::screens()[i]) + return i; + } + } + return -1; +#else return QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi ); +#endif + } return i_screennumber; } @@ -1113,18 +1130,23 @@ void FullscreenControllerWidget::mouseMoveEvent( QMouseEvent *event ) if( i_mouse_last_x == -1 || i_mouse_last_y == -1 ) return; - int i_moveX = event->globalX() - i_mouse_last_x; - int i_moveY = event->globalY() - i_mouse_last_y; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + const auto pos = event->globalPosition(); +#else + const auto pos = event->globalPos(); +#endif + int i_moveX = pos.x() - i_mouse_last_x; + int i_moveY = pos.y() - i_mouse_last_y; - const QRect screenRect = QApplication::desktop()->screenGeometry( targetScreen() ); + const QRect screenRect = QGuiApplication::screens()[ targetScreen() ]->geometry(); const int i_x = qBound( screenRect.left(), x() + i_moveX, screenRect.right() - width() ); const int i_y = qBound( screenRect.top(), y() + i_moveY, screenRect.bottom() - height() ); move( i_x, i_y ); - i_mouse_last_x = event->globalX(); - i_mouse_last_y = event->globalY(); + i_mouse_last_x = pos.x(); + i_mouse_last_y = pos.y(); } } @@ -1135,8 +1157,13 @@ void FullscreenControllerWidget::mouseMoveEvent( QMouseEvent *event ) void FullscreenControllerWidget::mousePressEvent( QMouseEvent *event ) { if( isWideFSC ) return; - i_mouse_last_x = event->globalX(); - i_mouse_last_y = event->globalY(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + auto pos = event->globalPosition(); +#else + auto pos = event->globalPos(); +#endif + i_mouse_last_x = pos.x(); + i_mouse_last_y = pos.y(); event->accept(); } @@ -1154,7 +1181,11 @@ void FullscreenControllerWidget::mouseReleaseEvent( QMouseEvent *event ) /** * On mouse go above FSC */ +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +void FullscreenControllerWidget::enterEvent( QEnterEvent *event ) +#else void FullscreenControllerWidget::enterEvent( QEvent *event ) +#endif { b_mouse_over = true; diff --git a/modules/gui/qt/components/controller.hpp b/modules/gui/qt/components/controller.hpp index ab7b29f194a52ae7369eba02801f7be020c17ec4..3275108cb1a13ea04af0a7db173de42ffc67d1b6 100644 --- a/modules/gui/qt/components/controller.hpp +++ b/modules/gui/qt/components/controller.hpp @@ -277,7 +277,11 @@ protected: void mouseMoveEvent( QMouseEvent *event ) Q_DECL_OVERRIDE; void mousePressEvent( QMouseEvent *event ) Q_DECL_OVERRIDE; void mouseReleaseEvent( QMouseEvent *event ) Q_DECL_OVERRIDE; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + void enterEvent( QEnterEvent *event ) Q_DECL_OVERRIDE; +#else void enterEvent( QEvent *event ) Q_DECL_OVERRIDE; +#endif void leaveEvent( QEvent *event ) Q_DECL_OVERRIDE; void keyPressEvent( QKeyEvent *event ) Q_DECL_OVERRIDE; diff --git a/modules/gui/qt/components/extended_panels.hpp b/modules/gui/qt/components/extended_panels.hpp index 87cba5de39a54e3701748bff0f2a857821a042e2..34fb63952f26c6b966964c623b08f61d79762051 100644 --- a/modules/gui/qt/components/extended_panels.hpp +++ b/modules/gui/qt/components/extended_panels.hpp @@ -74,7 +74,7 @@ class ExtV4l2 : public QWidget public: ExtV4l2( intf_thread_t *, QWidget * ); - void showEvent( QShowEvent *event ) Q_DECL_OVERRIDE; + void showEvent( QShowEvent *event ) override; private: intf_thread_t *p_intf; @@ -162,13 +162,13 @@ public: const slider_data_t *p_data, int index ); protected: - float initialValue() Q_DECL_OVERRIDE; + float initialValue() override; int index; QStringList getBandsFromAout() const; - void writeToConfig(); + void writeToConfig() override; public slots: - void onValueChanged( int i ) Q_DECL_OVERRIDE; + void onValueChanged( int i ) override; }; class Equalizer: public AudioFilterControlWidget @@ -179,7 +179,7 @@ public: Equalizer( intf_thread_t *, QWidget * ); protected: - void build() Q_DECL_OVERRIDE; + void build() override; private: FilterSliderData *preamp; diff --git a/modules/gui/qt/components/info_panels.cpp b/modules/gui/qt/components/info_panels.cpp index 88503145f4a2bb0aa54f9dee44f4ca24ff2b9737..6d3c0ce7498fffe31a1f6fa180d60ea5e13e36b8 100644 --- a/modules/gui/qt/components/info_panels.cpp +++ b/modules/gui/qt/components/info_panels.cpp @@ -516,7 +516,7 @@ void InfoPanel::update( input_item_t *p_item) current_item->addChild(child_item); } - InfoTree->setItemExpanded( current_item, true); + current_item->setExpanded(true); } } diff --git a/modules/gui/qt/components/info_panels.hpp b/modules/gui/qt/components/info_panels.hpp index 1490425dd3b662bb9f303bd1ae760e8a4f54e5a4..c5549f70c88f5a4c27ed9969fd059d368687767b 100644 --- a/modules/gui/qt/components/info_panels.hpp +++ b/modules/gui/qt/components/info_panels.hpp @@ -113,7 +113,7 @@ class InputStatsPanel: public QWidget public: InputStatsPanel( QWidget * ); protected: - void hideEvent( QHideEvent * ) Q_DECL_OVERRIDE; + void hideEvent( QHideEvent * ) override; private: QTreeWidget *StatsTree; QTreeWidgetItem *input; diff --git a/modules/gui/qt/components/interface_widgets.cpp b/modules/gui/qt/components/interface_widgets.cpp index 86d288835746eb75081b4f16f0a858072da5aab3..556bdf9e4020cf5ba761d315943196c55bc9607f 100644 --- a/modules/gui/qt/components/interface_widgets.cpp +++ b/modules/gui/qt/components/interface_widgets.cpp @@ -43,6 +43,14 @@ #include <QPainter> #include <QTimer> #include <QUrl> +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include <QRandomGenerator> + +static inline int qrand() { + auto * q = QRandomGenerator::system(); + return q->generate(); +} +#endif #if defined (QT5_HAS_X11) # include <X11/Xlib.h> @@ -82,6 +90,7 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i, QWidget* p_parent ) layout->setContentsMargins( 0, 0, 0, 0 ); stable = NULL; p_window = NULL; + qApp->installNativeEventFilter(this); show(); } @@ -261,7 +270,11 @@ void VideoWidget::setSize( unsigned int w, unsigned int h ) sync(); } -bool VideoWidget::nativeEvent( const QByteArray& eventType, void* message, long* ) +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +bool VideoWidget::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *) +#else +bool VideoWidget::nativeEventFilter(const QByteArray &eventType, void *message, long *) +#endif { #if defined(QT5_HAS_X11) # if defined(QT5_HAS_XCB) diff --git a/modules/gui/qt/components/interface_widgets.hpp b/modules/gui/qt/components/interface_widgets.hpp index c953004d627495073d1ecc8172bd45679fd42f71..995b8e012913230e9ce1171672d99492b55a1506 100644 --- a/modules/gui/qt/components/interface_widgets.hpp +++ b/modules/gui/qt/components/interface_widgets.hpp @@ -43,6 +43,7 @@ #include <QLabel> #include <QMouseEvent> #include <QPropertyAnimation> +#include <QAbstractNativeEventFilter> class QMenu; class QSlider; @@ -51,7 +52,7 @@ class SpeedControlWidget; struct vout_window_t; /******************** Video Widget ****************/ -class VideoWidget : public QFrame +class VideoWidget : public QFrame, public QAbstractNativeEventFilter { Q_OBJECT public: @@ -68,7 +69,11 @@ protected: return NULL; } - bool nativeEvent(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override; +#else + bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override; +#endif virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; diff --git a/modules/gui/qt/components/open_panels.cpp b/modules/gui/qt/components/open_panels.cpp index 5463af50781061ebc7f48e4552a978a8f2c8d76b..61d2359b52bc057f12afb2e793e82e05f42cbed9 100644 --- a/modules/gui/qt/components/open_panels.cpp +++ b/modules/gui/qt/components/open_panels.cpp @@ -39,9 +39,6 @@ #include <vlc_intf_strings.h> #include <vlc_modules.h> #include <vlc_plugin.h> -#ifdef _WIN32 - #include <vlc_charset.h> /* FromWide for Win32 */ -#endif #include <QFileDialog> #include <QDialogButtonBox> @@ -381,16 +378,14 @@ void DiscOpenPanel::onFocus() wchar_t psz_name[512] = L""; GetVolumeInformationW( drive, psz_name, 511, NULL, NULL, NULL, NULL, 0 ); - char *psz_drive = FromWide( drive ); + QString psz_drive = QString::fromWCharArray( drive ); QString displayName = psz_drive; - char *psz_title = FromWide( psz_name ); - if( !EMPTY_STR(psz_title)) { + QString psz_title = QString::fromWCharArray( psz_name ); + if( !psz_title.isEmpty()) { displayName = displayName + " - " + psz_title; } - ui.deviceCombo->addItem( displayName, qfu(psz_drive) ); - free( psz_drive ); - free( psz_title ); + ui.deviceCombo->addItem( displayName, psz_drive ); } /* go to next drive */ diff --git a/modules/gui/qt/components/playlist/selector.cpp b/modules/gui/qt/components/playlist/selector.cpp index 308e245ca3672d3aac5628664644636c84363413..3925a3f6b8a0e4fce39f67ec7c9414cd2fe67f52 100644 --- a/modules/gui/qt/components/playlist/selector.cpp +++ b/modules/gui/qt/components/playlist/selector.cpp @@ -640,8 +640,8 @@ int PLSelector::getCurrentItemCategory() void PLSelector::wheelEvent( QWheelEvent *e ) { if( verticalScrollBar()->isVisible() && ( - (verticalScrollBar()->value() != verticalScrollBar()->minimum() && e->delta() >= 0 ) || - (verticalScrollBar()->value() != verticalScrollBar()->maximum() && e->delta() < 0 ) + (verticalScrollBar()->value() != verticalScrollBar()->minimum() && e->pixelDelta().y() >= 0 ) || + (verticalScrollBar()->value() != verticalScrollBar()->maximum() && e->pixelDelta().y() < 0 ) ) ) QApplication::sendEvent(verticalScrollBar(), e); diff --git a/modules/gui/qt/components/playlist/selector.hpp b/modules/gui/qt/components/playlist/selector.hpp index 2e333a3a6648f79401486a1d4084825863c19794..d0c612aac681033f97ba3139cbfd1468e0dd645d 100644 --- a/modules/gui/qt/components/playlist/selector.hpp +++ b/modules/gui/qt/components/playlist/selector.hpp @@ -99,7 +99,11 @@ signals: void action( PLSelItem* ); private: +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + inline void enterEvent( QEnterEvent* ){ showAction(); } +#else inline void enterEvent( QEvent* ){ showAction(); } +#endif inline void leaveEvent( QEvent* ){ hideAction(); } QTreeWidgetItem* qitem; diff --git a/modules/gui/qt/components/playlist/standardpanel.cpp b/modules/gui/qt/components/playlist/standardpanel.cpp index f4107cad45868d6ec91436d056161cde2dfabc4b..e3dfd88d7425de002e77c53b1564b6e86e9cabb4 100644 --- a/modules/gui/qt/components/playlist/standardpanel.cpp +++ b/modules/gui/qt/components/playlist/standardpanel.cpp @@ -538,7 +538,7 @@ void StandardPLPanel::browseInto() void StandardPLPanel::wheelEvent( QWheelEvent *e ) { if( e->modifiers() & Qt::ControlModifier ) { - int numSteps = e->delta() / 8 / 15; + int numSteps = e->pixelDelta().y() / 8 / 15; if( numSteps > 0) increaseZoom(); else if( numSteps < 0) diff --git a/modules/gui/qt/components/playlist/vlc_model.cpp b/modules/gui/qt/components/playlist/vlc_model.cpp index e56efde560d6685cc1e5d84bb5b6bb818e78defe..9a881d0b2145f2548f7024f792b9f7c1ef9164d0 100644 --- a/modules/gui/qt/components/playlist/vlc_model.cpp +++ b/modules/gui/qt/components/playlist/vlc_model.cpp @@ -83,7 +83,7 @@ QPixmap VLCModel::getArtPixmap( const QModelIndex & index, const QSize & size ) QString key = artUrl + QString("%1%2").arg(size.width()).arg(size.height()); - if( !QPixmapCache::find( key, artPix )) + if( !QPixmapCache::find( key, &artPix )) { if( artUrl.isEmpty() == false ) { @@ -97,7 +97,7 @@ QPixmap VLCModel::getArtPixmap( const QModelIndex & index, const QSize & size ) } } key = QString("noart%1%2").arg(size.width()).arg(size.height()); - if( !QPixmapCache::find( key, artPix ) ) + if( !QPixmapCache::find( key, &artPix ) ) { artPix = QPixmap( ":/noart" ).scaled( size, Qt::KeepAspectRatio, @@ -206,7 +206,7 @@ void VLCModel::ensureArtRequested( const QModelIndex &index ) QModelIndex child; for( int row = 0 ; row < nbnodes ; row++ ) { - child = index.child( row, COLUMN_COVER ); + child = index.model()->index( row, COLUMN_COVER ); if ( child.isValid() && child.data().toString().isEmpty() ) THEMIM->getIM()->requestArtUpdate( getInputItem( child ), false ); } diff --git a/modules/gui/qt/components/preferences_widgets.cpp b/modules/gui/qt/components/preferences_widgets.cpp index ef15ee23503b9f26a2fc50277693807c5608e27d..08ca74c4cf2aa0d54cfa01bad22bf6a35f696ff7 100644 --- a/modules/gui/qt/components/preferences_widgets.cpp +++ b/modules/gui/qt/components/preferences_widgets.cpp @@ -622,8 +622,6 @@ void ModuleListConfigControl::fillGrid( QGridLayout *l, int line ) ModuleListConfigControl::~ModuleListConfigControl() { - foreach ( checkBoxListItem *it, modules ) - free( it->psz_module ); qDeleteAll( modules ); modules.clear(); delete groupBox; @@ -653,10 +651,10 @@ void ModuleListConfigControl::checkbox_lists( QString label, QString help, const cb->setToolTip( formatTooltip( help ) ); cbl->checkBox = cb; - cbl->psz_module = strdup( psz_module ); + cbl->psz_module = qfu( psz_module ); modules.append( cbl ); - if( p_item->value.psz && strstr( p_item->value.psz, cbl->psz_module ) ) + if( p_item->value.psz && strstr( p_item->value.psz, psz_module ) ) cbl->checkBox->setChecked( true ); } @@ -1404,13 +1402,13 @@ KeyInputDialog::KeyInputDialog( QTreeWidget *_table, existingkeys = NULL; table = _table; - setWindowTitle( ( b_global ? qtr( "Global" ) + QString(" ") : "" ) - + qtr( "Hotkey change" ) ); + setWindowTitle( b_global ? qtr( "Global Hotkey change" ) + : qtr( "Hotkey change" ) ); setWindowRole( "vlc-key-input" ); QVBoxLayout *vLayout = new QVBoxLayout( this ); - selected = new QLabel( qtr( "Press the new key or combination for " ) - + QString("<b>%1</b>").arg( keyToChange ) ); + selected = new QLabel( qtr( "Press the new key or combination for <b>%1</b>" ) + .arg( keyToChange ) ); vLayout->addWidget( selected , Qt::AlignCenter ); warning = new QLabel; @@ -1453,8 +1451,9 @@ void KeyInputDialog::checkForConflicts( int i_vlckey, const QString &sequence ) !conflictList[0]->data( b_global ? 2 : 1, Qt::UserRole ).toString().isEmpty() && conflictList[0]->data( b_global ? 2 : 1, Qt::UserRole ).toString() != "Unset" ) { - warning->setText( qtr("Warning: this key or combination is already assigned to ") + - QString( "\"<b>%1</b>\"" ).arg( conflictList[0]->text( 0 ) ) ); + warning->setText( + qtr("Warning: this key or combination is already assigned to \"<b>%1</b>\"") + .arg( conflictList[0]->text( 0 ) ) ); warning->show(); ok->show(); unset->hide(); @@ -1488,8 +1487,7 @@ void KeyInputDialog::keyPressEvent( QKeyEvent *e ) return; int i_vlck = qtEventToVLCKey( e ); QKeySequence sequence( e->key() | e->modifiers() ); - selected->setText( qtr( "Key or combination: " ) - + QString("<b>%1</b>").arg( VLCKeyToString( i_vlck, true ) ) ); + selected->setText( qtr( "Key or combination: <b>%1</b>" ).arg( VLCKeyToString( i_vlck, true ) ) ); checkForConflicts( i_vlck, sequence.toString() ); keyValue = i_vlck; } @@ -1497,7 +1495,7 @@ void KeyInputDialog::keyPressEvent( QKeyEvent *e ) void KeyInputDialog::wheelEvent( QWheelEvent *e ) { int i_vlck = qtWheelEventToVLCKey( e ); - selected->setText( qtr( "Key: " ) + VLCKeyToString( i_vlck, true ) ); + selected->setText( qtr( "Key: <b>%1</b>" ).arg( VLCKeyToString( i_vlck, true ) ) ); checkForConflicts( i_vlck, QString() ); keyValue = i_vlck; } diff --git a/modules/gui/qt/components/preferences_widgets.hpp b/modules/gui/qt/components/preferences_widgets.hpp index aa27563b1bf30ce3fb63d5902a95ef82980e64ea..a40825afbc74c891e14e2eae2e1aeca9c28b5d0c 100644 --- a/modules/gui/qt/components/preferences_widgets.hpp +++ b/modules/gui/qt/components/preferences_widgets.hpp @@ -407,7 +407,7 @@ private: struct checkBoxListItem { QCheckBox *checkBox; - char *psz_module; + QString psz_module; }; class ModuleListConfigControl : public VStringConfigControl diff --git a/modules/gui/qt/components/simple_preferences.cpp b/modules/gui/qt/components/simple_preferences.cpp index 5e138c9628243f27fb5198621d9d0e1a42ae185d..f117239722b8fede2759636781fb240f62139f0c 100644 --- a/modules/gui/qt/components/simple_preferences.cpp +++ b/modules/gui/qt/components/simple_preferences.cpp @@ -642,18 +642,21 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, "for DVD, VCD, and CDDA are set.\n" "You can define a unique one or configure them \n" "individually in the advanced preferences." ) ); - char *psz_dvddiscpath = config_GetPsz( p_intf, "dvd" ); - char *psz_vcddiscpath = config_GetPsz( p_intf, "vcd" ); - char *psz_cddadiscpath = config_GetPsz( p_intf, "cd-audio" ); - if( psz_dvddiscpath && psz_vcddiscpath && psz_cddadiscpath ) - if( !strcmp( psz_cddadiscpath, psz_dvddiscpath ) && - !strcmp( psz_dvddiscpath, psz_vcddiscpath ) ) + bool have_cdda = module_exists( "cdda" ); + char *dvd_discpath = config_GetPsz( p_intf, "dvd" ); + char *vcd_discpath = config_GetPsz( p_intf, "vcd" ); + char *cdda_discpath = have_cdda ? config_GetPsz( p_intf, "cd-audio" ) : nullptr; + if( dvd_discpath && vcd_discpath && ( !have_cdda || cdda_discpath ) ) { - ui.DVDDeviceComboBox->setEditText( qfu( psz_dvddiscpath ) ); + if( !strcmp( dvd_discpath, vcd_discpath ) && + ( !have_cdda || !strcmp( cdda_discpath, dvd_discpath ) ) ) + { + ui.DVDDeviceComboBox->setEditText( qfu( dvd_discpath ) ); + } } - free( psz_cddadiscpath ); - free( psz_dvddiscpath ); - free( psz_vcddiscpath ); + free( cdda_discpath ); + free( dvd_discpath ); + free( vcd_discpath ); } #ifndef _WIN32 QStringList DVDDeviceComboBoxStringList = QStringList(); @@ -1092,9 +1095,10 @@ void SPrefsPanel::apply() qobject_cast<QComboBox *>(optionWidgets["inputLE"])->currentText().toUtf8(); if( devicepath.size() > 0 ) { - config_PutPsz( p_intf, "dvd", devicepath ); - config_PutPsz( p_intf, "vcd", devicepath ); - config_PutPsz( p_intf, "cd-audio", devicepath ); + config_PutPsz( p_intf, "dvd", devicepath.constData() ); + config_PutPsz( p_intf, "vcd", devicepath.constData() ); + if( module_exists( "cdda" ) ) + config_PutPsz( p_intf, "cd-audio", devicepath.constData() ); } #define CaC( name, factor ) config_PutInt( p_intf, name, i_comboValue * factor ) diff --git a/modules/gui/qt/dialogs/convert.cpp b/modules/gui/qt/dialogs/convert.cpp index 8a87518fa9429a57bc6d07ff1986cda14ab20f96..20dd643cc42ff9f01bcab8d6ac69913ebc8a6313 100644 --- a/modules/gui/qt/dialogs/convert.cpp +++ b/modules/gui/qt/dialogs/convert.cpp @@ -156,7 +156,7 @@ ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf, void ConvertDialog::fileBrowse() { - QString fileExtension = ( ! profile->isEnabled() ) ? ".*" : "." + profile->getMux(); + QString fileExtension = ( ! profile->isEnabled() ) ? QStringLiteral(".*") : QStringLiteral(".") + profile->getMux(); outgoingMRL = QFileDialog::getSaveFileUrl( this, qtr( "Save file..." ), p_intf->p_sys->filepath, @@ -208,7 +208,7 @@ void ConvertDialog::close() // Multiple, use the convention. else { - QString fileExtension = ( ! profile->isEnabled() ) ? ".*" : "." + profile->getMux(); + QString fileExtension = ( ! profile->isEnabled() ) ? QStringLiteral(".*") : QStringLiteral(".") + profile->getMux(); newFileName = incomingMRLs->at(i); diff --git a/modules/gui/qt/dialogs/extensions.hpp b/modules/gui/qt/dialogs/extensions.hpp index 2894aa9ff8d5b3a8ffee262986066f1f6fd8a8b1..05f2b7ab66c55349c9a87024ad0f1d4a87ed7e5f 100644 --- a/modules/gui/qt/dialogs/extensions.hpp +++ b/modules/gui/qt/dialogs/extensions.hpp @@ -105,8 +105,8 @@ private: void DestroyWidget( extension_widget_t *p_widget, bool b_cond = true ); protected: - void closeEvent( QCloseEvent* ) Q_DECL_OVERRIDE; - void keyPressEvent( QKeyEvent* ) Q_DECL_OVERRIDE; + void closeEvent( QCloseEvent* ) override; + void keyPressEvent( QKeyEvent* ) override; private slots: int TriggerClick( QObject *object ); diff --git a/modules/gui/qt/dialogs/gototime.hpp b/modules/gui/qt/dialogs/gototime.hpp index 9f980b221a8ad4fbbc1a702ebc22a3f7c67298d1..79c55486efddbffc69b2c4cc352ca4e3aa206019 100644 --- a/modules/gui/qt/dialogs/gototime.hpp +++ b/modules/gui/qt/dialogs/gototime.hpp @@ -37,8 +37,8 @@ private: virtual ~GotoTimeDialog(); QTimeEdit *timeEdit; private slots: - void close() Q_DECL_OVERRIDE; - void cancel() Q_DECL_OVERRIDE; + void close() override; + void cancel() override; void reset(); friend class Singleton<GotoTimeDialog>; diff --git a/modules/gui/qt/dialogs/help.cpp b/modules/gui/qt/dialogs/help.cpp index 5a78d1a71b0a126689dbe9727906cddb555c25d6..6244e3bd1fea48783fb8135d1deea43b8c2c70e4 100644 --- a/modules/gui/qt/dialogs/help.cpp +++ b/modules/gui/qt/dialogs/help.cpp @@ -306,7 +306,7 @@ void UpdateDialog::updateNotify( bool b_result ) .arg( QString::number( p_release->i_major ) ) .arg( QString::number( p_release->i_minor ) ) .arg( QString::number( p_release->i_revision ) ) - .arg( p_release->i_extra == 0 ? "" : "." + QString::number( p_release->i_extra ) ); + .arg( p_release->i_extra == 0 ? QStringLiteral("") : QStringLiteral(".") + QString::number( p_release->i_extra ) ); ui.updateNotifyLabel->setText( message ); message = qfu( p_release->psz_desc ).replace( "\n", "<br/>" ); diff --git a/modules/gui/qt/dialogs/mediainfo.hpp b/modules/gui/qt/dialogs/mediainfo.hpp index 34a40c316b670464d29d341e32bc009aff979518..f2f266bb4f9332bac4dbb1ee911f4603917e8aa0 100644 --- a/modules/gui/qt/dialogs/mediainfo.hpp +++ b/modules/gui/qt/dialogs/mediainfo.hpp @@ -71,7 +71,7 @@ private slots: void updateAllTabs( input_item_t * ); void clearAllTabs(); - void close() Q_DECL_OVERRIDE; + void close() override; void saveMeta(); void updateButtons( int i_tab ); diff --git a/modules/gui/qt/dialogs/open.cpp b/modules/gui/qt/dialogs/open.cpp index bbfce715bf86d84811df2e489d5e60c3295b51fa..4c0b7900927de020d9f4ec3744e2d3d58c3e71ff 100644 --- a/modules/gui/qt/dialogs/open.cpp +++ b/modules/gui/qt/dialogs/open.cpp @@ -32,6 +32,8 @@ #include <QRegularExpression> #include <QMenu> +#include <cstddef> + #ifndef NDEBUG # define DEBUG_QT 1 #endif @@ -411,7 +413,7 @@ void OpenDialog::stream( bool b_transcode_only ) toggleVisible(); /* Dbg and send :D */ - msg_Dbg( p_intf, "MRL(s) passed to the Sout: %i", soutMRLS.length() ); + msg_Dbg( p_intf, "MRL(s) passed to the Sout: %zu", static_cast<size_t>( soutMRLS.length() ) ); for(int i = 0; i < soutMRLS.length(); i++) { msg_Dbg( p_intf, "MRL(s) passed to the Sout: %s", qtu( soutMRLS[i] ) ); diff --git a/modules/gui/qt/dialogs/openurl.hpp b/modules/gui/qt/dialogs/openurl.hpp index d1d84b04f13c54b4b823f2961bb7812dc51833d7..baaaf26503ca0720b2fe1762741dd174ae4c2f14 100644 --- a/modules/gui/qt/dialogs/openurl.hpp +++ b/modules/gui/qt/dialogs/openurl.hpp @@ -53,10 +53,10 @@ public: QString url() const; bool shouldEnqueue() const; - void showEvent( QShowEvent *ev ) Q_DECL_OVERRIDE; + void showEvent( QShowEvent *ev ) override; public slots: - void close() Q_DECL_OVERRIDE { play(); } + void close() override { play(); } }; diff --git a/modules/gui/qt/dialogs/plugins.hpp b/modules/gui/qt/dialogs/plugins.hpp index a0da1073c04a1fc81bc223741ef80868e4e17564..390152a9f4a34afe69e27fa3391f29f1c8630411 100644 --- a/modules/gui/qt/dialogs/plugins.hpp +++ b/modules/gui/qt/dialogs/plugins.hpp @@ -143,7 +143,7 @@ private slots: private: AddonsTab( intf_thread_t *p_intf ); virtual ~AddonsTab(); - bool eventFilter ( QObject * watched, QEvent * event ); + bool eventFilter ( QObject * watched, QEvent * event ) override; enum { diff --git a/modules/gui/qt/dialogs/toolbar.cpp b/modules/gui/qt/dialogs/toolbar.cpp index 22e351ccf613bffa067f9de2642835b116ddfde8..714f63d1bddcbb54034d1a31f9e5b8a6608bc245 100644 --- a/modules/gui/qt/dialogs/toolbar.cpp +++ b/modules/gui/qt/dialogs/toolbar.cpp @@ -333,7 +333,7 @@ void PreviewWidget::paintEvent( QPaintEvent * ) if ( !strcmp( item->widget()->metaObject()->className(), "QLabel" ) ) { QPainter eraser( &pixmaps[i] ); - eraser.fillRect( item->geometry(), palette().background() ); + eraser.fillRect( item->geometry(), palette().window() ); eraser.end(); } } diff --git a/modules/gui/qt/dialogs/vlm.hpp b/modules/gui/qt/dialogs/vlm.hpp index 2983115c148b6349227868fa6f86e02dcff087af..a1cb42c07578d893b67f5a8caafc438a490e4b3a 100644 --- a/modules/gui/qt/dialogs/vlm.hpp +++ b/modules/gui/qt/dialogs/vlm.hpp @@ -181,7 +181,7 @@ public: VLMBroadcast( VLMWrapper *, const QString& name, const QString& input, const QString& inputOptions, const QString& output, bool _enable, bool _loop, VLMDialog *parent ); - void update() Q_DECL_OVERRIDE; + void update() override; private: bool b_looped; bool b_playing; diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp index fc33ec517f8f02ec771b686fad813f2ff9986308..d6a6e262392f9c26965bda3bb052dd2a4ab05508 100644 --- a/modules/gui/qt/main_interface.cpp +++ b/modules/gui/qt/main_interface.cpp @@ -57,7 +57,6 @@ #include <QWindow> #include <QMenu> #include <QMenuBar> -#include <QStatusBar> #include <QLabel> #include <QStackedWidget> #include <QScreen> @@ -65,6 +64,10 @@ #include <QFileInfo> #endif +#ifndef QT_NO_STATUSBAR +# include <QStatusBar> +#endif + #if ! HAS_QT510 && defined(QT5_HAS_X11) # include <QX11Info> # include <X11/Xlib.h> @@ -168,11 +171,13 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) createMainWidget( settings ); +#ifndef QT_NO_STATUSBAR /************** * Status Bar * **************/ createStatusBar(); setStatusBarVisibility( getSettings()->value( "MainWindow/status-bar-visible", false ).toBool() ); +#endif /********************************* * Create the Systray Management * @@ -550,6 +555,7 @@ inline void MainInterface::initSystray() createSystray(); } +#ifndef QT_NO_STATUSBAR inline void MainInterface::createStatusBar() { /**************** @@ -587,8 +593,10 @@ inline void MainInterface::createStatusBar() elapsed time.*/ CONNECT( timeLabel, doubleClicked(), THEDP, gotoTimeDialog() ); +#ifndef QT_NO_STATUSBAR CONNECT( THEMIM->getIM(), encryptionChanged( bool ), this, showCryptedLabel( bool ) ); +#endif /* This shouldn't be necessary, but for somehow reason, the statusBarr starts at height of 20px and when a text is shown it needs more space. @@ -598,6 +606,7 @@ inline void MainInterface::createStatusBar() */ statusBarr->setFixedHeight( statusBarr->sizeHint().height() + 2 ); } +#endif /********************************************************************** * Handling of sizing of the components @@ -812,7 +821,7 @@ void MainInterface::setVideoSize( unsigned int w, unsigned int h ) */ if (b_autoresize) { - QRect screen = QApplication::desktop()->availableGeometry(); + QRect screen = QGuiApplication::primaryScreen()->availableGeometry(); #if HAS_QT56 float factor = videoWidget->devicePixelRatioF(); #else @@ -828,8 +837,10 @@ void MainInterface::setVideoSize( unsigned int w, unsigned int h ) h -= menuBar()->height(); if( controls->isVisible() ) h -= controls->height(); +#ifndef QT_NO_STATUSBAR if( statusBar()->isVisible() ) h -= statusBar()->height(); +#endif if( inputC->isVisible() ) h -= inputC->height(); } @@ -864,12 +875,12 @@ void MainInterface::setVideoFullScreen( bool fs ) { int numscreen = var_InheritInteger( p_intf, "qt-fullscreen-screennumber" ); - if ( numscreen >= 0 && numscreen < QApplication::desktop()->screenCount() ) + if ( numscreen >= 0 && numscreen < QGuiApplication::screens().length() ) { if( fullscreenControls ) fullscreenControls->setTargetScreen( numscreen ); - QRect screenres = QApplication::desktop()->screenGeometry( numscreen ); + QRect screenres = QGuiApplication::screens()[ numscreen ]->geometry(); lastWinScreen = windowHandle()->screen(); #ifdef QT5_HAS_WAYLAND if( !b_hasWayland ) @@ -1116,7 +1127,9 @@ void MainInterface::displayNormalView() { menuBar()->setVisible( false ); controls->setVisible( false ); +#ifndef QT_NO_STATUSBAR statusBar()->setVisible( false ); +#endif inputC->setVisible( false ); } @@ -1128,7 +1141,9 @@ void MainInterface::setMinimalView( bool b_minimal ) { bool b_menuBarVisible = menuBar()->isVisible(); bool b_controlsVisible = controls->isVisible(); +#ifndef QT_NO_STATUSBAR bool b_statusBarVisible = statusBar()->isVisible(); +#endif bool b_inputCVisible = inputC->isVisible(); if( !isFullScreen() && !isMaximized() && b_minimal && !b_isWindowTiled ) @@ -1139,8 +1154,10 @@ void MainInterface::setMinimalView( bool b_minimal ) i_heightChange += menuBar()->height(); if( b_controlsVisible ) i_heightChange += controls->height(); +#ifndef QT_NO_STATUSBAR if( b_statusBarVisible ) i_heightChange += statusBar()->height(); +#endif if( b_inputCVisible ) i_heightChange += inputC->height(); @@ -1150,7 +1167,9 @@ void MainInterface::setMinimalView( bool b_minimal ) menuBar()->setVisible( !b_minimal ); controls->setVisible( !b_minimal ); +#ifndef QT_NO_STATUSBAR statusBar()->setVisible( !b_minimal && b_statusbarVisible ); +#endif inputC->setVisible( !b_minimal ); if( !isFullScreen() && !isMaximized() && !b_minimal && !b_isWindowTiled ) @@ -1161,8 +1180,10 @@ void MainInterface::setMinimalView( bool b_minimal ) i_heightChange += menuBar()->height(); if( !b_controlsVisible && controls->isVisible() ) i_heightChange += controls->height(); +#ifndef QT_NO_STATUSBAR if( !b_statusBarVisible && statusBar()->isVisible() ) i_heightChange += statusBar()->height(); +#endif if( !b_inputCVisible && inputC->isVisible() ) i_heightChange += inputC->height(); @@ -1230,9 +1251,11 @@ StandardPLPanel *MainInterface::getPlaylistView() void MainInterface::setStatusBarVisibility( bool b_visible ) { +#ifndef QT_NO_STATUSBAR statusBar()->setVisible( b_visible ); b_statusbarVisible = b_visible; if( controls ) controls->setGripVisible( !b_statusbarVisible ); +#endif } @@ -1274,6 +1297,7 @@ void MainInterface::setVLCWindowsTitle( const QString& aTitle ) void MainInterface::showCryptedLabel( bool b_show ) { +#ifndef QT_NO_STATUSBAR if( cryptedLabel == NULL ) { cryptedLabel = new QLabel; @@ -1284,12 +1308,7 @@ void MainInterface::showCryptedLabel( bool b_show ) } cryptedLabel->setVisible( b_show ); -} - -void MainInterface::showBuffering( float f_cache ) -{ - QString amount = QString("Buffering: %1%").arg( (int)(100*f_cache) ); - statusBar()->showMessage( amount, 1000 ); +#endif } /***************************************************************************** diff --git a/modules/gui/qt/main_interface.hpp b/modules/gui/qt/main_interface.hpp index e73a6b5ce6b7471b43ac0ba364d55162f6ab66b3..e7402e68ca0355decc4663fc255a45e416caf968 100644 --- a/modules/gui/qt/main_interface.hpp +++ b/modules/gui/qt/main_interface.hpp @@ -237,8 +237,6 @@ protected slots: void handleKeyPress( QKeyEvent * ); - void showBuffering( float ); - void resizeStack( int w, int h ) { if( !isFullScreen() && !isMaximized() && !b_isWindowTiled ) diff --git a/modules/gui/qt/main_interface_win32.cpp b/modules/gui/qt/main_interface_win32.cpp index 8e5f1b8c59dbe816e6697366ec2db1f871d1b1c3..8c69b037b7d16c7a5de47dcb457a707e41081295 100644 --- a/modules/gui/qt/main_interface_win32.cpp +++ b/modules/gui/qt/main_interface_win32.cpp @@ -91,6 +91,7 @@ MainInterfaceWin32::MainInterfaceWin32( intf_thread_t *_p_intf ) taskbar_wmsg = RegisterWindowMessage(TEXT("TaskbarButtonCreated")); if (taskbar_wmsg == 0) msg_Warn( p_intf, "Failed to register TaskbarButtonCreated message" ); + qApp->installNativeEventFilter(this); } MainInterfaceWin32::~MainInterfaceWin32() @@ -215,13 +216,14 @@ void MainInterfaceWin32::createTaskBarButtons() changeThumbbarButtons( THEMIM->getIM()->playingStatus() ); } -bool MainInterfaceWin32::nativeEvent(const QByteArray &, void *message, long *result) +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +bool MainInterfaceWin32::nativeEventFilter(const QByteArray &, void *message, qintptr *result) +#else +bool MainInterfaceWin32::nativeEventFilter(const QByteArray &, void *message, long *result) +#endif { - return winEvent( static_cast<MSG*>( message ), result ); -} + MSG * msg = static_cast<MSG*>( message ); -bool MainInterfaceWin32::winEvent ( MSG * msg, long * result ) -{ if (msg->message == taskbar_wmsg) { //We received the taskbarbuttoncreated, now we can really create the buttons diff --git a/modules/gui/qt/main_interface_win32.hpp b/modules/gui/qt/main_interface_win32.hpp index 1e456c4c35128319f119e366c34692f0fba7a4af..91e135cfe7ea1455405502f3564357d8a773d262 100644 --- a/modules/gui/qt/main_interface_win32.hpp +++ b/modules/gui/qt/main_interface_win32.hpp @@ -27,7 +27,9 @@ #include "main_interface.hpp" -class MainInterfaceWin32 : public MainInterface +#include <QAbstractNativeEventFilter> + +class MainInterfaceWin32 : public MainInterface, public QAbstractNativeEventFilter { Q_OBJECT @@ -36,8 +38,11 @@ public: virtual ~MainInterfaceWin32(); private: - virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; - virtual bool winEvent( MSG *, long * ); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override; +#else + bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override; +#endif virtual void toggleUpdateSystrayMenuWhenVisible() Q_DECL_OVERRIDE; protected: diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp index 3235cc6efaae0866c01d5ae02202920e24bba21b..3b6276cf4ce31f8dc2367f5c9092e9f179b966c8 100644 --- a/modules/gui/qt/menus.cpp +++ b/modules/gui/qt/menus.cpp @@ -54,7 +54,10 @@ #include <QAction> #include <QActionGroup> #include <QSignalMapper> -#include <QStatusBar> + +#ifndef QT_NO_STATUSBAR +# include <QStatusBar> +#endif /* This file defines the main menus and the pop-up menu (right-click menu) @@ -531,10 +534,12 @@ QMenu *VLCMenuBar::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterfac action->setChecked( true ); action->setEnabled(mi->isAdvancedWidgetAvailable()); +#ifndef QT_NO_STATUSBAR action = menu->addAction( qtr( "Status Bar" ) ); action->setCheckable( true ); action->setChecked( mi->statusBar()->isVisible() ); CONNECT( action, triggered( bool ), mi, setStatusBarVisibility( bool) ); +#endif #if 0 /* For Visualisations. Not yet working */ adv = menu->addAction( qtr( "Visualizations selector" ), mi, SLOT( visual() ) ); diff --git a/modules/gui/qt/ui/open.ui b/modules/gui/qt/ui/open.ui index f105fe42bff36f4193a422dfa4687124a4e5a6da..b9c01307f050e3dc81929a367f9873f315deed15 100644 --- a/modules/gui/qt/ui/open.ui +++ b/modules/gui/qt/ui/open.ui @@ -249,9 +249,6 @@ <property name="displayFormat"> <string>HH'H':mm'm':ss's'.zzz</string> </property> - <property name="timeSpec"> - <enum>Qt::LocalTime</enum> - </property> </widget> </item> <item row="1" column="4" colspan="2"> @@ -268,9 +265,6 @@ <property name="displayFormat"> <string>HH'H':mm'm':ss's'.zzz</string> </property> - <property name="timeSpec"> - <enum>Qt::LocalTime</enum> - </property> </widget> </item> <item row="4" column="0" colspan="6"> diff --git a/modules/gui/qt/util/input_slider.cpp b/modules/gui/qt/util/input_slider.cpp index d26ecb7fad0001f2bc6d1d0693fcece78c9fbe54..85c9e83e4a1dd57599fdddb4137733674d97d073 100644 --- a/modules/gui/qt/util/input_slider.cpp +++ b/modules/gui/qt/util/input_slider.cpp @@ -281,7 +281,7 @@ void SeekSlider::processReleasedButton() void SeekSlider::mouseReleaseEvent( QMouseEvent *event ) { - if ( event->button() != Qt::LeftButton && event->button() != Qt::MidButton ) + if ( event->button() != Qt::LeftButton && event->button() != Qt::MiddleButton ) { QSlider::mouseReleaseEvent( event ); return; @@ -294,7 +294,7 @@ void SeekSlider::mousePressEvent( QMouseEvent* event ) { /* Right-click */ if ( !isEnabled() || - ( event->button() != Qt::LeftButton && event->button() != Qt::MidButton ) + ( event->button() != Qt::LeftButton && event->button() != Qt::MiddleButton ) ) { QSlider::mousePressEvent( event ); @@ -348,7 +348,7 @@ void SeekSlider::mousePressEvent( QMouseEvent* event ) void SeekSlider::mouseMoveEvent( QMouseEvent *event ) { - if ( ! ( event->buttons() & ( Qt::LeftButton | Qt::MidButton ) ) ) + if ( ! ( event->buttons() & ( Qt::LeftButton | Qt::MiddleButton ) ) ) { /* Handle button release when mouserelease has been hijacked by popup */ processReleasedButton(); @@ -386,7 +386,12 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event ) } } - QPoint target( event->globalX() - ( event->x() - posX ), +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + const auto pos = event->globalPosition(); +#else + const auto pos = event->globalPos(); +#endif + QPoint target( pos.x() - ( event->x() - posX ), QWidget::mapToGlobal( QPoint( 0, 0 ) ).y() ); if( likely( size().width() > handleLength() ) ) { secstotimestr( psz_length, getValuePercentageFromXPos( event->x() ) * inputLength ); @@ -403,7 +408,7 @@ void SeekSlider::wheelEvent( QWheelEvent *event ) { vlc_tick_t i_size = var_InheritInteger( p_intf->obj.libvlc, "short-jump-size" ); int i_mode = var_InheritInteger( p_intf->obj.libvlc, "hotkeys-x-wheel-mode" ); - if ( ( event->delta() < 0 && i_mode != 3 ) || ( event->delta() > 0 && i_mode == 3 ) ) + if ( ( event->pixelDelta().x() < 0 && i_mode != 3 ) || ( event->pixelDelta().x() > 0 && i_mode == 3 ) ) i_size = - i_size; float posOffset = static_cast<float>( i_size ) / static_cast<float>( inputLength ); setValue( value() + posOffset * maximum() ); @@ -412,7 +417,11 @@ void SeekSlider::wheelEvent( QWheelEvent *event ) event->accept(); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +void SeekSlider::enterEvent( QEnterEvent * ) +#else void SeekSlider::enterEvent( QEvent * ) +#endif { /* Cancel the fade-out timer */ hideHandleTimer->stop(); @@ -674,7 +683,7 @@ SoundSlider::SoundSlider( QWidget *_parent, float _i_step, void SoundSlider::wheelEvent( QWheelEvent *event ) { - int newvalue = value() + event->delta() / ( 8 * 15 ) * f_step; + int newvalue = value() + event->pixelDelta().y() / ( 8 * 15 ) * f_step; setValue( __MIN( __MAX( minimum(), newvalue ), maximum() ) ); emit sliderReleased(); diff --git a/modules/gui/qt/util/input_slider.hpp b/modules/gui/qt/util/input_slider.hpp index aad65ce4d49878da9f14b958e837e747d1970436..648088220baff85ce9367dce30aeccb3ff4d8b9c 100644 --- a/modules/gui/qt/util/input_slider.hpp +++ b/modules/gui/qt/util/input_slider.hpp @@ -65,7 +65,11 @@ protected: void mousePressEvent( QMouseEvent* event ) Q_DECL_OVERRIDE; void mouseReleaseEvent( QMouseEvent *event ) Q_DECL_OVERRIDE; void wheelEvent( QWheelEvent *event ) Q_DECL_OVERRIDE; - void enterEvent( QEvent * ) Q_DECL_OVERRIDE; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + void enterEvent( QEnterEvent *event ) Q_DECL_OVERRIDE; +#else + void enterEvent( QEvent *event ) Q_DECL_OVERRIDE; +#endif void leaveEvent( QEvent * ) Q_DECL_OVERRIDE; void hideEvent( QHideEvent * ) Q_DECL_OVERRIDE; void paintEvent(QPaintEvent *ev) Q_DECL_OVERRIDE; diff --git a/modules/gui/qt/util/pictureflow.cpp b/modules/gui/qt/util/pictureflow.cpp index cf00f9d8c9316f776b4b5820809a886f8cd97e4d..3977fe29fa9306a1b1854d1619bcbddacd66a37a 100644 --- a/modules/gui/qt/util/pictureflow.cpp +++ b/modules/gui/qt/util/pictureflow.cpp @@ -863,13 +863,13 @@ void PictureFlow::resizeEvent(QResizeEvent* event) void PictureFlow::wheelEvent(QWheelEvent * event) { - if (event->orientation() == Qt::Horizontal) + if (event->angleDelta().y() == 0) { event->ignore(); } else { - int numSteps = -((event->delta() / 8) / 15); + int numSteps = -((event->pixelDelta().y() / 8) / 15); if (numSteps > 0) { diff --git a/modules/gui/qt/util/qvlcframe.hpp b/modules/gui/qt/util/qvlcframe.hpp index fcbf75f8eee1aac48524329f8c7f7800150f4265..a139534c3d448b626fbd27536f5774ddfcb13e50 100644 --- a/modules/gui/qt/util/qvlcframe.hpp +++ b/modules/gui/qt/util/qvlcframe.hpp @@ -29,7 +29,7 @@ #include <QApplication> #include <QMainWindow> #include <QKeyEvent> -#include <QDesktopWidget> +#include <QScreen> #include <QSettings> #include <QStyle> @@ -115,7 +115,7 @@ class QVLCTools widget->resize(defSize); if(defPos.x() == 0 && defPos.y()==0) - widget->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, widget->size(), qApp->desktop()->availableGeometry())); + widget->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, widget->size(), QGuiApplication::primaryScreen()->availableGeometry())); return true; } return false; diff --git a/modules/gui/qt/util/timetooltip.cpp b/modules/gui/qt/util/timetooltip.cpp index 6de5cf1877d7c43057e141f9da0c1cd5842949b8..ffa2c099868ea675c259c2f03a01bead6728de8d 100644 --- a/modules/gui/qt/util/timetooltip.cpp +++ b/modules/gui/qt/util/timetooltip.cpp @@ -25,7 +25,11 @@ #include <QPainter> #include <QBitmap> #include <QFontMetrics> +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) #include <QDesktopWidget> +#else +#include <QScreen> +#endif #define TIP_HEIGHT 5 @@ -76,7 +80,14 @@ void TimeTooltip::adjustPosition() #endif // Keep the tooltip on the same screen if possible +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + QRect screen{}; + auto *screenAt = QGuiApplication::screenAt( mTarget ); + if (screenAt != nullptr) + screen = screenAt->geometry(); +#else QRect screen = QApplication::desktop()->screenGeometry( mTarget ); +#endif position.setX( qMax( screen.left(), qMin( position.x(), screen.left() + screen.width() - size.width() ) ) ); position.setY( qMax( screen.top(), qMin( position.y(), diff --git a/modules/gui/qt/util/validators.hpp b/modules/gui/qt/util/validators.hpp index 3375ee8f9a822eb348acac093b8b7a686c12a01f..b08262bfa2164f6564a18c426e58719fd0199615 100644 --- a/modules/gui/qt/util/validators.hpp +++ b/modules/gui/qt/util/validators.hpp @@ -30,8 +30,8 @@ class UrlValidator : public QValidator Q_OBJECT public: UrlValidator( QObject *parent ) : QValidator( parent ) { } - QValidator::State validate( QString&, int& ) const Q_DECL_OVERRIDE; - void fixup ( QString & input ) const Q_DECL_OVERRIDE; + QValidator::State validate( QString&, int& ) const override; + void fixup ( QString & input ) const override; }; #endif // VALIDATORS_HPP