Skip to content

Commit

Permalink
Fix GH#24553: MusicXML: A title like "Jazz Piece No. 5" get interpret…
Browse files Browse the repository at this point in the history
…ed as a subtitle

Backport of musescore#24555 and (a part of) musescore#22056, the latter having caused a bug fixed by the former
  • Loading branch information
Jojo-Schmitz committed Oct 18, 2024
1 parent e964a52 commit 4e57c87
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions importexport/musicxml/importmxmlpass1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,21 +747,18 @@ static void inferFromTitle(QString& title, QString& inferredSubtitle, QString& i
QStringList subtitleLines;
QStringList creditLines;
QStringList titleLines = title.split(QRegularExpression("\\n"));
for (int i = titleLines.length() - 1; i > 0; --i) {
QString line = titleLines[i];
int nrOfTitleLines = titleLines.size();
if (nrOfTitleLines == 1)
return;
for (int i = nrOfTitleLines; i > 0; --i) {
QString line = titleLines[i - 1];
if (isLikelyCreditText(line, true)) {
for (int j = titleLines.length() - 1; j >= i; --j) {
creditLines.push_front(titleLines[j]);
titleLines.removeAt(j);
}
continue;
creditLines.insert(0, line);
titleLines.erase(titleLines.begin() + i - 1);
}
if (isLikelySubtitleText(line, true)) {
for (int j = titleLines.length() - 1; j >= i; --j) {
subtitleLines.push_front(titleLines[j]);
titleLines.removeAt(j);
}
continue;
subtitleLines.insert(0, line);
titleLines.erase(titleLines.begin() + i - 1);
}
}
title = titleLines.join("\n");
Expand Down

0 comments on commit 4e57c87

Please sign in to comment.