From e1095817b01c2967ff7da49ca1013fb9af556a9b Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Sun, 28 Aug 2022 14:54:56 -0500 Subject: [PATCH] added some lyric checks to update the slides in songeditor --- src/qml/presenter/SlideEditor.qml | 1 + src/qml/presenter/SongEditor.qml | 15 +++++++++++++-- src/songsqlmodel.cpp | 8 ++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/qml/presenter/SlideEditor.qml b/src/qml/presenter/SlideEditor.qml index 277f61f..c315108 100644 --- a/src/qml/presenter/SlideEditor.qml +++ b/src/qml/presenter/SlideEditor.qml @@ -56,6 +56,7 @@ Item { } function appendVerse(verse) { + print("Let's append some verses") print(verse); songModel.append({"verse": verse}) } diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index cbedf47..63ab043 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -11,6 +11,7 @@ Item { property int songIndex property var song + property string songLyrics GridLayout { id: mainLayout @@ -238,6 +239,8 @@ Item { repeat: true running: false onTriggered: { + if (lyricsEditor.text === songLyrics) + return; updateLyrics(lyricsEditor.text); } } @@ -277,6 +280,7 @@ Item { function changeSong(index) { const s = songsqlmodel.getSong(index); song = s; + songLyrics = s.lyrics; songIndex = index; if (song.backgroundType == "image") { @@ -298,7 +302,9 @@ Item { function updateLyrics(lyrics) { songsqlmodel.updateLyrics(songIndex, lyrics); - print(lyrics); + songLyrics = lyrics; + /* print(lyrics); */ + changeSlideText(song.id - 1); } function updateTitle(title) { @@ -325,6 +331,11 @@ Item { songsqlmodel.updateBackground(songIndex, background); songsqlmodel.updateBackgroundType(songIndex, backgroundType); print("changed background"); + if (backgroundType === "image") { + //todo + } else { + //todo + } } @@ -401,7 +412,7 @@ Item { function changeSlideText(id) { const verses = songsqlmodel.getLyricList(id); - print("Here are the verses: " + verses); + /* print("Here are the verses: " + verses); */ slideEditor.songs.clear() verses.forEach(slideEditor.appendVerse); } diff --git a/src/songsqlmodel.cpp b/src/songsqlmodel.cpp index fdb1080..602fef8 100644 --- a/src/songsqlmodel.cpp +++ b/src/songsqlmodel.cpp @@ -161,7 +161,7 @@ QStringList SongSqlModel::getLyricList(const int &row) { QStringList lyrics; QStringList vorder = recordData.value("vorder").toString().split(" "); - qDebug() << vorder; + // qDebug() << vorder; QStringList keywords = {"Verse 1", "Verse 2", "Verse 3", "Verse 4", "Verse 5", "Verse 6", "Verse 7", "Verse 8", @@ -181,7 +181,7 @@ QStringList SongSqlModel::getLyricList(const int &row) { // This first function pulls out each verse into our verses map foreach (line, rawLyrics) { - qDebug() << line; + // qDebug() << line; if (firstItem) { if (keywords.contains(line)) { recordVerse = true; @@ -203,7 +203,7 @@ QStringList SongSqlModel::getLyricList(const int &row) { } recordVerse = true; } - qDebug() << verses; + // qDebug() << verses; // let's check to see if there is a verse order, if not return the list given if (vorder.first().isEmpty()) { @@ -224,7 +224,7 @@ QStringList SongSqlModel::getLyricList(const int &row) { } } - qDebug() << lyrics; + // qDebug() << lyrics; return lyrics; }