fixed video and images loading after changing in toolbar

This commit is contained in:
Chris Cochrun 2022-08-30 17:15:24 -05:00
parent 65f5026ee4
commit d0d66a5d54
2 changed files with 20 additions and 8 deletions

View file

@ -41,7 +41,7 @@ Item {
anchors.leftMargin: 10 anchors.leftMargin: 10
width: parent.width - playBackgroundButton.width - 10 width: parent.width - playBackgroundButton.width - 10
height: playBackgroundButton.height height: playBackgroundButton.height
visible: videoBackground.length() > 1; visible: firstItem.mpvDuration > 1;
value: firstItem.mpvPosition value: firstItem.mpvPosition
to: firstItem.mpvDuration to: firstItem.mpvDuration
} }
@ -66,8 +66,8 @@ Item {
delegate: Presenter.Slide { delegate: Presenter.Slide {
id: representation id: representation
editMode: true editMode: true
imageSource: song.backgroundType = "image" ? song.background : "" imageSource: root.imageBackground
videoSource: song.backgroundType = "video" ? song.background : "" videoSource: root.videoBackground
hTextAlignment: root.hTextAlignment hTextAlignment: root.hTextAlignment
vTextAlignment: root.vTextAlignment vTextAlignment: root.vTextAlignment
chosenFont: font chosenFont: font
@ -106,10 +106,6 @@ Item {
songModel.append({"verse": verse}) songModel.append({"verse": verse})
} }
/* function loadVideo() { */
/* representation.loadVideo(); */
/* } */
function updateHAlignment(alignment) { function updateHAlignment(alignment) {
switch (alignment) { switch (alignment) {
case "left" : case "left" :
@ -149,4 +145,19 @@ Item {
firstItem.playPauseVideo(); 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);
}
}
} }

View file

@ -328,8 +328,8 @@ Item {
} }
function updateBackground(background, backgroundType) { function updateBackground(background, backgroundType) {
song.background = background;
song.backgroundType = backgroundType; song.backgroundType = backgroundType;
song.background = background;
songsqlmodel.updateBackground(songIndex, background); songsqlmodel.updateBackground(songIndex, background);
songsqlmodel.updateBackgroundType(songIndex, backgroundType); songsqlmodel.updateBackgroundType(songIndex, backgroundType);
print("changed background"); print("changed background");
@ -341,6 +341,7 @@ Item {
//todo //todo
slideEditor.imageBackground = ""; slideEditor.imageBackground = "";
slideEditor.videoBackground = background; slideEditor.videoBackground = background;
slideEditor.loadVideo();
} }
} }