From d0d66a5d54630a624dd3d4b80d3337b2e86620d5 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 30 Aug 2022 17:15:24 -0500 Subject: [PATCH] fixed video and images loading after changing in toolbar --- src/qml/presenter/SlideEditor.qml | 25 ++++++++++++++++++------- src/qml/presenter/SongEditor.qml | 3 ++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/qml/presenter/SlideEditor.qml b/src/qml/presenter/SlideEditor.qml index 9dcf027..8859aa8 100644 --- a/src/qml/presenter/SlideEditor.qml +++ b/src/qml/presenter/SlideEditor.qml @@ -41,7 +41,7 @@ Item { anchors.leftMargin: 10 width: parent.width - playBackgroundButton.width - 10 height: playBackgroundButton.height - visible: videoBackground.length() > 1; + visible: firstItem.mpvDuration > 1; value: firstItem.mpvPosition to: firstItem.mpvDuration } @@ -66,8 +66,8 @@ Item { delegate: Presenter.Slide { id: representation editMode: true - imageSource: song.backgroundType = "image" ? song.background : "" - videoSource: song.backgroundType = "video" ? song.background : "" + imageSource: root.imageBackground + videoSource: root.videoBackground hTextAlignment: root.hTextAlignment vTextAlignment: root.vTextAlignment chosenFont: font @@ -106,10 +106,6 @@ Item { songModel.append({"verse": verse}) } - /* function loadVideo() { */ - /* representation.loadVideo(); */ - /* } */ - function updateHAlignment(alignment) { switch (alignment) { case "left" : @@ -149,4 +145,19 @@ Item { firstItem.playPauseVideo(); } + function stopVideo() { + representation.stopVideo(); + } + + function pauseVideo() { + representation.pauseVideo(); + } + + function loadVideo() { + for (var i = 0; i < slideList.count; ++i) { + slideList.currentIndex = i; + slideList.currentItem.loadVideo(); + print(slideList.currentItem); + } + } } diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index 9828071..7eec79e 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -328,8 +328,8 @@ Item { } function updateBackground(background, backgroundType) { - song.background = background; song.backgroundType = backgroundType; + song.background = background; songsqlmodel.updateBackground(songIndex, background); songsqlmodel.updateBackgroundType(songIndex, backgroundType); print("changed background"); @@ -341,6 +341,7 @@ Item { //todo slideEditor.imageBackground = ""; slideEditor.videoBackground = background; + slideEditor.loadVideo(); } }