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()
{
registerDeployConfiguration<DeployConfiguration>
("Qt4ProjectManager.AndroidDeployConfiguration2");
setConfigBaseId("Qt4ProjectManager.AndroidDeployConfiguration2");
addSupportedTargetDeviceType(Constants::ANDROID_DEVICE_TYPE);
setDefaultDisplayName(QCoreApplication::translate("Android::Internal",
"Deploy to Android device"));

View File

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

View File

@@ -179,6 +179,17 @@ void DeployConfigurationFactory::setUseDeploymentDataView()
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
{
if (!canHandle(parent))
@@ -265,7 +276,7 @@ void DeployConfigurationFactory::addInitialStep(Core::Id stepId, const std::func
DefaultDeployConfigurationFactory::DefaultDeployConfigurationFactory()
{
registerDeployConfiguration<DeployConfiguration>("ProjectExplorer.DefaultDeployConfiguration");
setConfigBaseId("ProjectExplorer.DefaultDeployConfiguration");
addSupportedTargetDeviceType(Constants::DESKTOP_DEVICE_TYPE);
//: Display name of the default deploy configuration
setDefaultDisplayName(DeployConfiguration::tr("Deploy Configuration"));

View File

@@ -100,18 +100,7 @@ public:
protected:
using DeployConfigurationCreator = std::function<DeployConfiguration *(Target *)>;
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;
}
void setConfigBaseId(Core::Id deployConfigBaseId);
private:
struct DeployStepCreationInfo {

View File

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

View File

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

View File

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

View File

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