forked from qt-creator/qt-creator
ProjectExplorer: Add a RunConfigurationFactory::canHandle(Target *)
All RunConfiguration factories had some kind of canHandle(Target *) implementation. Centralize this notion. Change-Id: Ie24a355e857bddfd76b866859b8c7a42ffc83840 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -41,6 +41,8 @@ QmlProjectRunConfigurationFactory::QmlProjectRunConfigurationFactory(QObject *pa
|
||||
{
|
||||
setObjectName("QmlProjectRunConfigurationFactory");
|
||||
registerRunConfiguration<QmlProjectRunConfiguration>();
|
||||
setSupportedProjectType<QmlProject>();
|
||||
setSupportedTargetDeviceTypes({ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE});
|
||||
}
|
||||
|
||||
QList<Core::Id> QmlProjectRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode) const
|
||||
@@ -113,16 +115,6 @@ bool QmlProjectRunConfigurationFactory::canClone(ProjectExplorer::Target *parent
|
||||
return canCreate(parent, source->id());
|
||||
}
|
||||
|
||||
bool QmlProjectRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const
|
||||
{
|
||||
if (!parent->project()->supportsKit(parent->kit()))
|
||||
return false;
|
||||
if (!qobject_cast<QmlProject *>(parent->project()))
|
||||
return false;
|
||||
Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(parent->kit());
|
||||
return deviceType == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProjectManager
|
||||
|
||||
|
||||
Reference in New Issue
Block a user