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/boot2qt | |
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/boot2qt')
-rw-r--r-- | src/plugins/boot2qt/qdbplugin.cpp | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/src/plugins/boot2qt/qdbplugin.cpp b/src/plugins/boot2qt/qdbplugin.cpp index e0a0be790d6..2a3c85f0851 100644 --- a/src/plugins/boot2qt/qdbplugin.cpp +++ b/src/plugins/boot2qt/qdbplugin.cpp @@ -180,6 +180,36 @@ public: QdbDeployStepFactory<RemoteLinux::GenericDirectUploadStep> m_directUploadStepFactory; + const QList<Core::Id> supportedRunConfigs { + m_runConfigFactory.id(), + "QmlProjectManager.QmlRunConfiguration" + }; + + RunWorkerFactory runWorkerFactory{ + RunWorkerFactory::make<QdbDeviceRunSupport>(), + {ProjectExplorer::Constants::NORMAL_RUN_MODE}, + supportedRunConfigs, + {Qdb::Constants::QdbLinuxOsType} + }; + RunWorkerFactory debugWorkerFactory{ + RunWorkerFactory::make<QdbDeviceDebugSupport>(), + {ProjectExplorer::Constants::DEBUG_RUN_MODE}, + supportedRunConfigs, + {Qdb::Constants::QdbLinuxOsType} + }; + RunWorkerFactory qmlProfilerWorkerFactory{ + RunWorkerFactory::make<QdbDeviceQmlProfilerSupport>(), + {ProjectExplorer::Constants::QML_PROFILER_RUN_MODE}, + supportedRunConfigs, + {Qdb::Constants::QdbLinuxOsType} + }; + RunWorkerFactory qmlPreviewWorkerFactory{ + RunWorkerFactory::make<QdbDeviceQmlPreviewSupport>(), + {ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE}, + supportedRunConfigs, + {Qdb::Constants::QdbLinuxOsType} + }; + DeviceDetector m_deviceDetector; }; @@ -195,28 +225,6 @@ bool QdbPlugin::initialize(const QStringList &arguments, QString *errorString) d = new QdbPluginPrivate; - auto constraint = [](RunConfiguration *runConfiguration) { - const Core::Id devType = DeviceTypeKitAspect::deviceTypeId( - runConfiguration->target()->kit()); - - if (devType != Qdb::Constants::QdbLinuxOsType) - return false; - - const Core::Id id = runConfiguration->id(); - return runConfiguration->isEnabled() - && (id.name().startsWith(Constants::QdbRunConfigurationPrefix) - || id.name().startsWith("QmlProjectManager.QmlRunConfiguration")); - }; - - RunControl::registerWorker<QdbDeviceRunSupport> - (ProjectExplorer::Constants::NORMAL_RUN_MODE, constraint); - RunControl::registerWorker<QdbDeviceDebugSupport> - (ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint); - RunControl::registerWorker<QdbDeviceQmlProfilerSupport> - (ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, constraint); - RunControl::registerWorker<QdbDeviceQmlPreviewSupport> - (ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE, constraint); - registerFlashAction(this); return true; |