ProjectExplorer: Simplify DeployConfigurationFactory interface

Following the RunConfigurationFactory lead this replaces
f = Foo::find(); f->do() by static Foo::do() stanzas.

Also protect DeployConfigurationFactory::canCreate()

Change-Id: I80fa491f836c3b9186f6ce6dccac4d52d4b80fc8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2018-03-12 11:43:59 +01:00
parent 02dacc27eb
commit 805b28b8b7
4 changed files with 19 additions and 67 deletions

View File

@@ -773,18 +773,13 @@ bool Target::fromMap(const QVariantMap &map)
if (!map.contains(key))
return false;
QVariantMap valueMap = map.value(key).toMap();
DeployConfigurationFactory *factory = DeployConfigurationFactory::find(this, valueMap);
if (!factory) {
DeployConfiguration *dc = DeployConfigurationFactory::restore(this, valueMap);
if (!dc) {
Core::Id id = idFromMap(valueMap);
qWarning("No factory found to restore deployment configuration of id '%s'!",
id.isValid() ? qPrintable(id.toString()) : "UNKNOWN");
continue;
}
DeployConfiguration *dc = factory->restore(this, valueMap);
if (!dc) {
qWarning("Factory '%s' failed to restore deployment configuration!", qPrintable(factory->objectName()));
continue;
}
QTC_CHECK(dc->id().withSuffix(dc->extraId()) == ProjectExplorer::idFromMap(valueMap));
addDeployConfiguration(dc);
if (i == activeConfiguration)