diff options
author | hjk <hjk@qt.io> | 2019-08-07 09:33:45 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-08-08 14:33:24 +0000 |
commit | e6d09f7c682609ce2658e7b529a736936aa4e6d9 (patch) | |
tree | ff014e22d2f6adc6330eefc0bfc8fbc9d1d500c7 /src/plugins | |
parent | 735cdf88df8ead937db04bb7aa3f66d94821b816 (diff) | |
download | qt-creator-e6d09f7c682609ce2658e7b529a736936aa4e6d9.tar.gz |
Unification of desktop run configurations, step 5
Use a single RunWorkerFactory for all cases.
Change-Id: I41d39d330ed69082d75ea891b11247eab01a5d19
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/qtsupport/desktoprunconfiguration.cpp | 50 | ||||
-rw-r--r-- | src/plugins/qtsupport/desktoprunconfiguration.h | 24 | ||||
-rw-r--r-- | src/plugins/qtsupport/qtsupportplugin.cpp | 9 |
3 files changed, 43 insertions, 40 deletions
diff --git a/src/plugins/qtsupport/desktoprunconfiguration.cpp b/src/plugins/qtsupport/desktoprunconfiguration.cpp index 9dbc5d2d5b..82db07a19b 100644 --- a/src/plugins/qtsupport/desktoprunconfiguration.cpp +++ b/src/plugins/qtsupport/desktoprunconfiguration.cpp @@ -233,35 +233,61 @@ QString DesktopRunConfiguration::disabledReason() const // Factory -DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *target, Core::Id id) - : DesktopRunConfiguration(target, id, Qmake) -{} +class DesktopQmakeRunConfiguration : public DesktopRunConfiguration +{ +public: + DesktopQmakeRunConfiguration(Target *target, Core::Id id) + : DesktopRunConfiguration(target, id, Qmake) + {} +}; + +class QbsRunConfiguration : public DesktopRunConfiguration +{ +public: + QbsRunConfiguration(Target *target, Core::Id id) + : DesktopRunConfiguration(target, id, Qbs) + {} +}; + +class CMakeRunConfiguration : public DesktopRunConfiguration +{ +public: + CMakeRunConfiguration(Target *target, Core::Id id) + : DesktopRunConfiguration(target, id, CMake) + {} +}; + +const char QMAKE_RUNCONFIG_ID[] = "Qt4ProjectManager.Qt4RunConfiguration:"; +const char QBS_RUNCONFIG_ID[] = "Qbs.RunConfiguration:"; +const char CMAKE_RUNCONFIG_ID[] = "CMakeProjectManager.CMakeRunConfiguration."; -QbsRunConfiguration::QbsRunConfiguration(Target *target, Core::Id id) - : DesktopRunConfiguration(target, id, Qbs) -{} +DesktopRunWorkerFactory::DesktopRunWorkerFactory() +{ + addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE); + addSupportedRunConfiguration(QMAKE_RUNCONFIG_ID); + addSupportedRunConfiguration(QBS_RUNCONFIG_ID); + addSupportedRunConfiguration(CMAKE_RUNCONFIG_ID); -CMakeRunConfiguration::CMakeRunConfiguration(Target *target, Core::Id id) - : DesktopRunConfiguration(target, id, CMake) -{} + setProducer([](RunControl *runControl) { return new SimpleTargetRunner(runControl); }); +} CMakeRunConfigurationFactory::CMakeRunConfigurationFactory() { - registerRunConfiguration<CMakeRunConfiguration>("CMakeProjectManager.CMakeRunConfiguration."); + registerRunConfiguration<CMakeRunConfiguration>(CMAKE_RUNCONFIG_ID); addSupportedProjectType(CMakeProjectManager::Constants::CMAKEPROJECT_ID); addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); } QbsRunConfigurationFactory::QbsRunConfigurationFactory() { - registerRunConfiguration<QbsRunConfiguration>("Qbs.RunConfiguration:"); + registerRunConfiguration<QbsRunConfiguration>(QBS_RUNCONFIG_ID); addSupportedProjectType(QbsProjectManager::Constants::PROJECT_ID); addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); } DesktopQmakeRunConfigurationFactory::DesktopQmakeRunConfigurationFactory() { - registerRunConfiguration<DesktopQmakeRunConfiguration>("Qt4ProjectManager.Qt4RunConfiguration:"); + registerRunConfiguration<DesktopQmakeRunConfiguration>(QMAKE_RUNCONFIG_ID); addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID); addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); } diff --git a/src/plugins/qtsupport/desktoprunconfiguration.h b/src/plugins/qtsupport/desktoprunconfiguration.h index ca98dbaf72..4ea41b1a02 100644 --- a/src/plugins/qtsupport/desktoprunconfiguration.h +++ b/src/plugins/qtsupport/desktoprunconfiguration.h @@ -29,6 +29,8 @@ #include "projectexplorer/runconfigurationaspects.h" +#include <projectexplorer/runcontrol.h> + namespace QtSupport { namespace Internal { @@ -56,28 +58,10 @@ private: const Kind m_kind; }; -class DesktopQmakeRunConfiguration : public DesktopRunConfiguration -{ - Q_OBJECT - -public: - DesktopQmakeRunConfiguration(ProjectExplorer::Target *target, Core::Id id); -}; - -class QbsRunConfiguration : public DesktopRunConfiguration +class DesktopRunWorkerFactory : public ProjectExplorer::RunWorkerFactory { - Q_OBJECT - -public: - QbsRunConfiguration(ProjectExplorer::Target *target, Core::Id id); -}; - -class CMakeRunConfiguration : public DesktopRunConfiguration -{ - Q_OBJECT - public: - CMakeRunConfiguration(ProjectExplorer::Target *target, Core::Id id); + DesktopRunWorkerFactory(); }; class DesktopQmakeRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp index 7e157bd44c..47fb80b2db 100644 --- a/src/plugins/qtsupport/qtsupportplugin.cpp +++ b/src/plugins/qtsupport/qtsupportplugin.cpp @@ -71,17 +71,10 @@ public: CodeGenSettingsPage codeGenSettingsPage; QtOptionsPage qtOptionsPage; + DesktopRunWorkerFactory desktopRunWorkerFactory; DesktopQmakeRunConfigurationFactory desktopQmakeRunConfigFactory; - SimpleRunWorkerFactory<SimpleTargetRunner, DesktopQmakeRunConfiguration> - desktopQmakeRunWorkerFactory; - QbsRunConfigurationFactory desktopQbsRunConfigFactory; - SimpleRunWorkerFactory<SimpleTargetRunner, QbsRunConfiguration> - desktopQbsRunWorkerFactory; - CMakeRunConfigurationFactory desktopCMakeRunConfigFactory; - SimpleRunWorkerFactory<SimpleTargetRunner, CMakeRunConfiguration> - desktopCMakeRunWorkerFactory; ExamplesWelcomePage examplesPage{true}; ExamplesWelcomePage tutorialPage{false}; |