aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/boot2qt
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-08-23 15:31:35 +0200
committerhjk <hjk@qt.io>2019-08-27 07:54:45 +0000
commit3844f59806104516d6c1ae2ee3757f509066df9b (patch)
treedf66fbdf4527f03332010c877e855c40e8aed208 /src/plugins/boot2qt
parent38feea7e253636396fa629fe25a17819fccaa4ab (diff)
ProjectExplorer: Standardize RunWorker creation logic
This unifies the remaining paths of RunWorker creation to always use RunWorkerFactories in the plugin pimpls. There were, and are, still effectively three basic kinds of workers: - "toplevel" tools corresponding to the run modes, that are often all that's used for local runs and directly started via the fat buttons or e.g. entries in the analyze menu, with factories already previously located in the plugin pimpls - core "tool helpers", providing tool specific functionality typically used in conjunction with a remote device specific run mechanism, set up via RunControl::registerWorkerCreator - target/device specific runhelper like port gatherers contructed e.g. via *Device::workerCreator(Core::Id id) Worse, these categories are partially overlapping, so it was not clear how a "clean" setup would look like, instead some ad-hoc cobbling "to make it work" happened. In some cases, the runMode id was used throughout the whole ensemble of run workers for a given run, and which worker exactly was created depended on which of the mechanism above was used in which order. With the new central setup, the top-level runmodes remain, but the second kind gets new ids, so the implicit dependencies on order of setup mechanism are avoided. This also helps in the cases where there was previously unclarity of where and how to set up worker factories: It's always and only the plugin pimpl now. Change-Id: Icd9a08e2d53e19abe8b21fe546f469fae353a69f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/plugins/boot2qt')
-rw-r--r--src/plugins/boot2qt/qdbdevice.cpp12
-rw-r--r--src/plugins/boot2qt/qdbdevice.h3
-rw-r--r--src/plugins/boot2qt/qdbdevicedebugsupport.cpp6
-rw-r--r--src/plugins/boot2qt/qdbdevicedebugsupport.h19
-rw-r--r--src/plugins/boot2qt/qdbplugin.cpp15
5 files changed, 12 insertions, 43 deletions
diff --git a/src/plugins/boot2qt/qdbdevice.cpp b/src/plugins/boot2qt/qdbdevice.cpp
index 4a72a7c4a6..c6e388878d 100644
--- a/src/plugins/boot2qt/qdbdevice.cpp
+++ b/src/plugins/boot2qt/qdbdevice.cpp
@@ -200,18 +200,6 @@ void QdbDevice::setupDefaultNetworkSettings(const QString &host)
setSshParameters(parameters);
}
-std::function<ProjectExplorer::RunWorker *(ProjectExplorer::RunControl *)>
- QdbDevice::workerCreator(Core::Id id) const
-{
- if (id == "PerfRecorder") {
- return [](ProjectExplorer::RunControl *runControl) {
- return new QdbDevicePerfProfilerSupport(runControl);
- };
- }
- return {};
-}
-
-
// QdbDeviceWizard
class QdbSettingsPage : public QWizardPage
diff --git a/src/plugins/boot2qt/qdbdevice.h b/src/plugins/boot2qt/qdbdevice.h
index d7a816097b..a0f6f9338f 100644
--- a/src/plugins/boot2qt/qdbdevice.h
+++ b/src/plugins/boot2qt/qdbdevice.h
@@ -52,9 +52,6 @@ public:
void setupDefaultNetworkSettings(const QString &host);
- std::function<ProjectExplorer::RunWorker *(ProjectExplorer::RunControl *)>
- workerCreator(Core::Id id) const override;
-
private:
QdbDevice();
diff --git a/src/plugins/boot2qt/qdbdevicedebugsupport.cpp b/src/plugins/boot2qt/qdbdevicedebugsupport.cpp
index 7ef38ad832..c8c8c22349 100644
--- a/src/plugins/boot2qt/qdbdevicedebugsupport.cpp
+++ b/src/plugins/boot2qt/qdbdevicedebugsupport.cpp
@@ -175,17 +175,17 @@ void QdbDeviceDebugSupport::stop()
// QdbDeviceQmlProfilerSupport
-QdbDeviceQmlToolingSupport::QdbDeviceQmlToolingSupport(RunControl *runControl,
- QmlDebug::QmlDebugServicesPreset services)
+QdbDeviceQmlToolingSupport::QdbDeviceQmlToolingSupport(RunControl *runControl)
: RunWorker(runControl)
{
setId("QdbDeviceQmlToolingSupport");
+ QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode());
m_runner = new QdbDeviceInferiorRunner(runControl, false, false, true, services);
addStartDependency(m_runner);
addStopDependency(m_runner);
- m_worker = runControl->createWorker(runControl->runMode());
+ m_worker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode()));
m_worker->addStartDependency(this);
addStopDependency(m_worker);
}
diff --git a/src/plugins/boot2qt/qdbdevicedebugsupport.h b/src/plugins/boot2qt/qdbdevicedebugsupport.h
index 0f07b20f48..8ed779d370 100644
--- a/src/plugins/boot2qt/qdbdevicedebugsupport.h
+++ b/src/plugins/boot2qt/qdbdevicedebugsupport.h
@@ -47,8 +47,7 @@ private:
class QdbDeviceQmlToolingSupport : public ProjectExplorer::RunWorker
{
public:
- QdbDeviceQmlToolingSupport(ProjectExplorer::RunControl *runControl,
- QmlDebug::QmlDebugServicesPreset services);
+ QdbDeviceQmlToolingSupport(ProjectExplorer::RunControl *runControl);
private:
void start() override;
@@ -57,22 +56,6 @@ private:
ProjectExplorer::RunWorker *m_worker = nullptr;
};
-class QdbDeviceQmlProfilerSupport : public QdbDeviceQmlToolingSupport
-{
-public:
- QdbDeviceQmlProfilerSupport(ProjectExplorer::RunControl *runControl) :
- QdbDeviceQmlToolingSupport(runControl, QmlDebug::QmlProfilerServices)
- {}
-};
-
-class QdbDeviceQmlPreviewSupport : public QdbDeviceQmlToolingSupport
-{
-public:
- QdbDeviceQmlPreviewSupport(ProjectExplorer::RunControl *runControl) :
- QdbDeviceQmlToolingSupport(runControl, QmlDebug::QmlPreviewServices)
- {}
-};
-
class QdbDevicePerfProfilerSupport : public ProjectExplorer::RunWorker
{
public:
diff --git a/src/plugins/boot2qt/qdbplugin.cpp b/src/plugins/boot2qt/qdbplugin.cpp
index 2a3c85f085..804df7eab1 100644
--- a/src/plugins/boot2qt/qdbplugin.cpp
+++ b/src/plugins/boot2qt/qdbplugin.cpp
@@ -197,16 +197,17 @@ public:
supportedRunConfigs,
{Qdb::Constants::QdbLinuxOsType}
};
- RunWorkerFactory qmlProfilerWorkerFactory{
- RunWorkerFactory::make<QdbDeviceQmlProfilerSupport>(),
- {ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
+ RunWorkerFactory qmlToolWorkerFactory{
+ RunWorkerFactory::make<QdbDeviceQmlToolingSupport>(),
+ {ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
+ ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
supportedRunConfigs,
{Qdb::Constants::QdbLinuxOsType}
};
- RunWorkerFactory qmlPreviewWorkerFactory{
- RunWorkerFactory::make<QdbDeviceQmlPreviewSupport>(),
- {ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
- supportedRunConfigs,
+ RunWorkerFactory perfRecorderFactory{
+ RunWorkerFactory::make<QdbDevicePerfProfilerSupport>(),
+ {"PerfRecorder"},
+ {},
{Qdb::Constants::QdbLinuxOsType}
};