ProjectExplorer: Move ITargetFactory to object pool

Makes multiple target factories per project possible

Reviewed-By: hunger
This commit is contained in:
dt
2010-12-06 16:15:41 +01:00
parent 95d7639bb7
commit 8697072ce4
15 changed files with 65 additions and 51 deletions

View File

@@ -276,7 +276,19 @@ bool Project::fromMap(const QVariantMap &map)
qWarning() << key << "was not found in data.";
return false;
}
Target *t(targetFactory()->restore(this, map.value(key).toMap()));
QVariantMap targetMap = map.value(key).toMap();
QList<ITargetFactory *> factories =
ExtensionSystem::PluginManager::instance()->getObjects<ITargetFactory>();
Target *t = 0;
foreach (ITargetFactory *factory, factories) {
if (factory->canRestore(this, targetMap)) {
t = factory->restore(this, targetMap);
break;
}
}
if (!t) {
qWarning() << "Restoration of a target failed! (Continuing)";
continue;