diff options
author | hjk <hjk@qt.io> | 2019-08-07 18:05:15 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-08-09 12:34:42 +0000 |
commit | f9c221eb54ca3174c57f736b7afd5914147ab2a2 (patch) | |
tree | 1d58370c31fd3c342ddd133f659ee01adb017b22 /src/plugins/webassembly | |
parent | a88970db34357adaaedd7514490d94702744a7ec (diff) |
ProjectExplorer: Re-work setup runworker factories
This combines two of the previous three paths to create run workers,
and refers to RunConfigurations by id, not by type where possible
to decrease coupling between the classes.
Only allow "type of run configuration" and "type of device"
as the only possible kind of restriction and require a uniform
RunWorker constructor signature.
Adapt user code to fit that pattern.
Change-Id: I5a6d49c9a144785fd0235d7586f244b56f67b366
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/webassembly')
-rw-r--r-- | src/plugins/webassembly/webassemblyplugin.cpp | 8 | ||||
-rw-r--r-- | src/plugins/webassembly/webassemblyrunconfiguration.cpp | 11 | ||||
-rw-r--r-- | src/plugins/webassembly/webassemblyrunconfiguration.h | 6 |
3 files changed, 12 insertions, 13 deletions
diff --git a/src/plugins/webassembly/webassemblyplugin.cpp b/src/plugins/webassembly/webassemblyplugin.cpp index 5fa3c4a983..97b4ca4ebc 100644 --- a/src/plugins/webassembly/webassemblyplugin.cpp +++ b/src/plugins/webassembly/webassemblyplugin.cpp @@ -36,6 +36,8 @@ #include <projectexplorer/devicesupport/devicemanager.h> +using namespace ProjectExplorer; + namespace WebAssembly { namespace Internal { @@ -46,7 +48,11 @@ public: WebAssemblyDeviceFactory deviceFactory; WebAssemblyQtVersionFactory qtVersionFactory; EmrunRunConfigurationFactory emrunRunConfigurationFactory; - EmrunRunWorkerFactory emrunRunWorkerFactory; + RunWorkerFactory emrunRunWorkerFactory{ + makeEmrunWorker(), + {ProjectExplorer::Constants::NORMAL_RUN_MODE}, + {Constants::WEBASSEMBLY_RUNCONFIGURATION_EMRUN} + }; }; static WebAssemblyPluginPrivate *dd = nullptr; diff --git a/src/plugins/webassembly/webassemblyrunconfiguration.cpp b/src/plugins/webassembly/webassemblyrunconfiguration.cpp index a2b5a7fb50..6a1d98f815 100644 --- a/src/plugins/webassembly/webassemblyrunconfiguration.cpp +++ b/src/plugins/webassembly/webassemblyrunconfiguration.cpp @@ -110,6 +110,10 @@ public: PortsGatherer *m_portsGatherer; }; +RunWorkerFactory::WorkerCreator makeEmrunWorker() +{ + return RunWorkerFactory::make<EmrunRunWorker>(); +} // Factories @@ -120,12 +124,5 @@ EmrunRunConfigurationFactory::EmrunRunConfigurationFactory() addSupportedTargetDeviceType(Constants::WEBASSEMBLY_DEVICE_TYPE); } -EmrunRunWorkerFactory::EmrunRunWorkerFactory() -{ - setProducer([](RunControl *rc) { return new EmrunRunWorker(rc); }); - addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE); - addSupportedRunConfiguration(Constants::WEBASSEMBLY_RUNCONFIGURATION_EMRUN); -} - } // namespace Internal } // namespace Webassembly diff --git a/src/plugins/webassembly/webassemblyrunconfiguration.h b/src/plugins/webassembly/webassemblyrunconfiguration.h index 68bc2ae6c2..af6af51e81 100644 --- a/src/plugins/webassembly/webassemblyrunconfiguration.h +++ b/src/plugins/webassembly/webassemblyrunconfiguration.h @@ -37,11 +37,7 @@ public: EmrunRunConfigurationFactory(); }; -class EmrunRunWorkerFactory : public ProjectExplorer::RunWorkerFactory -{ -public: - EmrunRunWorkerFactory(); -}; +ProjectExplorer::RunWorkerFactory::WorkerCreator makeEmrunWorker(); } // namespace Internal } // namespace Webassembly |