Introduce and use IRunConfiguration::addSupportedTargetDeviceType

In line with addSupportedProjectType, saves a few cycles due to the
non-use of the temporary list, and in theory more flexible than the
existing set...(QList<Id>) as it potentially allows dependent plugin
to declare support for already existing configurations instead of
re-implementing their own.

Change-Id: I2b83e90de49daa9bfce6f780c5f51c2e971eb7d1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2018-02-22 08:36:45 +01:00
parent 092d5068bd
commit 39b66f2cb8
10 changed files with 19 additions and 12 deletions

View File

@@ -45,7 +45,7 @@ BareMetalRunConfigurationFactory::BareMetalRunConfigurationFactory(QObject *pare
{ {
setObjectName("BareMetalRunConfigurationFactory"); setObjectName("BareMetalRunConfigurationFactory");
registerRunConfiguration<BareMetalRunConfiguration>(BareMetalRunConfiguration::IdPrefix); registerRunConfiguration<BareMetalRunConfiguration>(BareMetalRunConfiguration::IdPrefix);
setSupportedTargetDeviceTypes({BareMetal::Constants::BareMetalOsType}); addSupportedTargetDeviceType(BareMetal::Constants::BareMetalOsType);
} }
QList<RunConfigurationCreationInfo> BareMetalRunConfigurationFactory::availableCreators(Target *parent) const QList<RunConfigurationCreationInfo> BareMetalRunConfigurationFactory::availableCreators(Target *parent) const
@@ -64,7 +64,7 @@ BareMetalCustomRunConfigurationFactory::BareMetalCustomRunConfigurationFactory(Q
{ {
setObjectName("BareMetalCustomRunConfigurationFactory"); setObjectName("BareMetalCustomRunConfigurationFactory");
registerRunConfiguration<BareMetalCustomRunConfiguration>("BareMetal.CustomRunConfig"); registerRunConfiguration<BareMetalCustomRunConfiguration>("BareMetal.CustomRunConfig");
setSupportedTargetDeviceTypes({BareMetal::Constants::BareMetalOsType}); addSupportedTargetDeviceType(BareMetal::Constants::BareMetalOsType);
} }
} // namespace Internal } // namespace Internal

View File

@@ -47,7 +47,8 @@ IosRunConfigurationFactory::IosRunConfigurationFactory(QObject *parent)
{ {
setObjectName("IosRunConfigurationFactory"); setObjectName("IosRunConfigurationFactory");
registerRunConfiguration<IosRunConfiguration>(Constants::IOS_RC_ID_PREFIX); registerRunConfiguration<IosRunConfiguration>(Constants::IOS_RC_ID_PREFIX);
setSupportedTargetDeviceTypes({Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE}); addSupportedTargetDeviceType(Constants::IOS_DEVICE_TYPE);
addSupportedTargetDeviceType(Constants::IOS_SIMULATOR_TYPE);
addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID); addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
} }

View File

@@ -488,6 +488,11 @@ void IRunConfigurationFactory::setSupportedTargetDeviceTypes(const QList<Core::I
m_supportedTargetDeviceTypes = ids; m_supportedTargetDeviceTypes = ids;
} }
void IRunConfigurationFactory::addSupportedTargetDeviceType(Core::Id id)
{
m_supportedTargetDeviceTypes.append(id);
}
void IRunConfigurationFactory::addSupportedProjectType(Core::Id id) void IRunConfigurationFactory::addSupportedProjectType(Core::Id id)
{ {
m_supportedProjectTypes.append(id); m_supportedProjectTypes.append(id);

View File

@@ -340,6 +340,7 @@ protected:
void addSupportedProjectType(Core::Id id); void addSupportedProjectType(Core::Id id);
void setSupportedTargetDeviceTypes(const QList<Core::Id> &ids); void setSupportedTargetDeviceTypes(const QList<Core::Id> &ids);
void addSupportedTargetDeviceType(Core::Id id);
void setDisplayNamePattern(const QString &pattern); void setDisplayNamePattern(const QString &pattern);
RunConfigurationCreationInfo convert(const BuildTargetInfo &ti) const; RunConfigurationCreationInfo convert(const BuildTargetInfo &ti) const;

View File

@@ -374,7 +374,7 @@ QbsRunConfigurationFactory::QbsRunConfigurationFactory(QObject *parent) :
setObjectName("QbsRunConfigurationFactory"); setObjectName("QbsRunConfigurationFactory");
registerRunConfiguration<QbsRunConfiguration>(QBS_RC_PREFIX); registerRunConfiguration<QbsRunConfiguration>(QBS_RC_PREFIX);
addSupportedProjectType(Constants::PROJECT_ID); addSupportedProjectType(Constants::PROJECT_ID);
setSupportedTargetDeviceTypes({ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE}); addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
} }
bool QbsRunConfigurationFactory::canCreateHelper(Target *parent, const QString &buildTarget) const bool QbsRunConfigurationFactory::canCreateHelper(Target *parent, const QString &buildTarget) const

View File

@@ -53,7 +53,7 @@ QmakeAndroidRunConfigurationFactory::QmakeAndroidRunConfigurationFactory(QObject
{ {
registerRunConfiguration<QmakeAndroidRunConfiguration>(ANDROID_RC_ID_PREFIX); registerRunConfiguration<QmakeAndroidRunConfiguration>(ANDROID_RC_ID_PREFIX);
addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID); addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
setSupportedTargetDeviceTypes({Android::Constants::ANDROID_DEVICE_TYPE}); addSupportedTargetDeviceType(Android::Constants::ANDROID_DEVICE_TYPE);
} }
QList<RunConfigurationCreationInfo> QmakeAndroidRunConfigurationFactory::availableCreators(Target *parent) const QList<RunConfigurationCreationInfo> QmakeAndroidRunConfigurationFactory::availableCreators(Target *parent) const

View File

@@ -434,7 +434,7 @@ DesktopQmakeRunConfigurationFactory::DesktopQmakeRunConfigurationFactory(QObject
setObjectName("DesktopQmakeRunConfigurationFactory"); setObjectName("DesktopQmakeRunConfigurationFactory");
registerRunConfiguration<DesktopQmakeRunConfiguration>(QMAKE_RC_PREFIX); registerRunConfiguration<DesktopQmakeRunConfiguration>(QMAKE_RC_PREFIX);
addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID); addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
setSupportedTargetDeviceTypes({ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE}); addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
} }
bool DesktopQmakeRunConfigurationFactory::canCreateHelper(Target *parent, const QString &buildTarget) const bool DesktopQmakeRunConfigurationFactory::canCreateHelper(Target *parent, const QString &buildTarget) const

View File

@@ -36,7 +36,7 @@ QnxRunConfigurationFactory::QnxRunConfigurationFactory(QObject *parent) :
ProjectExplorer::IRunConfigurationFactory(parent) ProjectExplorer::IRunConfigurationFactory(parent)
{ {
registerRunConfiguration<QnxRunConfiguration>(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX); registerRunConfiguration<QnxRunConfiguration>(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX);
setSupportedTargetDeviceTypes({Constants::QNX_QNX_OS_TYPE}); addSupportedTargetDeviceType(Constants::QNX_QNX_OS_TYPE);
} }
} // namespace Internal } // namespace Internal

View File

@@ -41,7 +41,7 @@ RemoteLinuxRunConfigurationFactory::RemoteLinuxRunConfigurationFactory(QObject *
{ {
setObjectName("RemoteLinuxRunConfigurationFactory"); setObjectName("RemoteLinuxRunConfigurationFactory");
registerRunConfiguration<RemoteLinuxRunConfiguration>(RemoteLinuxRunConfiguration::IdPrefix); registerRunConfiguration<RemoteLinuxRunConfiguration>(RemoteLinuxRunConfiguration::IdPrefix);
setSupportedTargetDeviceTypes({RemoteLinux::Constants::GenericLinuxOsType}); addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
} }
// RemoteLinuxCustomRunConfigurationFactory // RemoteLinuxCustomRunConfigurationFactory
@@ -53,7 +53,7 @@ RemoteLinuxCustomRunConfigurationFactory::RemoteLinuxCustomRunConfigurationFacto
setObjectName("RemoteLinuxCustomRunConfiguration"); setObjectName("RemoteLinuxCustomRunConfiguration");
registerRunConfiguration<RemoteLinuxCustomRunConfiguration> registerRunConfiguration<RemoteLinuxCustomRunConfiguration>
(RemoteLinuxCustomRunConfiguration::runConfigId()); (RemoteLinuxCustomRunConfiguration::runConfigId());
setSupportedTargetDeviceTypes({RemoteLinux::Constants::GenericLinuxOsType}); addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
} }
} // namespace Internal } // namespace Internal

View File

@@ -45,9 +45,9 @@ WinRtRunConfigurationFactory::WinRtRunConfigurationFactory()
{ {
registerRunConfiguration<WinRtRunConfiguration>(Constants::WINRT_RC_PREFIX); registerRunConfiguration<WinRtRunConfiguration>(Constants::WINRT_RC_PREFIX);
addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID); addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
setSupportedTargetDeviceTypes({Constants::WINRT_DEVICE_TYPE_LOCAL, addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_LOCAL);
Constants::WINRT_DEVICE_TYPE_PHONE, addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_PHONE);
Constants::WINRT_DEVICE_TYPE_EMULATOR}); addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_EMULATOR);
} }
QList<RunConfigurationCreationInfo> WinRtRunConfigurationFactory::availableCreators(Target *parent) const QList<RunConfigurationCreationInfo> WinRtRunConfigurationFactory::availableCreators(Target *parent) const