chore(cpn): Switch from component names to ids (#2602)
* cpn(fix): Switch from component names to ids * Fix Win compile * Sound packs list entries should not be editable
This commit is contained in:
@@ -346,7 +346,7 @@ bool ComponentData::existsOnDisk()
|
||||
void ComponentData::clearRelease()
|
||||
{
|
||||
releaseReset();
|
||||
idReset();
|
||||
releaseIdReset();
|
||||
prereleaseReset();
|
||||
dateReset();
|
||||
versionReset();
|
||||
@@ -516,15 +516,6 @@ QMap<int, QString> AppData::getActiveProfiles() const
|
||||
return active;
|
||||
}
|
||||
|
||||
int AppData::getComponentIndex(QString name) const
|
||||
{
|
||||
for (int i=0; i<MAX_COMPONENTS; i++) {
|
||||
if (g.component[i].existsOnDisk() && g.component[i].name() == name)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void AppData::convertSettings(QSettings & settings)
|
||||
{
|
||||
quint32 savedVer = settings.value(SETTINGS_VERSION_KEY, 0).toUInt();
|
||||
@@ -567,6 +558,18 @@ void AppData::convertSettings(QSettings & settings)
|
||||
}
|
||||
}
|
||||
|
||||
if (savedMajMin < 0x209) {
|
||||
// 2.9 component id renamed releaseId - copy value before calling clearUnusedSettings
|
||||
qInfo().noquote() << "Converting components - moving id to releaseId";
|
||||
static const QString path = QStringLiteral("Components/component%1/%2");
|
||||
for (int i = 0; i < MAX_COMPONENTS; i++) {
|
||||
if (settings.contains(path.arg(i).arg("id"))) {
|
||||
const QVariant id = settings.value(path.arg(i).arg("id"));
|
||||
settings.setValue(path.arg(i).arg("releaseId"), id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (removeUnused)
|
||||
clearUnusedSettings(settings);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user