Commit 036d977b authored by Tobias Hunger's avatar Tobias Hunger

RunConfigurationFactory: Centralize much of the restore code

Change-Id: I30c92dd5082eed050c2796a014919788710baafa
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 1650c22b
...@@ -107,18 +107,11 @@ RunConfiguration *AndroidRunConfigurationFactory::doCreate(Target *parent, const ...@@ -107,18 +107,11 @@ RunConfiguration *AndroidRunConfigurationFactory::doCreate(Target *parent, const
return new AndroidRunConfiguration(parent, id, pathFromId(id)); return new AndroidRunConfiguration(parent, id, pathFromId(id));
} }
RunConfiguration *AndroidRunConfigurationFactory::restore(Target *parent, RunConfiguration *AndroidRunConfigurationFactory::doRestore(Target *parent,
const QVariantMap &map) const QVariantMap &map)
{ {
if (!canRestore(parent, map))
return 0;
Core::Id id = ProjectExplorer::idFromMap(map); Core::Id id = ProjectExplorer::idFromMap(map);
AndroidRunConfiguration *rc = new AndroidRunConfiguration(parent, id, pathFromId(id)); return new AndroidRunConfiguration(parent, id, pathFromId(id));
if (rc->fromMap(map))
return rc;
delete rc;
return 0;
} }
RunConfiguration *AndroidRunConfigurationFactory::clone(Target *parent, RunConfiguration *source) RunConfiguration *AndroidRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
......
...@@ -56,12 +56,10 @@ public: ...@@ -56,12 +56,10 @@ public:
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) 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 *source) const; bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source); ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
bool canHandle(ProjectExplorer::Target *t) const;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t, QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n); ProjectExplorer::Node *n);
...@@ -69,6 +67,8 @@ private: ...@@ -69,6 +67,8 @@ private:
bool canHandle(ProjectExplorer::Target *t) const; bool canHandle(ProjectExplorer::Target *t) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id); ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map);
}; };
class AndroidRunControlFactory : public ProjectExplorer::IRunControlFactory class AndroidRunControlFactory : public ProjectExplorer::IRunControlFactory
......
...@@ -544,16 +544,11 @@ bool CMakeRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, c ...@@ -544,16 +544,11 @@ bool CMakeRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, c
return ProjectExplorer::idFromMap(map).name().startsWith(CMAKE_RC_PREFIX); 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 new CMakeRunConfiguration(parent, ProjectExplorer::idFromMap(map),
return 0; QString(), QString(), QString());
CMakeRunConfiguration *rc(new CMakeRunConfiguration(parent, ProjectExplorer::idFromMap(map),
QString(), QString(), QString()));
if (rc->fromMap(map))
return rc;
delete rc;
return 0;
} }
QString CMakeRunConfigurationFactory::buildTargetFromId(Core::Id id) QString CMakeRunConfigurationFactory::buildTargetFromId(Core::Id id)
......
...@@ -163,7 +163,6 @@ public: ...@@ -163,7 +163,6 @@ public:
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) 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; bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product); ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product);
...@@ -177,6 +176,8 @@ private: ...@@ -177,6 +176,8 @@ private:
bool canHandle(ProjectExplorer::Target *parent) const; bool canHandle(ProjectExplorer::Target *parent) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id); ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map);
}; };
} }
......
...@@ -137,20 +137,11 @@ RunConfiguration *MaemoRunConfigurationFactory::doCreate(Target *parent, const C ...@@ -137,20 +137,11 @@ RunConfiguration *MaemoRunConfigurationFactory::doCreate(Target *parent, const C
return new MaemoRunConfiguration(parent, id, pathFromId(id)); return new MaemoRunConfiguration(parent, id, pathFromId(id));
} }
RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent, RunConfiguration *MaemoRunConfigurationFactory::doRestore(Target *parent,
const QVariantMap &map) const QVariantMap &map)
{ {
if (!canRestore(parent, map))
return 0;
Core::Id id = ProjectExplorer::idFromMap(map); Core::Id id = ProjectExplorer::idFromMap(map);
MaemoRunConfiguration *rc return new MaemoRunConfiguration(parent, id, pathFromId(id));
= new MaemoRunConfiguration(parent, id, pathFromId(id));
if (rc->fromMap(map))
return rc;
delete rc;
return 0;
} }
RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent, RunConfiguration *source) RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
......
...@@ -61,17 +61,18 @@ public: ...@@ -61,17 +61,18 @@ public:
bool canCreate(Target *parent, const Core::Id id) const; bool canCreate(Target *parent, const Core::Id id) const;
bool canRestore(Target *parent, const QVariantMap &map) const; bool canRestore(Target *parent, const QVariantMap &map) const;
RunConfiguration *restore(Target *parent, const QVariantMap &map);
bool canClone(Target *parent, RunConfiguration *source) const; bool canClone(Target *parent, RunConfiguration *source) const;
RunConfiguration *clone(Target *parent, RunConfiguration *source); RunConfiguration *clone(Target *parent, RunConfiguration *source);
bool canHandle(ProjectExplorer::Target *t) const;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t, QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n); ProjectExplorer::Node *n);
private: private:
bool canHandle(ProjectExplorer::Target *t) const;
RunConfiguration *doCreate(Target *parent, const Core::Id id); RunConfiguration *doCreate(Target *parent, const Core::Id id);
RunConfiguration *doRestore(Target *parent, const QVariantMap &map);
}; };
class MaemoRunControlFactory : public IRunControlFactory class MaemoRunControlFactory : public IRunControlFactory
......
...@@ -462,6 +462,18 @@ RunConfiguration *IRunConfigurationFactory::create(Target *parent, const Core::I ...@@ -462,6 +462,18 @@ RunConfiguration *IRunConfigurationFactory::create(Target *parent, const Core::I
return rc; return rc;
} }
RunConfiguration *IRunConfigurationFactory::restore(Target *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
RunConfiguration *rc = doRestore(parent, map);
if (!rc->fromMap(map)) {
delete rc;
rc = 0;
}
return rc;
}
IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, const QVariantMap &map) IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, const QVariantMap &map)
{ {
QList<IRunConfigurationFactory *> factories QList<IRunConfigurationFactory *> factories
......
...@@ -216,7 +216,7 @@ public: ...@@ -216,7 +216,7 @@ public:
virtual bool canCreate(Target *parent, const Core::Id id) const = 0; virtual bool canCreate(Target *parent, const Core::Id id) const = 0;
RunConfiguration *create(Target *parent, const Core::Id id); RunConfiguration *create(Target *parent, const Core::Id id);
virtual bool canRestore(Target *parent, const QVariantMap &map) const = 0; virtual bool canRestore(Target *parent, const QVariantMap &map) const = 0;
virtual RunConfiguration *restore(Target *parent, const QVariantMap &map) = 0; RunConfiguration *restore(Target *parent, const QVariantMap &map);
virtual bool canClone(Target *parent, RunConfiguration *product) const = 0; virtual bool canClone(Target *parent, RunConfiguration *product) const = 0;
virtual RunConfiguration *clone(Target *parent, RunConfiguration *product) = 0; virtual RunConfiguration *clone(Target *parent, RunConfiguration *product) = 0;
...@@ -229,6 +229,7 @@ signals: ...@@ -229,6 +229,7 @@ signals:
private: private:
virtual RunConfiguration *doCreate(Target *parent, const Core::Id id) = 0; virtual RunConfiguration *doCreate(Target *parent, const Core::Id id) = 0;
virtual RunConfiguration *doRestore(Target *parent, const QVariantMap &map) = 0;
}; };
class RunConfigWidget; class RunConfigWidget;
......
...@@ -120,17 +120,10 @@ bool QmlProjectRunConfigurationFactory::canRestore(ProjectExplorer::Target *pare ...@@ -120,17 +120,10 @@ bool QmlProjectRunConfigurationFactory::canRestore(ProjectExplorer::Target *pare
return parent && canCreate(parent, ProjectExplorer::idFromMap(map)); return parent && canCreate(parent, ProjectExplorer::idFromMap(map));
} }
ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map) ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map)
{ {
if (!canRestore(parent, map)) return new QmlProjectRunConfiguration(parent, ProjectExplorer::idFromMap(map));
return 0;
Core::Id id = ProjectExplorer::idFromMap(map);
QmlProjectRunConfiguration *rc = new QmlProjectRunConfiguration(parent, id);
if (rc->fromMap(map))
return rc;
delete rc;
return 0;
} }
bool QmlProjectRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const bool QmlProjectRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const
......
...@@ -48,7 +48,6 @@ public: ...@@ -48,7 +48,6 @@ public:
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) 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 *source) const; bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source); ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
...@@ -56,6 +55,8 @@ private: ...@@ -56,6 +55,8 @@ private:
bool canHandle(ProjectExplorer::Target *parent) const; bool canHandle(ProjectExplorer::Target *parent) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id); ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map);
}; };
} // namespace Internal } // namespace Internal
......
...@@ -110,20 +110,12 @@ bool BlackBerryRunConfigurationFactory::canRestore(ProjectExplorer::Target *pare ...@@ -110,20 +110,12 @@ bool BlackBerryRunConfigurationFactory::canRestore(ProjectExplorer::Target *pare
return ProjectExplorer::idFromMap(map).name().startsWith(Constants::QNX_BB_RUNCONFIGURATION_PREFIX); return ProjectExplorer::idFromMap(map).name().startsWith(Constants::QNX_BB_RUNCONFIGURATION_PREFIX);
} }
ProjectExplorer::RunConfiguration *BlackBerryRunConfigurationFactory::restore( ProjectExplorer::RunConfiguration *BlackBerryRunConfigurationFactory::doRestore(
ProjectExplorer::Target *parent, ProjectExplorer::Target *parent,
const QVariantMap &map) const QVariantMap &map)
{ {
if (!canRestore(parent, map)) Q_UNUSED(map);
return 0; return new BlackBerryRunConfiguration(parent, Core::Id(Constants::QNX_BB_RUNCONFIGURATION_PREFIX), QString());
ProjectExplorer::RunConfiguration *rc = 0;
rc = new BlackBerryRunConfiguration(parent, Core::Id(Constants::QNX_BB_RUNCONFIGURATION_PREFIX), QString());
if (rc->fromMap(map))
return rc;
delete rc;
return 0;
} }
bool BlackBerryRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, bool BlackBerryRunConfigurationFactory::canClone(ProjectExplorer::Target *parent,
......
...@@ -50,14 +50,16 @@ public: ...@@ -50,14 +50,16 @@ public:
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id); ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) 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 *source) const; bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
ProjectExplorer::RunConfiguration *source); ProjectExplorer::RunConfiguration *source);
private:
bool canHandle(ProjectExplorer::Target *t) const; bool canHandle(ProjectExplorer::Target *t) const;
ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map);
}; };
} // namespace Internal } // namespace Internal
......
...@@ -103,18 +103,11 @@ bool QnxRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, con ...@@ -103,18 +103,11 @@ bool QnxRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, con
&& ProjectExplorer::idFromMap(map).name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX); && ProjectExplorer::idFromMap(map).name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX);
} }
ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map) ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map)
{ {
if (!canRestore(parent, map)) Q_UNUSED(map);
return 0; return new QnxRunConfiguration(parent, Core::Id(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX), QString());
ProjectExplorer::RunConfiguration *rc = 0;
rc = new QnxRunConfiguration(parent, Core::Id(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX), QString());
if (rc->fromMap(map))
return rc;
delete rc;
return 0;
} }
bool QnxRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const bool QnxRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const
......
...@@ -49,8 +49,6 @@ public: ...@@ -49,8 +49,6 @@ public:
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) 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 *source) const; bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
...@@ -60,6 +58,8 @@ private: ...@@ -60,6 +58,8 @@ private:
bool canHandle(ProjectExplorer::Target *t) const; bool canHandle(ProjectExplorer::Target *t) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id); ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map);
}; };
} // namespace Internal } // namespace Internal
......
...@@ -757,16 +757,10 @@ bool Qt4RunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, con ...@@ -757,16 +757,10 @@ bool Qt4RunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, con
return ProjectExplorer::idFromMap(map).toString().startsWith(QLatin1String(QT4_RC_PREFIX)); return ProjectExplorer::idFromMap(map).toString().startsWith(QLatin1String(QT4_RC_PREFIX));
} }
ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map) ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map)
{ {
if (!canRestore(parent, map)) return new Qt4RunConfiguration(parent, ProjectExplorer::idFromMap(map));
return 0;
Qt4RunConfiguration *rc = new Qt4RunConfiguration(parent, ProjectExplorer::idFromMap(map));
if (rc->fromMap(map))
return rc;
delete rc;
return 0;
} }
bool Qt4RunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const bool Qt4RunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const
......
...@@ -214,19 +214,21 @@ public: ...@@ -214,19 +214,21 @@ public:
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) 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 *source) const; bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source); ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const; QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
QString displayNameForId(const Core::Id id) const; QString displayNameForId(const Core::Id id) const;
bool canHandle(ProjectExplorer::Target *t) const;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t, QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n); ProjectExplorer::Node *n);
private: private:
bool canHandle(ProjectExplorer::Target *t) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id); ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map);
}; };
} // namespace Internal } // namespace Internal
......
...@@ -416,15 +416,10 @@ bool CustomExecutableRunConfigurationFactory::canRestore(ProjectExplorer::Target ...@@ -416,15 +416,10 @@ bool CustomExecutableRunConfigurationFactory::canRestore(ProjectExplorer::Target
} }
ProjectExplorer::RunConfiguration * ProjectExplorer::RunConfiguration *
CustomExecutableRunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map) CustomExecutableRunConfigurationFactory::doRestore(ProjectExplorer::Target *parent, const QVariantMap &map)
{ {
if (!canRestore(parent, map)) Q_UNUSED(map);
return 0; return new CustomExecutableRunConfiguration(parent);
CustomExecutableRunConfiguration *rc(new CustomExecutableRunConfiguration(parent));
if (rc->fromMap(map))
return rc;
delete rc;
return 0;
} }
bool CustomExecutableRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, bool CustomExecutableRunConfigurationFactory::canClone(ProjectExplorer::Target *parent,
......
...@@ -139,7 +139,6 @@ public: ...@@ -139,7 +139,6 @@ public:
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) 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; bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
ProjectExplorer::RunConfiguration *source); ProjectExplorer::RunConfiguration *source);
...@@ -148,6 +147,8 @@ private: ...@@ -148,6 +147,8 @@ private:
bool canHandle(ProjectExplorer::Target *parent) const; bool canHandle(ProjectExplorer::Target *parent) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id); ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map);
}; };
} // namespace QtSupport } // namespace QtSupport
......
...@@ -110,17 +110,12 @@ RunConfiguration *RemoteLinuxRunConfigurationFactory::doCreate(Target *parent, c ...@@ -110,17 +110,12 @@ RunConfiguration *RemoteLinuxRunConfigurationFactory::doCreate(Target *parent, c
return new RemoteLinuxRunConfiguration(parent, id, pathFromId(id)); return new RemoteLinuxRunConfiguration(parent, id, pathFromId(id));
} }
RunConfiguration *RemoteLinuxRunConfigurationFactory::restore(Target *parent, RunConfiguration *RemoteLinuxRunConfigurationFactory::doRestore(Target *parent,
const QVariantMap &map) const QVariantMap &map)
{ {
QTC_ASSERT(canRestore(parent, map), return 0); Q_UNUSED(map);
RemoteLinuxRunConfiguration *rc = new RemoteLinuxRunConfiguration(parent, return new RemoteLinuxRunConfiguration(parent,
Core::Id(RemoteLinuxRunConfiguration::IdPrefix), QString()); Core::Id(RemoteLinuxRunConfiguration::IdPrefix), QString());
if (rc->fromMap(map))
return rc;
delete rc;
return 0;
} }
RunConfiguration *RemoteLinuxRunConfigurationFactory::clone(Target *parent, RunConfiguration *RemoteLinuxRunConfigurationFactory::clone(Target *parent,
......
...@@ -48,8 +48,6 @@ public: ...@@ -48,8 +48,6 @@ public:
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) 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 *source) const; bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
...@@ -59,6 +57,8 @@ private: ...@@ -59,6 +57,8 @@ private:
bool canHandle(const ProjectExplorer::Target *target) const; bool canHandle(const ProjectExplorer::Target *target) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id); ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map);
}; };
} // namespace Internal } // namespace Internal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment