making songs have a list of slides visible to assist in editing

This commit is contained in:
Chris Cochrun 2022-04-26 13:10:26 -05:00
parent ceefbebe23
commit 39fc19dff2
4 changed files with 78 additions and 26 deletions

View file

@ -34,6 +34,9 @@ Item {
property string itemType
property bool preview: false
implicitWidth: 1920
implicitHeight: 1080
Rectangle {
id: basePrColor
anchors.fill: parent
@ -59,12 +62,12 @@ Item {
id: playArea
anchors.fill: parent
enabled: editMode
onPressed: mpv.loadFile(videoSource.toString());
onPressed: mpv.playPause();
cursorShape: preview ? Qt.ArrowCursor : Qt.BlankCursor
}
Controls.ProgressBar {
anchors.centerIn: parent
anchors.top: parent.bottom
visible: editMode
width: parent.width - 400
value: mpv.position
@ -74,13 +77,24 @@ Item {
Timer {
id: mpvLoadingTimer
interval: 2
interval: 100
onTriggered: {
/* showPassiveNotification("YIPPEEE!") */
mpv.loadFile(videoSource.toString());
if (preview) {
print("WHY AREN'T YOU PASUING!");
pauseTimer.restart();
}
blackTimer.restart();
}
}
Timer {
id: pauseTimer
interval: 200
onTriggered: mpv.pause()
}
Timer {
id: blackTimer
interval: 400

View file

@ -1,4 +1,4 @@
import QtQuick 2.13
import QtQuick 2.15
import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.15 as Controls
import QtQuick.Window 2.13
@ -18,40 +18,65 @@ Item {
property string font
property real fontSize
Presenter.Slide {
id: representation
property ListModel songs: songModel
ListView {
id: slideList
anchors.fill: parent
editMode: true
imageSource: imageBackground
videoSource: videoBackground
hTextAlignment: root.hTextAlignment
vTextAlignment: root.vTextAlignment
chosenFont: font
textSize: fontSize
preview: true
model: songModel
clip: true
cacheBuffer: 900
reuseItems: true
spacing: Kirigami.Units.gridUnit
flickDeceleration: 4000
/* boundsMovement: Flickable.StopAtBounds */
synchronousDrag: true
delegate: Presenter.Slide {
id: representation
editMode: true
imageSource: root.imageBackground
videoSource: root.videoBackground
hTextAlignment: root.hTextAlignment
vTextAlignment: root.vTextAlignment
chosenFont: root.font
textSize: root.fontSize
preview: true
text: verse
implicitWidth: slideList.width
implicitHeight: width * 9 / 16
}
}
Component.onCompleted: {
}
function loadVideo() {
representation.loadVideo();
representation.pauseVideo();
ListModel {
id: songModel
}
function appendVerse(verse) {
print(verse);
songModel.append({"verse": verse})
}
/* function loadVideo() { */
/* representation.loadVideo(); */
/* } */
function updateHAlignment(alignment) {
switch (alignment) {
case "left" :
representation.horizontalAlignment = Text.AlignLeft;
root.hTextAlignment = Text.AlignLeft;
break;
case "center" :
representation.horizontalAlignment = Text.AlignHCenter;
root.hTextAlignment = Text.AlignHCenter;
break;
case "right" :
representation.horizontalAlignment = Text.AlignRight;
root.hTextAlignment = Text.AlignRight;
break;
case "justify" :
representation.horizontalAlignment = Text.AlignJustify;
root.hTextAlignment = Text.AlignJustify;
break;
}
}

View file

@ -222,8 +222,9 @@ Item {
id: slideEditor
Layout.preferredWidth: 500
Layout.fillWidth: true
Layout.preferredHeight: slideEditor.width / 16 * 9
Layout.fillHeight: true
Layout.bottomMargin: 30
Layout.topMargin: 30
Layout.rightMargin: 20
Layout.leftMargin: 20
}
@ -284,13 +285,14 @@ Item {
} else {
slideEditor.imageBackground = "";
slideEditor.videoBackground = song.background;
slideEditor.loadVideo();
/* slideEditor.loadVideo(); */
}
changeSlideHAlignment(song.horizontalTextAlignment);
changeSlideVAlignment(song.verticalTextAlignment);
changeSlideFont(song.font, true);
changeSlideFontSize(song.fontSize, true)
changeSlideText(songIndex);
print(s.title);
}
@ -396,4 +398,11 @@ Item {
fontSizeBox.value = fontSize;
slideEditor.fontSize = fontSize;
}
function changeSlideText(id) {
const verses = songsqlmodel.getLyricList(id);
print("Here are the verses: " + verses);
slideEditor.songs.clear()
verses.forEach(slideEditor.appendVerse);
}
}