added some lyric checks to update the slides in songeditor

This commit is contained in:
Chris Cochrun 2022-08-28 14:54:56 -05:00
parent f151e5f05e
commit e1095817b0
3 changed files with 18 additions and 6 deletions

View file

@ -56,6 +56,7 @@ Item {
}
function appendVerse(verse) {
print("Let's append some verses")
print(verse);
songModel.append({"verse": verse})
}

View file

@ -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);
}

View file

@ -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;
}