From 0e1c7f8c47f872a7adaedfacf0455c570b42187f Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Thu, 13 Jul 2023 07:32:16 +0200 Subject: [PATCH] Fix qml Audio/Video support in qt6 too. in Audio qt6 we don't have autoload feature but we disable it in qt5 => it seems ok In Video qml qt6 we don't have flushMode. --- CMakeLists.txt | 10 ++++++++++ src/CMakeLists.txt | 2 ++ src/qml/Component/Timeline/AudioDelegate.qml | 6 +++--- src/qml/Component/Timeline/VideoDelegate.qml | 4 ++-- src/res.qrc | 4 ++-- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 17fd5f526..b314a0f99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,11 +53,21 @@ if(QT_MAJOR_VERSION STREQUAL "6") set(OVERLAYSHEET_OPEN "onOpened") set(QTQUICK_MODULE_QML_VERSION "") set(QTLOCATION_MODULE_QML_VERSION "") + set(QTMULTIMEDIA_MODULE_QML_VERSION "") + set(QTMULTIMEDIA_AUDIO "MediaPlayer") + # in Audio qt6 we don't have it but we disable it in qt5 => it seems ok + set(QTMULTIMEDIA_AUDIO_AUTOLOAD "") + # In Video qml qt6 we don't have it. + set(QTMULTIMEDIA_VIDEO_FLUSHMODE "") else() set(BASICLISTITEM_BOLD "bold") set(OVERLAYSHEET_OPEN "onSheetOpenChanged") set(QTQUICK_MODULE_QML_VERSION "2.15") set(QTLOCATION_MODULE_QML_VERSION "5.15") + set(QTMULTIMEDIA_MODULE_QML_VERSION "5.15") + set(QTMULTIMEDIA_AUDIO "Audio") + set(QTMULTIMEDIA_AUDIO_AUTOLOAD "autoLoad: false") + set(QTMULTIMEDIA_VIDEO_FLUSHMODE "flushMode: VideoOutput.FirstFrame") endif() set(QUOTIENT_FORCE_NAMESPACED_INCLUDES TRUE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 53eccea28..a89c96902 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,6 +7,8 @@ configure_file(qml/Page/RoomList/RoomDelegate.qml ${CMAKE_CURRENT_BINARY_DIR}/qm configure_file(qml/Component/QuickSwitcher.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/Component/QuickSwitcher.qml) configure_file(qml/Dialog/UserDetailDialog.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/Dialog/UserDetailDialog.qml) configure_file(qml/Dialog/PowerLevelDialog.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/Dialog/PowerLevelDialog.qml) +configure_file(qml/Component/Timeline/AudioDelegate.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/Component/Timeline/AudioDelegate.qml) +configure_file(qml/Component/Timeline/VideoDelegate.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/Component/Timeline/VideoDelegate.qml) configure_file(qml/Component/Timeline/OsmLocationPlugin.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/Component/Timeline/OsmLocationPlugin.qml) configure_file(res.qrc ${CMAKE_CURRENT_SOURCE_DIR}/res.generated.qrc) diff --git a/src/qml/Component/Timeline/AudioDelegate.qml b/src/qml/Component/Timeline/AudioDelegate.qml index e12b8a35c..cfc6df288 100644 --- a/src/qml/Component/Timeline/AudioDelegate.qml +++ b/src/qml/Component/Timeline/AudioDelegate.qml @@ -4,7 +4,7 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 as QQC2 import QtQuick.Layouts 1.15 -import QtMultimedia 5.15 +import QtMultimedia @QTMULTIMEDIA_MODULE_QML_VERSION@ import org.kde.kirigami 2.15 as Kirigami @@ -42,10 +42,10 @@ TimelineContainer { Layout.fillWidth: true Layout.maximumWidth: root.contentMaxWidth - Audio { + @QTMULTIMEDIA_AUDIO@ { id: audio source: root.progressInfo.localPath - autoLoad: false + @QTMULTIMEDIA_AUDIO_AUTOLOAD@ } states: [ diff --git a/src/qml/Component/Timeline/VideoDelegate.qml b/src/qml/Component/Timeline/VideoDelegate.qml index 8e30fbcf9..29e18e324 100644 --- a/src/qml/Component/Timeline/VideoDelegate.qml +++ b/src/qml/Component/Timeline/VideoDelegate.qml @@ -4,7 +4,7 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 as QQC2 import QtQuick.Layouts 1.15 -import QtMultimedia 5.15 +import QtMultimedia @QTMULTIMEDIA_MODULE_QML_VERSION@ import Qt.labs.platform 1.1 as Platform import org.kde.kirigami 2.13 as Kirigami @@ -124,7 +124,7 @@ TimelineContainer { Layout.preferredHeight: videoHeight fillMode: VideoOutput.PreserveAspectFit - flushMode: VideoOutput.FirstFrame + @QTMULTIMEDIA_VIDEO_FLUSHMODE@ states: [ State { diff --git a/src/res.qrc b/src/res.qrc index 5e1af11cc..460a159a1 100644 --- a/src/res.qrc +++ b/src/res.qrc @@ -48,10 +48,10 @@ qml/Component/Timeline/RichLabel.qml qml/Component/Timeline/TimelineContainer.qml qml/Component/Timeline/SectionDelegate.qml - qml/Component/Timeline/VideoDelegate.qml + @CMAKE_CURRENT_BINARY_DIR@/qml/Component/Timeline/VideoDelegate.qml qml/Component/Timeline/ReactionDelegate.qml qml/Component/Timeline/LinkPreviewDelegate.qml - qml/Component/Timeline/AudioDelegate.qml + @CMAKE_CURRENT_BINARY_DIR@/qml/Component/Timeline/AudioDelegate.qml qml/Component/Timeline/FileDelegate.qml qml/Component/Timeline/ImageDelegate.qml qml/Component/Timeline/EncryptedDelegate.qml