Warn about LADSPA problems (#7267)

Introduce a method which checks if a file that's loaded has the LADSPA
controls saved in an old format that was written with a version before
commit e99efd541a.

The method is run at the end so that problems in all file versions are
detected. If a real upgrade was to be implemented it would have to run
between `DataFile::upgrade_0_4_0_rc2` and `DataFile::upgrade_1_0_99`.

See #5738 for more details.

If a problematic file is encountered a warning dialog that provides the number of affected LADSPA plugins is shown.
This commit is contained in:
Michael Gregorius
2024-08-04 15:30:42 +02:00
committed by GitHub
parent ce17c95636
commit b7548b7b7a
2 changed files with 35 additions and 1 deletions

View File

@@ -133,6 +133,7 @@ private:
void upgrade_noteTypes();
void upgrade_fixCMTDelays();
void upgrade_fixBassLoopsTypo();
void findProblematicLadspaPlugins();
// List of all upgrade methods
static const std::vector<UpgradeMethod> UPGRADE_METHODS;

View File

@@ -85,6 +85,7 @@ const std::vector<DataFile::UpgradeMethod> DataFile::UPGRADE_METHODS = {
&DataFile::upgrade_sampleAndHold , &DataFile::upgrade_midiCCIndexing,
&DataFile::upgrade_loopsRename , &DataFile::upgrade_noteTypes,
&DataFile::upgrade_fixCMTDelays , &DataFile::upgrade_fixBassLoopsTypo,
&DataFile::findProblematicLadspaPlugins
};
// Vector of all versions that have upgrade routines.
@@ -1072,7 +1073,6 @@ void DataFile::upgrade_0_4_0_rc2()
}
}
void DataFile::upgrade_1_0_99()
{
jo_id_t last_assigned_id = 0;
@@ -1979,6 +1979,39 @@ void DataFile::upgrade_midiCCIndexing()
}
}
void DataFile::findProblematicLadspaPlugins()
{
// This is not an upgrade but a check for potentially problematic LADSPA
// controls. See #5738 for more details.
const QDomNodeList ladspacontrols = elementsByTagName("ladspacontrols");
uint numberOfProblematicPlugins = 0;
for (int i = 0; i < ladspacontrols.size(); ++i)
{
const QDomElement ladspacontrol = ladspacontrols.item(i).toElement();
const auto attributes = ladspacontrol.attributes();
for (int j = 0; j < attributes.length(); ++j)
{
const auto attribute = attributes.item(j);
const auto name = attribute.nodeName();
if (name != "ports" && name.startsWith("port"))
{
++numberOfProblematicPlugins;
break;
}
}
}
if (numberOfProblematicPlugins > 0)
{
QMessageBox::warning(nullptr, QObject::tr("LADSPA plugins"),
QObject::tr("The project contains %1 LADSPA plugin(s) which might have not been restored correctly! Please check the project.").arg(numberOfProblematicPlugins));
}
}
void DataFile::upgrade_fixBassLoopsTypo()
{
static const QMap<QString, QString> replacementMap = {