make sure to display spaces in lyrics as separate slides
This commit is contained in:
parent
98263d7e5b
commit
65f5026ee4
1 changed files with 19 additions and 2 deletions
|
@ -158,6 +158,7 @@ QStringList SongSqlModel::getLyricList(const int &row) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList rawLyrics = recordData.value("lyrics").toString().split("\n");
|
QStringList rawLyrics = recordData.value("lyrics").toString().split("\n");
|
||||||
|
qDebug() << rawLyrics;
|
||||||
QStringList lyrics;
|
QStringList lyrics;
|
||||||
|
|
||||||
QStringList vorder = recordData.value("vorder").toString().split(" ");
|
QStringList vorder = recordData.value("vorder").toString().split(" ");
|
||||||
|
@ -175,7 +176,7 @@ QStringList SongSqlModel::getLyricList(const int &row) {
|
||||||
QString verse;
|
QString verse;
|
||||||
QString vtitle;
|
QString vtitle;
|
||||||
QString line;
|
QString line;
|
||||||
QMap<QString, QString> verses;
|
QMultiMap<QString, QString> verses;
|
||||||
|
|
||||||
//TODO make sure to split empty line in verse into two slides
|
//TODO make sure to split empty line in verse into two slides
|
||||||
|
|
||||||
|
@ -190,6 +191,19 @@ QStringList SongSqlModel::getLyricList(const int &row) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (keywords.contains(line)) {
|
} else if (keywords.contains(line)) {
|
||||||
|
// qDebug() << verse;
|
||||||
|
verse = verse.trimmed();
|
||||||
|
if (verse.contains("\n\n")) {
|
||||||
|
qDebug() << "THIS IS A EMPTY SLIDE!" << verse;
|
||||||
|
QStringList multiverses = verse.split("\n\n");
|
||||||
|
foreach (verse, multiverses)
|
||||||
|
verses.insert(vtitle, verse);
|
||||||
|
verse.clear();
|
||||||
|
multiverses.clear();
|
||||||
|
vtitle = line;
|
||||||
|
recordVerse = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
verses.insert(vtitle, verse);
|
verses.insert(vtitle, verse);
|
||||||
verse.clear();
|
verse.clear();
|
||||||
vtitle = line;
|
vtitle = line;
|
||||||
|
@ -215,11 +229,14 @@ QStringList SongSqlModel::getLyricList(const int &row) {
|
||||||
qDebug() << lyrics;
|
qDebug() << lyrics;
|
||||||
return lyrics;
|
return lyrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function appends the verse that matches the verse order from the map
|
// this function appends the verse that matches the verse order from the map
|
||||||
foreach (const QString &vstr, vorder) {
|
foreach (const QString &vstr, vorder) {
|
||||||
foreach (line, rawLyrics) {
|
foreach (line, rawLyrics) {
|
||||||
if (line.startsWith(vstr.at(0)) && line.endsWith(vstr.at(1))) {
|
if (line.startsWith(vstr.at(0)) && line.endsWith(vstr.at(1))) {
|
||||||
lyrics.append(verses[line]);
|
QList<QString> values = verses.values(line);
|
||||||
|
for (int i = values.size(); i > 0;)
|
||||||
|
lyrics.append(values.at(--i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue