Skip to content

Commit

Permalink
Replace Beat/Bassline with Pattern in track names
Browse files Browse the repository at this point in the history
  • Loading branch information
allejok96 committed Feb 13, 2022
1 parent fd1846a commit 2825857
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/core/DataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1801,13 +1801,23 @@ void DataFile::upgrade_bbTcoRename()
{"bbtrack", "patterntrack"},
{"bbtrackcontainer", "patternstore"},
};

// Replace names of XML tags
for (auto name : names)
{
QDomNodeList tags = elementsByTagName(name.first);
for (int i = 0; !tags.item(i).isNull(); ++i)
QDomNodeList elements = elementsByTagName(name.first);
for (int i = 0; !elements.item(i).isNull(); ++i)
{
elements.item(i).toElement().setTagName(name.second);
}
}
// Replace "Beat/Bassline" with "Pattern" in track names
QDomNodeList elements = elementsByTagName("track");
for (int i = 0; !elements.item(i).isNull(); ++i)
{
auto e = elements.item(i).toElement();
if (e.attribute("type").toInt() == 1) // PatternTrack
{
tags.item(i).toElement().setTagName(name.second);
e.setAttribute("name", e.attribute("name").replace("Beat/Bassline", "Pattern"));
}
}
}
Expand Down

0 comments on commit 2825857

Please sign in to comment.