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:
@@ -355,6 +355,8 @@ QbsRunConfigurationFactory::QbsRunConfigurationFactory(QObject *parent) :
|
||||
{
|
||||
setObjectName("QbsRunConfigurationFactory");
|
||||
registerRunConfiguration<QbsRunConfiguration>();
|
||||
setSupportedProjectType<QbsProject>();
|
||||
setSupportedTargetDeviceTypes({Constants::DESKTOP_DEVICE_TYPE});
|
||||
}
|
||||
|
||||
bool QbsRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const
|
||||
@@ -413,15 +415,5 @@ QString QbsRunConfigurationFactory::displayNameForId(Core::Id id) const
|
||||
return productDisplayNameFromId(id);
|
||||
}
|
||||
|
||||
bool QbsRunConfigurationFactory::canHandle(Target *t) const
|
||||
{
|
||||
if (!t->project()->supportsKit(t->kit()))
|
||||
return false;
|
||||
if (!qobject_cast<QbsProject *>(t->project()))
|
||||
return false;
|
||||
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(t->kit());
|
||||
return devType == Constants::DESKTOP_DEVICE_TYPE;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
||||
|
||||
Reference in New Issue
Block a user