fixing bugs in getLyricList

This commit is contained in:
Chris Cochrun 2022-09-30 07:22:40 -05:00
parent 2bbb00fa30
commit d343470d7c

View file

@ -204,20 +204,25 @@ QStringList SongSqlModel::getLyricList(const int &row) {
//TODO make sure to split empty line in verse into two slides //TODO make sure to split empty line in verse into two slides
// This first function pulls out each verse into our verses map // This first function pulls out each verse into our verses map
foreach (line, rawLyrics) { // foreach (line, rawLyrics) {
for (int i = 0; i < rawLyrics.length(); ++i) {
qDebug() << "##########################"; qDebug() << "##########################";
qDebug() << line; qDebug() << rawLyrics[i];
qDebug() << rawLyrics.length();
qDebug() << i;
qDebug() << "##########################"; qDebug() << "##########################";
if (firstItem) { if (firstItem) {
if (keywords.contains(line)) { if (keywords.contains(rawLyrics[i])) {
// qDebug() << line; qDebug() << "!!!!THIS IS FIRST LINE!!!!!";
// qDebug() << rawLyrics[i];
firstItem = false; firstItem = false;
vtitle = line; vtitle = rawLyrics[i];
continue; continue;
} }
} else if (keywords.contains(line)) { } else if (keywords.contains(rawLyrics[i])) {
qDebug() << "!!!!THIS IS A VTITLE!!!!!";
// qDebug() << verse; // qDebug() << verse;
// qDebug() << line; // qDebug() << rawLyrics[i];
if (verse.contains("\n\n")) { if (verse.contains("\n\n")) {
verse = verse.trimmed(); verse = verse.trimmed();
qDebug() << "THIS IS A EMPTY SLIDE!" << verse; qDebug() << "THIS IS A EMPTY SLIDE!" << verse;
@ -228,37 +233,41 @@ QStringList SongSqlModel::getLyricList(const int &row) {
} }
verse.clear(); verse.clear();
multiverses.clear(); multiverses.clear();
vtitle = line; vtitle = rawLyrics[i];
continue; continue;
} }
verses.insert(vtitle, verse); verses.insert(vtitle, verse);
verse.clear(); verse.clear();
vtitle = line; vtitle = rawLyrics[i];
continue; continue;
}// else if (rawLyrics.endsWith(line)) { } else if (i + 1 == rawLyrics.length()) {
// // qDebug() << vtitle; qDebug() << "!!!!LAST LINE!!!!!";
// verse.append(line.trimmed() + "\n"); verse.append(rawLyrics[i].trimmed() + "\n");
// if (verse.contains("\n\n")) { if (verse.contains("\n\n")) {
// verse = verse.trimmed(); verse = verse.trimmed();
// qDebug() << "THIS IS A EMPTY SLIDE!" << verse; qDebug() << "THIS IS A EMPTY SLIDE!" << verse;
// QStringList multiverses = verse.split("\n\n"); QStringList multiverses = verse.split("\n\n");
// foreach (verse, multiverses) { foreach (verse, multiverses) {
// verses.insert(vtitle, verse); verses.insert(vtitle, verse);
// // qDebug() << verse; // qDebug() << verse;
// } }
// break; break;
// } }
// verse.append(line.trimmed() + "\n"); verses.insert(vtitle, verse);
// verses.insert(vtitle, verse); qDebug() << "&&&&&&&&&&&&";
// break; qDebug() << "This is final line";
// } qDebug() << "and has been inserted";
qDebug() << "THIS LINE"; qDebug() << verses.values(vtitle);
qDebug() << line; qDebug() << "&&&&&&&&&&&&";
break;
}
qDebug() << "THIS RAWLYRICS[I]";
qDebug() << rawLyrics[i];
qDebug() << "THIS VTITLE"; qDebug() << "THIS VTITLE";
qDebug() << vtitle; qDebug() << vtitle;
verse.append(line.trimmed() + "\n"); verse.append(rawLyrics[i].trimmed() + "\n");
qDebug() << verse; qDebug() << verse;
qDebug() << "APPENDED VERSE"; qDebug() << "APPENDED VERSE";
} }