RunConfigurationFactory: Centralize much of the restore code

Change-Id: I30c92dd5082eed050c2796a014919788710baafa
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Tobias Hunger
2013-03-28 14:53:12 +01:00
parent 1650c22b7b
commit 036d977b93
20 changed files with 67 additions and 105 deletions

View File

@@ -544,16 +544,11 @@ bool CMakeRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, c
return ProjectExplorer::idFromMap(map).name().startsWith(CMAKE_RC_PREFIX);
}
ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
CMakeRunConfiguration *rc(new CMakeRunConfiguration(parent, ProjectExplorer::idFromMap(map),
QString(), QString(), QString()));
if (rc->fromMap(map))
return rc;
delete rc;
return 0;
return new CMakeRunConfiguration(parent, ProjectExplorer::idFromMap(map),
QString(), QString(), QString());
}
QString CMakeRunConfigurationFactory::buildTargetFromId(Core::Id id)

View File

@@ -163,7 +163,6 @@ public:
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product);
@@ -177,6 +176,8 @@ private:
bool canHandle(ProjectExplorer::Target *parent) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map);
};
}