forked from qt-creator/qt-creator
ProjectExplorer: Streamline RunConfigurationFactory interface
canHandle() is only used locally in the implementation, so make it private and de-virtualize. canCreateHelper() did nothing except returning true anymore, so remove it. Change-Id: Ifac39e077e3c296b2b2dfc9fbb29c20884e056a3 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -499,15 +499,12 @@ RunConfigurationFactory::availableCreators(Target *parent) const
|
||||
}
|
||||
|
||||
/*!
|
||||
Specifies a list of device types for which this RunConfigurationFactory
|
||||
can create RunConfiguration.
|
||||
Adds a list of device types for which this RunConfigurationFactory
|
||||
can create RunConfigurations.
|
||||
|
||||
Not calling this function or using an empty list means no restriction.
|
||||
If this function is never called for a RunConfiguarionFactory,
|
||||
the factory will create RunConfigurations for all device types.
|
||||
*/
|
||||
void RunConfigurationFactory::setSupportedTargetDeviceTypes(const QList<Core::Id> &ids)
|
||||
{
|
||||
m_supportedTargetDeviceTypes = ids;
|
||||
}
|
||||
|
||||
void RunConfigurationFactory::addSupportedTargetDeviceType(Core::Id id)
|
||||
{
|
||||
@@ -544,20 +541,12 @@ bool RunConfigurationFactory::canHandle(Target *target) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RunConfigurationFactory::canCreateHelper(Target *, const QString &) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
RunConfiguration *RunConfigurationCreationInfo::create(Target *target) const
|
||||
{
|
||||
QTC_ASSERT(factory->canHandle(target), return nullptr);
|
||||
QTC_ASSERT(id == factory->runConfigurationBaseId(), return nullptr);
|
||||
|
||||
if (!factory->canCreateHelper(target, targetName))
|
||||
return nullptr;
|
||||
|
||||
QTC_ASSERT(factory->m_creator, return nullptr);
|
||||
|
||||
RunConfiguration *rc = factory->m_creator(target);
|
||||
if (!rc)
|
||||
return nullptr;
|
||||
|
||||
@@ -320,8 +320,6 @@ public:
|
||||
|
||||
static const QList<RunConfigurationFactory *> allRunConfigurationFactories();
|
||||
|
||||
virtual bool canHandle(Target *target) const;
|
||||
|
||||
static RunConfiguration *restore(Target *parent, const QVariantMap &map);
|
||||
static RunConfiguration *clone(Target *parent, RunConfiguration *source);
|
||||
static const QList<RunConfigurationFactory *> allFactories();
|
||||
@@ -333,7 +331,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual QList<RunConfigurationCreationInfo> availableCreators(Target *parent) const;
|
||||
virtual bool canCreateHelper(Target *parent, const QString &buildTarget) const;
|
||||
|
||||
using RunConfigurationCreator = std::function<RunConfiguration *(Target *)>;
|
||||
|
||||
@@ -345,11 +342,12 @@ protected:
|
||||
}
|
||||
|
||||
void addSupportedProjectType(Core::Id id);
|
||||
void setSupportedTargetDeviceTypes(const QList<Core::Id> &ids);
|
||||
void addSupportedTargetDeviceType(Core::Id id);
|
||||
void setDecorateDisplayNames(bool on);
|
||||
|
||||
private:
|
||||
bool canHandle(Target *target) const;
|
||||
|
||||
friend class RunConfigurationCreationInfo;
|
||||
RunConfigurationCreator m_creator;
|
||||
Core::Id m_runConfigBaseId;
|
||||
|
||||
Reference in New Issue
Block a user