fixing presentation modes

This commit is contained in:
Chris Cochrun 2024-09-14 06:52:25 -05:00
parent c2a56cd24b
commit c9938df714
3 changed files with 38 additions and 79 deletions

View file

@ -119,7 +119,7 @@ FocusScope {
implicitHeight: width / 16 * 9 implicitHeight: width / 16 * 9
anchors.centerIn: parent anchors.centerIn: parent
itemType: SlideObject.ty itemType: SlideObject.ty
imageSource: SlideObject.html ? "" : SlideObject.imageBackground imageSource: SlideObject.html ? "" : SlideObject.videoBackground ? "" : SlideObject.imageBackground
webSource: SlideObject.html ? SlideObject.imageBackground : "" webSource: SlideObject.html ? SlideObject.imageBackground : ""
htmlVisible: SlideObject.html htmlVisible: SlideObject.html
videoSource: SlideObject.videoBackground videoSource: SlideObject.videoBackground

View file

@ -70,7 +70,7 @@ Item {
anchors.topMargin: Kirigami.Units.smallSpacing anchors.topMargin: Kirigami.Units.smallSpacing
anchors.rightMargin: Kirigami.Units.smallSpacing * 2 anchors.rightMargin: Kirigami.Units.smallSpacing * 2
elide: Text.ElideRight elide: Text.ElideRight
text: ServiceItemC.getRust(serviceItemId, ServiceItemModel).name text: ServiceItemModel.getItem(serviceItemId).name
font.bold: true font.bold: true
} }

View file

@ -35,12 +35,12 @@ Item {
property var vTextAlignment: Text.AlignVCenter property var vTextAlignment: Text.AlignVCenter
//these properties are for giving video info to parents //these properties are for giving video info to parents
property int mpvPosition: mpv.position property int videoPosition: video.position
property int mpvDuration: mpv.duration property int videoDuration: video.duration
property var mpvLoop: mpv.loop property var videoLoop: video.loops
property bool mpvIsPlaying: mpv.isPlaying 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 string itemType
property bool preview: false property bool preview: false
@ -52,14 +52,30 @@ Item {
anchors.fill: parent anchors.fill: parent
color: "black" 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 { Video {
id: video id: video
/* objectName: "mpv" */
anchors.fill: parent anchors.fill: parent
/* useHwdec: true */
muted: preview muted: preview
Component.onCompleted: mpvLoadingTimer.start() Component.onCompleted: mpvLoadingTimer.start()
loops: itemType == "song" ? MediaPlayer.Infinite : vidLoop ? MediaPlayer.Infinite : 1 loops: itemType == "song" ? MediaPlayer.Infinite : vidLoop ? MediaPlayer.Infinite : 1
source: videoSource
MouseArea { MouseArea {
id: playArea 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 { Timer {
id: pauseTimer id: pauseTimer
interval: 300 interval: 300
@ -111,32 +100,9 @@ Item {
} }
} }
Rectangle {
id: black
color: "Black"
anchors.fill: parent
visible: false
}
MediaPlayer { MediaPlayer {
id: audio id: audio
audioOutput: AudioOutput {} audioOutput: AudioOutput {}
/* useHwdec: true */
/* enableAudio: true */
// embeded mpv allows to set commandline propertys using the options/<name>
// 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 { FastBlur {
@ -145,19 +111,6 @@ Item {
source: imageSource === "" ? mpv : backgroundImage source: imageSource === "" ? mpv : backgroundImage
radius: blurRadius 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 { Controls.Label {
id: lyrics id: lyrics
text: root.text text: root.text
@ -224,6 +177,11 @@ Item {
console.log("revealPrev") console.log("revealPrev")
web.runJavaScript("Reveal.prev()") web.runJavaScript("Reveal.prev()")
} }
/* function onSlideChanged() { */
/* video.stop(); */
/* video.seek(); */
/* } */
} }
function changeText(text) { function changeText(text) {
@ -242,11 +200,12 @@ Item {
} }
function loadVideo() { function loadVideo() {
mpvLoadingTimer.restart() video.seek(0)
video.play()
} }
function playAudio() { function playAudio() {
audio.loadFile(audioSource.toString()); audio.play();
showPassiveNotification("Audio should change"); showPassiveNotification("Audio should change");
} }
@ -255,13 +214,13 @@ Item {
} }
function stopVideo() { function stopVideo() {
mpv.stop(); video.stop();
black.visible = true; black.visible = true;
console.log("Stopped video"); console.log("Stopped video");
} }
function seek(pos) { function seek(pos) {
mpv.seek(pos); video.seek(pos);
} }
function quitMpv() { function quitMpv() {
@ -269,15 +228,15 @@ Item {
} }
function pauseVideo() { function pauseVideo() {
mpv.pause(); video.pause();
} }
function playPauseVideo() { function playPauseVideo() {
mpv.playPause(); video.playbackState == MediaPlayer.PlayingState ? video.pause() : video.play()
} }
function playVideo() { function playVideo() {
mpv.play(); video.play();
} }
function revealNext() { function revealNext() {