From c9938df714d652255218fbdc4ce73cc9309b3cc5 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Sat, 14 Sep 2024 06:52:25 -0500 Subject: [PATCH] fixing presentation modes --- src/qml/presenter/Presentation.qml | 2 +- .../presenter/PreviewSlideListDelegate.qml | 2 +- src/qml/presenter/Slide.qml | 113 ++++++------------ 3 files changed, 38 insertions(+), 79 deletions(-) diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index da7911b..12499f8 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -119,7 +119,7 @@ FocusScope { implicitHeight: width / 16 * 9 anchors.centerIn: parent itemType: SlideObject.ty - imageSource: SlideObject.html ? "" : SlideObject.imageBackground + imageSource: SlideObject.html ? "" : SlideObject.videoBackground ? "" : SlideObject.imageBackground webSource: SlideObject.html ? SlideObject.imageBackground : "" htmlVisible: SlideObject.html videoSource: SlideObject.videoBackground diff --git a/src/qml/presenter/PreviewSlideListDelegate.qml b/src/qml/presenter/PreviewSlideListDelegate.qml index 9b4420c..8f48701 100644 --- a/src/qml/presenter/PreviewSlideListDelegate.qml +++ b/src/qml/presenter/PreviewSlideListDelegate.qml @@ -70,7 +70,7 @@ Item { anchors.topMargin: Kirigami.Units.smallSpacing anchors.rightMargin: Kirigami.Units.smallSpacing * 2 elide: Text.ElideRight - text: ServiceItemC.getRust(serviceItemId, ServiceItemModel).name + text: ServiceItemModel.getItem(serviceItemId).name font.bold: true } diff --git a/src/qml/presenter/Slide.qml b/src/qml/presenter/Slide.qml index 020e1c4..201a76c 100644 --- a/src/qml/presenter/Slide.qml +++ b/src/qml/presenter/Slide.qml @@ -35,12 +35,12 @@ Item { property var vTextAlignment: Text.AlignVCenter //these properties are for giving video info to parents - property int mpvPosition: mpv.position - property int mpvDuration: mpv.duration - property var mpvLoop: mpv.loop - property bool mpvIsPlaying: mpv.isPlaying + property int videoPosition: video.position + property int videoDuration: video.duration + property var videoLoop: video.loops + property bool videoIsPlaying: video.playbackState - // These properties help to determine the state of the slide + // These propees help to determine the state of the slide property string itemType property bool preview: false @@ -52,14 +52,30 @@ Item { anchors.fill: parent color: "black" + Image { + id: backgroundImage + anchors.fill: parent + source: imageSource + fillMode: itemType == "song" ? Image.PreserveAspectCrop : Image.PreserveAspectFit + clip: true + visible: webSource.length == 0 + currentFrame: pdfIndex + } + + Rectangle { + id: black + color: "Black" + anchors.fill: parent + visible: false + } + Video { id: video - /* objectName: "mpv" */ anchors.fill: parent - /* useHwdec: true */ muted: preview Component.onCompleted: mpvLoadingTimer.start() loops: itemType == "song" ? MediaPlayer.Infinite : vidLoop ? MediaPlayer.Infinite : 1 + source: videoSource MouseArea { id: playArea @@ -70,33 +86,6 @@ Item { } } - /* Timer { */ - /* id: mpvLoadingTimer */ - /* interval: 500 */ - /* onTriggered: { */ - /* /\* showPassiveNotification("YIPPEEE!") *\/ */ - /* mpv.stop(); */ - /* if (vidStartTime > 0 && vidStartTime < vidEndTime) { */ - /* /\* mpv.seek(vidStartTime); *\/ */ - /* let start = "+" + vidStartTime; */ - /* let end = "+" + vidEndTime; */ - /* mpv.setProperty("start", start); */ - /* mpv.setProperty("end", end); */ - /* Utils.dbg("Setting position to: " + mpv.position); */ - /* } else { */ - /* mpv.setProperty("start", "none"); */ - /* mpv.setProperty("end", "none"); */ - /* } */ - /* mpv.loadFile(videoSource.toString()); */ - /* Utils.dbg("Setting position to: " + vidStartTime + " and end is " + vidEndTime); */ - /* if (editMode) { */ - /* console.log("WHY AREN'T YOU PASUING!"); */ - /* pauseTimer.restart(); */ - /* } */ - /* blackTimer.restart(); */ - /* } */ - /* } */ - Timer { id: pauseTimer interval: 300 @@ -111,32 +100,9 @@ Item { } } - Rectangle { - id: black - color: "Black" - anchors.fill: parent - visible: false - } - MediaPlayer { id: audio audioOutput: AudioOutput {} - /* useHwdec: true */ - /* enableAudio: true */ - - // embeded mpv allows to set commandline propertys using the options/ - // syntax. This could be abstracted later, but for now this works. - /* Component.onCompleted: audio.setProperty("options/audio-display", "no"); */ - } - - Image { - id: backgroundImage - anchors.fill: parent - source: imageSource - fillMode: itemType == "song" ? Image.PreserveAspectCrop : Image.PreserveAspectFit - clip: true - visible: webSource.length == 0 - currentFrame: pdfIndex } FastBlur { @@ -145,19 +111,6 @@ Item { source: imageSource === "" ? mpv : backgroundImage radius: blurRadius - /* Controls.Label { */ - /* text: Math.max(root.width, 1000) / 1000 * Math.max(root.textSize, 50) */ - /* horizontalAlignment: hTextAlignment */ - /* verticalAlignment: vTextAlignment */ - /* anchors.top: parent.top */ - /* anchors.left: parent.left */ - /* anchors.topMargin: 10 */ - /* anchors.bottomMargin: 10 */ - /* anchors.leftMargin: 10 */ - /* anchors.rightMargin: 10 */ - /* visible: RSettings.debug */ - /* } */ - Controls.Label { id: lyrics text: root.text @@ -224,6 +177,11 @@ Item { console.log("revealPrev") web.runJavaScript("Reveal.prev()") } + + /* function onSlideChanged() { */ + /* video.stop(); */ + /* video.seek(); */ + /* } */ } function changeText(text) { @@ -242,11 +200,12 @@ Item { } function loadVideo() { - mpvLoadingTimer.restart() + video.seek(0) + video.play() } function playAudio() { - audio.loadFile(audioSource.toString()); + audio.play(); showPassiveNotification("Audio should change"); } @@ -255,13 +214,13 @@ Item { } function stopVideo() { - mpv.stop(); + video.stop(); black.visible = true; console.log("Stopped video"); } function seek(pos) { - mpv.seek(pos); + video.seek(pos); } function quitMpv() { @@ -269,15 +228,15 @@ Item { } function pauseVideo() { - mpv.pause(); + video.pause(); } function playPauseVideo() { - mpv.playPause(); + video.playbackState == MediaPlayer.PlayingState ? video.pause() : video.play() } function playVideo() { - mpv.play(); + video.play(); } function revealNext() {