diff --git a/src/qml/presenter/LeftDock.qml b/src/qml/presenter/LeftDock.qml index dfd9fb2..a5508d9 100644 --- a/src/qml/presenter/LeftDock.qml +++ b/src/qml/presenter/LeftDock.qml @@ -194,7 +194,7 @@ ColumnLayout { if (type == "song") { const lyrics = songsqlmodel.getLyricList(itemID); - print(lyrics); + /* print(lyrics); */ } } diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index e840f81..8248574 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -184,7 +184,6 @@ Item { editorTimer.running = false; } onPressed: editorTimer.running = true - /* Component.onCompleted: text = songsqlmodel.getLyrics(songIndex); */ } } Controls.TextField { diff --git a/src/songsqlmodel.cpp b/src/songsqlmodel.cpp index 2cf777e..ac0c750 100644 --- a/src/songsqlmodel.cpp +++ b/src/songsqlmodel.cpp @@ -141,10 +141,38 @@ QStringList SongSqlModel::getLyricList(const int &row) { return empty; } - QString rawLyrics = recordData.value("lyrics").toString(); + QStringList rawLyrics = recordData.value("lyrics").toString().split("\n"); qDebug() << rawLyrics; - QStringList lyrics = rawLyrics.split("\n"); + QStringList lyrics; + qDebug() << lyrics; + + QStringList vorder = recordData.value("vorder").toString().split(" "); + qDebug() << vorder; + + int startIndex; + int endIndex; + QString line; + QString verse; + foreach (line, rawLyrics) { + if (line.trimmed() == "Chorus 1") { + startIndex = rawLyrics.indexOf(line) + 1; + qDebug() << line; + qDebug() << startIndex; + } + if (line.trimmed() == "Verse 1") { + endIndex = rawLyrics.indexOf(line); + qDebug() << endIndex; + break; + } + if (rawLyrics.indexOf(line) == startIndex - 1) { + continue; + } + verse.append(line + "\n"); + qDebug() << verse; + } + + lyrics.append(verse); qDebug() << lyrics; return lyrics;