From 9dd05ec34107cabeb1fcd940fc8d0255ff81c49d Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 3 Apr 2019 14:25:11 +0200 Subject: [PATCH] Qnx: Use SimpleRunWorkerFactory instead of manual registration Looks like the extra constraint was effectively checking only for the presence of a QnxRunConfiguration, which are only created for devices of type Constants::QNX_QNX_OS_TYPE, which happen to be the only one with with a bool(...dynamicCast()) == true. The previous runConfig->isEnabled() is unsystematic, not used anywhere else, and effectively globally handled in PE::canRunStartupProject. Change-Id: I5bf814fb5316bb38d315179b16ad4a78faff6899 Reviewed-by: Christian Kandeler --- src/plugins/qnx/qnxplugin.cpp | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/plugins/qnx/qnxplugin.cpp b/src/plugins/qnx/qnxplugin.cpp index 2e4c170ff77..28965ed132f 100644 --- a/src/plugins/qnx/qnxplugin.cpp +++ b/src/plugins/qnx/qnxplugin.cpp @@ -115,6 +115,13 @@ public: QnxRunConfigurationFactory runConfigFactory; QnxSettingsPage settingsPage; QnxToolChainFactory toolChainFactory; + + SimpleRunWorkerFactory + runWorkerFactory{ProjectExplorer::Constants::NORMAL_RUN_MODE}; + SimpleRunWorkerFactory + debugWorkerFactory{ProjectExplorer::Constants::DEBUG_RUN_MODE}; + SimpleRunWorkerFactory + qmlProfilerWorkerFactory; }; static QnxPluginPrivate *dd = nullptr; @@ -131,24 +138,6 @@ bool QnxPlugin::initialize(const QStringList &arguments, QString *errorString) dd = new QnxPluginPrivate; - auto constraint = [](RunConfiguration *runConfig) { - if (!runConfig->isEnabled() - || !runConfig->id().name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)) { - return false; - } - - auto dev = DeviceKitAspect::device(runConfig->target()->kit()) - .dynamicCast(); - return !dev.isNull(); - }; - - RunControl::registerWorker - (ProjectExplorer::Constants::NORMAL_RUN_MODE, constraint); - RunControl::registerWorker - (ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint); - RunControl::registerWorker - (ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, constraint); - return true; }