songEditor opens the song now

This commit is contained in:
Chris Cochrun 2024-09-13 14:23:46 -05:00
parent f197099346
commit c5ed583522
2 changed files with 22 additions and 22 deletions

View file

@ -348,10 +348,10 @@ ColumnLayout {
id: clickHandler id: clickHandler
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: { onClicked: (mouse) => {
if (mouse.button === Qt.RightButton) { if (mouse.button === Qt.RightButton) {
if(selectionModel.selectedIndexes.length <= 1) if(selectionModel.selectedIndexes.length <= 1)
selectionModel.select(innerModel.index(index), selectionModel.select(innerModel.index(index, 0),
ItemSelectionModel.ClearAndSelect); ItemSelectionModel.ClearAndSelect);
rightClickMenu.popup() rightClickMenu.popup()
} }
@ -359,19 +359,19 @@ ColumnLayout {
(mouse.modifiers === Qt.ShiftModifier)) { (mouse.modifiers === Qt.ShiftModifier)) {
if (libraryList.currentIndex < index) { if (libraryList.currentIndex < index) {
for (let i = libraryList.currentIndex; i <= index; i++) { for (let i = libraryList.currentIndex; i <= index; i++) {
selectionModel.select(innerModel.index(i), selectionModel.select(innerModel.index(i, 0),
ItemSelectionModel.Select); ItemSelectionModel.Select);
} }
} }
else { else {
for (let i = index; i <= libraryList.currentIndex; i++) { for (let i = index; i <= libraryList.currentIndex; i++) {
selectionModel.select(innerModel.index(i), selectionModel.select(innerModel.index(i, 0),
ItemSelectionModel.Select); ItemSelectionModel.Select);
} }
} }
console.log(selectionModel.selectedIndexes); console.log(selectionModel.selectedIndexes);
} else { } else {
selectionModel.select(innerModel.index(index), selectionModel.select(innerModel.index(index, 0),
ItemSelectionModel.ClearAndSelect); ItemSelectionModel.ClearAndSelect);
libraryList.currentIndex = index; libraryList.currentIndex = index;
} }

View file

@ -482,7 +482,7 @@ Item {
Utils.dbg("Changing Lyrics"); Utils.dbg("Changing Lyrics");
/* songEditorModel.lyrics = lyricsEditor.text; */ /* songEditorModel.lyrics = lyricsEditor.text; */
/* showPassiveNotification("Lyrics changed"); */ /* showPassiveNotification("Lyrics changed"); */
songProxyModel.songModel.updateLyrics(songID, lyricsEditor.text); songModel.updateLyrics(songID, lyricsEditor.text);
clearSlides(); clearSlides();
changeSlideText(songID); changeSlideText(songID);
Utils.dbg("Lyrics changed"); Utils.dbg("Lyrics changed");
@ -492,10 +492,10 @@ Item {
} }
function changeSong(index) { function changeSong(index) {
Utils.dbg("Preparing to change song: " + index + 1 + " out of " + songProxyModel.songModel.count); Utils.dbg("Preparing to change song: " + index + 1 + " out of " + songModel.count);
editorTimer.running = false; editorTimer.running = false;
clearSlides(); clearSlides();
const updatedSong = songProxyModel.songModel.getItem(index); const updatedSong = songModel.getItem(index);
Utils.dbg(updatedSong.vorder + " " + updatedSong.title + " " + updatedSong.audio); Utils.dbg(updatedSong.vorder + " " + updatedSong.title + " " + updatedSong.audio);
songEditorModel.title = updatedSong.title; songEditorModel.title = updatedSong.title;
songEditorModel.lyrics = updatedSong.lyrics; songEditorModel.lyrics = updatedSong.lyrics;
@ -531,31 +531,31 @@ Item {
} }
/* function updateLyrics(lyrics) { */ /* function updateLyrics(lyrics) { */
/* songProxyModel.songModel.updateLyrics(songID, lyrics); */ /* songModel.updateLyrics(songID, lyrics); */
/* /\* songLyrics = lyrics; *\/ */ /* /\* songLyrics = lyrics; *\/ */
/* clearSlides(); */ /* clearSlides(); */
/* changeSlideText(songID); */ /* changeSlideText(songID); */
/* } */ /* } */
function updateTitle(title) { function updateTitle(title) {
songProxyModel.songModel.updateTitle(songID, title) songModel.updateTitle(songID, title)
song.title = title; song.title = title;
} }
function updateAuthor(author) { function updateAuthor(author) {
songProxyModel.songModel.updateAuthor(songID, author) songModel.updateAuthor(songID, author)
} }
function updateAudio(audio) { function updateAudio(audio) {
songProxyModel.songModel.updateAudio(songID, audio) songModel.updateAudio(songID, audio)
} }
function updateCcli(ccli) { function updateCcli(ccli) {
songProxyModel.songModel.updateCcli(songID, ccli) songModel.updateCcli(songID, ccli)
} }
function updateVerseOrder(vorder) { function updateVerseOrder(vorder) {
songProxyModel.songModel.updateVerseOrder(songID, vorder) songModel.updateVerseOrder(songID, vorder)
songEditorModel.verseOrder = vorder; songEditorModel.verseOrder = vorder;
songEditorModel.checkVerseOrder(); songEditorModel.checkVerseOrder();
} }
@ -565,7 +565,7 @@ Item {
Utils.dbg("song: " + songID); Utils.dbg("song: " + songID);
Utils.dbg("song-title: " + songEditorModel.title) Utils.dbg("song-title: " + songEditorModel.title)
songEditorModel.audio = file; songEditorModel.audio = file;
songProxyModel.songModel.updateAudio(songID, file); songModel.updateAudio(songID, file);
songEditorModel.checkFiles(); songEditorModel.checkFiles();
} }
@ -573,32 +573,32 @@ Item {
songEditorModel.backgroundType = backgroundType; songEditorModel.backgroundType = backgroundType;
const file = fileHelper.loadFile("Pick Background", backgroundType); const file = fileHelper.loadFile("Pick Background", backgroundType);
songEditorModel.background = file; songEditorModel.background = file;
songProxyModel.songModel.updateBackground(songID, file); songModel.updateBackground(songID, file);
songProxyModel.songModel.updateBackgroundType(songID, backgroundType); songModel.updateBackgroundType(songID, backgroundType);
Utils.dbg("changed background"); Utils.dbg("changed background");
} }
function updateHorizontalTextAlignment(textAlignment) { function updateHorizontalTextAlignment(textAlignment) {
changeSlideHAlignment(textAlignment); changeSlideHAlignment(textAlignment);
songProxyModel.songModel.updateHorizontalTextAlignment(songID, textAlignment); songModel.updateHorizontalTextAlignment(songID, textAlignment);
} }
function updateVerticalTextAlignment(textAlignment) { function updateVerticalTextAlignment(textAlignment) {
changeSlideVAlignment(textAlignment); changeSlideVAlignment(textAlignment);
songProxyModel.songModel.updateVerticalTextAlignment(songID, textAlignment) songModel.updateVerticalTextAlignment(songID, textAlignment)
} }
function updateFont(font) { function updateFont(font) {
showPassiveNotification(font); showPassiveNotification(font);
changeSlideFont(font, false); changeSlideFont(font, false);
songProxyModel.songModel.updateFont(songID, font); songModel.updateFont(songID, font);
song.font = font; song.font = font;
} }
function updateFontSize(fontSize) { function updateFontSize(fontSize) {
changeSlideFontSize(fontSize, false); changeSlideFontSize(fontSize, false);
songProxyModel.songModel.updateFontSize(songID, fontSize); songModel.updateFontSize(songID, fontSize);
song.fontSize = fontSize; song.fontSize = fontSize;
} }
@ -654,7 +654,7 @@ Item {
} }
function changeSlideText(id) { function changeSlideText(id) {
const verses = songProxyModel.songModel.getLyricList(id); const verses = songModel.getLyricList(id);
verses.forEach(songList.appendVerse); verses.forEach(songList.appendVerse);
/* songList.loadVideo(); */ /* songList.loadVideo(); */
} }