tweaks to SongEditor

This commit is contained in:
Chris Cochrun 2023-05-19 15:39:03 -05:00
parent a9722e37a0
commit 4aafe6e86f

View file

@ -32,7 +32,7 @@ Item {
implicitWidth: 300 implicitWidth: 300
editable: true editable: true
hoverEnabled: true hoverEnabled: true
flat: true /* flat: true */
onActivated: updateFont(currentText) onActivated: updateFont(currentText)
} }
Controls.SpinBox { Controls.SpinBox {
@ -48,7 +48,7 @@ Item {
model: ["Left", "Center", "Right", "Justify"] model: ["Left", "Center", "Right", "Justify"]
implicitWidth: 100 implicitWidth: 100
hoverEnabled: true hoverEnabled: true
flat: true /* flat: true */
onActivated: updateHorizontalTextAlignment(currentText.toLowerCase()); onActivated: updateHorizontalTextAlignment(currentText.toLowerCase());
} }
Controls.ComboBox { Controls.ComboBox {
@ -56,7 +56,7 @@ Item {
model: ["Top", "Center", "Bottom"] model: ["Top", "Center", "Bottom"]
implicitWidth: 100 implicitWidth: 100
hoverEnabled: true hoverEnabled: true
flat: true /* flat: true */
onActivated: updateVerticalTextAlignment(currentText.toLowerCase()); onActivated: updateVerticalTextAlignment(currentText.toLowerCase());
} }
Controls.ToolButton { Controls.ToolButton {
@ -337,6 +337,8 @@ Item {
Presenter.SlideEditor { Presenter.SlideEditor {
id: slideEditor id: slideEditor
imageBackground: song.backgroundType === "image" ? song.background : ""
videoBackground: song.backgroundType === "video" ? song.background : ""
Layout.preferredWidth: 500 Layout.preferredWidth: 500
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
@ -411,50 +413,29 @@ Item {
function newSong(index) { function newSong(index) {
clearSlides(); clearSlides();
song = songProxyModel.songModel.getItem(index); song = songProxyModel.getSong(index);
console.log(song.lyrics);
songIndex = song.id;
if (song.backgroundType == "image") {
slideEditor.videoBackground = "";
slideEditor.imageBackground = song.background;
} else {
slideEditor.imageBackground = "";
slideEditor.videoBackground = song.background;
/* slideEditor.loadVideo(); */
}
changeSlideHAlignment("Center"); changeSlideHAlignment("Center");
changeSlideVAlignment("Center"); changeSlideVAlignment("Center");
changeSlideFont("Noto Sans", true); changeSlideFont("Noto Sans", true);
changeSlideFontSize(50, true) changeSlideFontSize(50, true)
changeSlideText(songProxyModel.modelIndex(index).row); changeSlideText(songProxyModel.modelIndex(index).row);
console.log(song.title); slideEditor.loadVideo();
console.log("New song with ID: " + song.id);
} }
function changeSong(index) { function changeSong(index) {
clearSlides(); clearSlides();
console.log(index); song = songProxyModel.getSong(index);
song = songProxyModel.songModel.getItem(index);
console.log(song.lyrics);
songIndex = song.id; songIndex = song.id;
console.log(song.id);
if (song.backgroundType == "image") {
slideEditor.videoBackground = "";
slideEditor.imageBackground = song.background;
} else {
slideEditor.imageBackground = "";
slideEditor.videoBackground = song.background;
/* slideEditor.loadVideo(); */
}
changeSlideHAlignment(song.horizontalTextAlignment); changeSlideHAlignment(song.horizontalTextAlignment);
changeSlideVAlignment(song.verticalTextAlignment); changeSlideVAlignment(song.verticalTextAlignment);
changeSlideFont(song.font, true); changeSlideFont(song.font, true);
changeSlideFontSize(song.fontSize, true) changeSlideFontSize(song.fontSize, true)
changeSlideText(songProxyModel.modelIndex(index).row); changeSlideText(songProxyModel.modelIndex(index).row);
console.log(song.title); slideEditor.loadVideo();
console.log("Changing to song: " + song.title + " with ID: " + song.id);
} }
function updateLyrics(lyrics) { function updateLyrics(lyrics) {
@ -494,16 +475,16 @@ Item {
songProxyModel.songModel.updateBackground(songIndex, background); songProxyModel.songModel.updateBackground(songIndex, background);
songProxyModel.songModel.updateBackgroundType(songIndex, backgroundType); songProxyModel.songModel.updateBackgroundType(songIndex, backgroundType);
console.log("changed background"); console.log("changed background");
if (backgroundType === "image") { /* if (backgroundType === "image") { */
//todo /* //todo */
slideEditor.videoBackground = ""; /* slideEditor.videoBackground = ""; */
slideEditor.imageBackground = background; /* slideEditor.imageBackground = background; */
} else { /* } else { */
//todo /* //todo */
slideEditor.imageBackground = ""; /* slideEditor.imageBackground = ""; */
slideEditor.videoBackground = background; /* slideEditor.videoBackground = background; */
slideEditor.loadVideo(); /* slideEditor.loadVideo(); */
} /* } */
} }
@ -588,6 +569,6 @@ Item {
} }
function clearSlides() { function clearSlides() {
slideEditor.songs.clear() slideEditor.clear()
} }
} }