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<const QnxDevice>()) == 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 <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-04-03 14:25:11 +02:00
parent 4ff5157a24
commit 9dd05ec341

View File

@@ -115,6 +115,13 @@ public:
QnxRunConfigurationFactory runConfigFactory;
QnxSettingsPage settingsPage;
QnxToolChainFactory toolChainFactory;
SimpleRunWorkerFactory<SimpleTargetRunner, QnxRunConfiguration>
runWorkerFactory{ProjectExplorer::Constants::NORMAL_RUN_MODE};
SimpleRunWorkerFactory<QnxDebugSupport, QnxRunConfiguration>
debugWorkerFactory{ProjectExplorer::Constants::DEBUG_RUN_MODE};
SimpleRunWorkerFactory<QnxQmlProfilerSupport, QnxRunConfiguration>
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<const QnxDevice>();
return !dev.isNull();
};
RunControl::registerWorker<SimpleTargetRunner>
(ProjectExplorer::Constants::NORMAL_RUN_MODE, constraint);
RunControl::registerWorker<QnxDebugSupport>
(ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint);
RunControl::registerWorker<QnxQmlProfilerSupport>
(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, constraint);
return true;
}