ProjectExplorer: Remove registerDeployConfiguration

Since the types are all the same now, no template is needed, and
effectively only m_configBaseId is set, so rename the function
accordingly.

Change-Id: I79bbf488a0549d78b6f3f0408e6744f71a5dc190
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-01-18 15:41:29 +01:00
parent 0949d09db7
commit 537a4ba285
8 changed files with 21 additions and 23 deletions

View File

@@ -45,8 +45,7 @@ namespace Internal {
AndroidDeployConfigurationFactory::AndroidDeployConfigurationFactory() AndroidDeployConfigurationFactory::AndroidDeployConfigurationFactory()
{ {
registerDeployConfiguration<DeployConfiguration> setConfigBaseId("Qt4ProjectManager.AndroidDeployConfiguration2");
("Qt4ProjectManager.AndroidDeployConfiguration2");
addSupportedTargetDeviceType(Constants::ANDROID_DEVICE_TYPE); addSupportedTargetDeviceType(Constants::ANDROID_DEVICE_TYPE);
setDefaultDisplayName(QCoreApplication::translate("Android::Internal", setDefaultDisplayName(QCoreApplication::translate("Android::Internal",
"Deploy to Android device")); "Deploy to Android device"));

View File

@@ -39,7 +39,7 @@ namespace Internal {
IosDeployConfigurationFactory::IosDeployConfigurationFactory() IosDeployConfigurationFactory::IosDeployConfigurationFactory()
{ {
registerDeployConfiguration<DeployConfiguration>("Qt4ProjectManager.IosDeployConfiguration"); setConfigBaseId("Qt4ProjectManager.IosDeployConfiguration");
setSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID); setSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
addSupportedTargetDeviceType(Constants::IOS_DEVICE_TYPE); addSupportedTargetDeviceType(Constants::IOS_DEVICE_TYPE);
addSupportedTargetDeviceType(Constants::IOS_SIMULATOR_TYPE); addSupportedTargetDeviceType(Constants::IOS_SIMULATOR_TYPE);

View File

@@ -179,6 +179,17 @@ void DeployConfigurationFactory::setUseDeploymentDataView()
m_configWidgetCreator = [](Target *target) { return new DeploymentDataView(target); }; m_configWidgetCreator = [](Target *target) { return new DeploymentDataView(target); };
} }
void DeployConfigurationFactory::setConfigBaseId(Core::Id deployConfigBaseId)
{
m_creator = [this, deployConfigBaseId](Target *t) {
auto dc = new DeployConfiguration(t, deployConfigBaseId);
dc->setDefaultDisplayName(m_defaultDisplayName);
dc->m_configWidgetCreator = m_configWidgetCreator;
return dc;
};
m_deployConfigBaseId = deployConfigBaseId;
}
bool DeployConfigurationFactory::canCreate(Target *parent, Core::Id id) const bool DeployConfigurationFactory::canCreate(Target *parent, Core::Id id) const
{ {
if (!canHandle(parent)) if (!canHandle(parent))
@@ -265,7 +276,7 @@ void DeployConfigurationFactory::addInitialStep(Core::Id stepId, const std::func
DefaultDeployConfigurationFactory::DefaultDeployConfigurationFactory() DefaultDeployConfigurationFactory::DefaultDeployConfigurationFactory()
{ {
registerDeployConfiguration<DeployConfiguration>("ProjectExplorer.DefaultDeployConfiguration"); setConfigBaseId("ProjectExplorer.DefaultDeployConfiguration");
addSupportedTargetDeviceType(Constants::DESKTOP_DEVICE_TYPE); addSupportedTargetDeviceType(Constants::DESKTOP_DEVICE_TYPE);
//: Display name of the default deploy configuration //: Display name of the default deploy configuration
setDefaultDisplayName(DeployConfiguration::tr("Deploy Configuration")); setDefaultDisplayName(DeployConfiguration::tr("Deploy Configuration"));

View File

@@ -100,18 +100,7 @@ public:
protected: protected:
using DeployConfigurationCreator = std::function<DeployConfiguration *(Target *)>; using DeployConfigurationCreator = std::function<DeployConfiguration *(Target *)>;
void setConfigBaseId(Core::Id deployConfigBaseId);
template <class DeployConfig>
void registerDeployConfiguration(Core::Id deployConfigBaseId)
{
m_creator = [this, deployConfigBaseId](Target *t) {
auto dc = new DeployConfig(t, deployConfigBaseId);
dc->setDefaultDisplayName(m_defaultDisplayName);
dc->m_configWidgetCreator = m_configWidgetCreator;
return dc;
};
m_deployConfigBaseId = deployConfigBaseId;
}
private: private:
struct DeployStepCreationInfo { struct DeployStepCreationInfo {

View File

@@ -35,7 +35,7 @@ namespace Internal {
QbsDeployConfigurationFactory::QbsDeployConfigurationFactory() QbsDeployConfigurationFactory::QbsDeployConfigurationFactory()
{ {
registerDeployConfiguration<ProjectExplorer::DeployConfiguration>("Qbs.Deploy"); setConfigBaseId("Qbs.Deploy");
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
setSupportedProjectType(Constants::PROJECT_ID); setSupportedProjectType(Constants::PROJECT_ID);
setDefaultDisplayName(QCoreApplication::translate("Qbs", "Qbs Install")); setDefaultDisplayName(QCoreApplication::translate("Qbs", "Qbs Install"));

View File

@@ -41,8 +41,7 @@ namespace Internal {
QnxDeployConfigurationFactory::QnxDeployConfigurationFactory() QnxDeployConfigurationFactory::QnxDeployConfigurationFactory()
{ {
registerDeployConfiguration<DeployConfiguration> setConfigBaseId(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID);
(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID);
setDefaultDisplayName(QCoreApplication::translate("Qnx::Internal::QnxDeployConfiguration", setDefaultDisplayName(QCoreApplication::translate("Qnx::Internal::QnxDeployConfiguration",
"Deploy to QNX Device")); "Deploy to QNX Device"));
addSupportedTargetDeviceType(QnxDeviceFactory::deviceType()); addSupportedTargetDeviceType(QnxDeviceFactory::deviceType());

View File

@@ -54,7 +54,7 @@ namespace Internal {
RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory() RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory()
{ {
registerDeployConfiguration<DeployConfiguration>(genericDeployConfigurationId()); setConfigBaseId(genericDeployConfigurationId());
addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType); addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
setDefaultDisplayName(QCoreApplication::translate("RemoteLinux", setDefaultDisplayName(QCoreApplication::translate("RemoteLinux",
"Deploy to Remote Linux Host")); "Deploy to Remote Linux Host"));

View File

@@ -41,7 +41,7 @@ namespace Internal {
WinRtAppDeployConfigurationFactory::WinRtAppDeployConfigurationFactory() WinRtAppDeployConfigurationFactory::WinRtAppDeployConfigurationFactory()
{ {
registerDeployConfiguration<DeployConfiguration>("WinRTAppxDeployConfiguration"); setConfigBaseId("WinRTAppxDeployConfiguration");
setDefaultDisplayName(QCoreApplication::translate("WinRt::Internal::WinRtDeployConfiguration", setDefaultDisplayName(QCoreApplication::translate("WinRt::Internal::WinRtDeployConfiguration",
"Run windeployqt")); "Run windeployqt"));
addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_LOCAL); addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_LOCAL);
@@ -50,7 +50,7 @@ WinRtAppDeployConfigurationFactory::WinRtAppDeployConfigurationFactory()
WinRtPhoneDeployConfigurationFactory::WinRtPhoneDeployConfigurationFactory() WinRtPhoneDeployConfigurationFactory::WinRtPhoneDeployConfigurationFactory()
{ {
registerDeployConfiguration<DeployConfiguration>("WinRTPhoneDeployConfiguration"); setConfigBaseId("WinRTPhoneDeployConfiguration");
setDefaultDisplayName(QCoreApplication::translate("WinRt::Internal::WinRtDeployConfiguration", setDefaultDisplayName(QCoreApplication::translate("WinRt::Internal::WinRtDeployConfiguration",
"Deploy to Windows Phone")); "Deploy to Windows Phone"));
addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_PHONE); addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_PHONE);
@@ -59,7 +59,7 @@ WinRtPhoneDeployConfigurationFactory::WinRtPhoneDeployConfigurationFactory()
WinRtEmulatorDeployConfigurationFactory::WinRtEmulatorDeployConfigurationFactory() WinRtEmulatorDeployConfigurationFactory::WinRtEmulatorDeployConfigurationFactory()
{ {
registerDeployConfiguration<DeployConfiguration>("WinRTEmulatorDeployConfiguration"); setConfigBaseId("WinRTEmulatorDeployConfiguration");
setDefaultDisplayName(QCoreApplication::translate("WinRt::Internal::WinRtDeployConfiguration", setDefaultDisplayName(QCoreApplication::translate("WinRt::Internal::WinRtDeployConfiguration",
"Deploy to Windows Phone Emulator")); "Deploy to Windows Phone Emulator"));
addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_EMULATOR); addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_EMULATOR);