ProjectExplorer: Replace ToolChainFactory::canRestore

... by a member-based check.

Change-Id: Id7d19e488695e76ea17cf2d02c7b6eb2cd0246cc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-05-08 14:56:26 +02:00
parent e919a9f545
commit 78fd99f5d3
21 changed files with 36 additions and 99 deletions

View File

@@ -253,18 +253,21 @@ QList<ToolChain *> ToolChainSettingsAccessor::toolChains(const QVariantMap &data
const QVariantMap tcMap = data.value(key).toMap();
bool restored = false;
for (ToolChainFactory *f : factories) {
if (f->canRestore(tcMap)) {
if (ToolChain *tc = f->restore(tcMap)) {
result.append(tc);
restored = true;
break;
const Core::Id tcType = ToolChainFactory::typeIdFromMap(tcMap);
if (tcType.isValid()) {
for (ToolChainFactory *f : factories) {
if (f->supportedToolChainType() == tcType) {
if (ToolChain *tc = f->restore(tcMap)) {
result.append(tc);
restored = true;
break;
}
}
}
}
if (!restored)
qWarning("Warning: Unable to restore compiler type '%s' for tool chain %s.",
qPrintable(ToolChainFactory::typeIdFromMap(tcMap).toString()),
qPrintable(tcType.toString()),
qPrintable(QString::fromUtf8(ToolChainFactory::idFromMap(tcMap))));
}