diff --git a/src/plugins/qnx/qnxanalyzesupport.cpp b/src/plugins/qnx/qnxanalyzesupport.cpp index b7f3c4d5f22..29ea42b7cdb 100644 --- a/src/plugins/qnx/qnxanalyzesupport.cpp +++ b/src/plugins/qnx/qnxanalyzesupport.cpp @@ -3,6 +3,7 @@ #include "qnxanalyzesupport.h" +#include "qnxconstants.h" #include "qnxtr.h" #include "slog2inforunner.h" @@ -18,30 +19,41 @@ using namespace Utils; namespace Qnx::Internal { -QnxQmlProfilerSupport::QnxQmlProfilerSupport(RunControl *runControl) - : SimpleTargetRunner(runControl) +class QnxQmlProfilerSupport final : public SimpleTargetRunner { - setId("QnxQmlProfilerSupport"); - appendMessage(Tr::tr("Preparing remote side..."), Utils::LogMessageFormat); +public: + explicit QnxQmlProfilerSupport(RunControl *runControl) + : SimpleTargetRunner(runControl) + { + setId("QnxQmlProfilerSupport"); + appendMessage(Tr::tr("Preparing remote side..."), LogMessageFormat); - auto portsGatherer = new PortsGatherer(runControl); - addStartDependency(portsGatherer); + auto portsGatherer = new PortsGatherer(runControl); + addStartDependency(portsGatherer); - auto slog2InfoRunner = new Slog2InfoRunner(runControl); - addStartDependency(slog2InfoRunner); + auto slog2InfoRunner = new Slog2InfoRunner(runControl); + addStartDependency(slog2InfoRunner); - auto profiler = runControl->createWorker(ProjectExplorer::Constants::QML_PROFILER_RUNNER); - profiler->addStartDependency(this); - addStopDependency(profiler); + auto profiler = runControl->createWorker(ProjectExplorer::Constants::QML_PROFILER_RUNNER); + profiler->addStartDependency(this); + addStopDependency(profiler); - setStartModifier([this, portsGatherer, profiler] { - const QUrl serverUrl = portsGatherer->findEndPoint(); - profiler->recordData("QmlServerUrl", serverUrl); + setStartModifier([this, portsGatherer, profiler] { + const QUrl serverUrl = portsGatherer->findEndPoint(); + profiler->recordData("QmlServerUrl", serverUrl); - CommandLine cmd = commandLine(); - cmd.addArg(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, serverUrl)); - setCommandLine(cmd); - }); + CommandLine cmd = commandLine(); + cmd.addArg(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, serverUrl)); + setCommandLine(cmd); + }); + } +}; + +QnxQmlProfilerWorkerFactory::QnxQmlProfilerWorkerFactory() +{ + setProduct(); + // FIXME: Shouldn't this use the run mode id somehow? + addSupportedRunConfig(Constants::QNX_RUNCONFIG_ID); } } // Qnx::Internal diff --git a/src/plugins/qnx/qnxanalyzesupport.h b/src/plugins/qnx/qnxanalyzesupport.h index e37b0cb3b56..7797f21d30e 100644 --- a/src/plugins/qnx/qnxanalyzesupport.h +++ b/src/plugins/qnx/qnxanalyzesupport.h @@ -7,10 +7,10 @@ namespace Qnx::Internal { -class QnxQmlProfilerSupport : public ProjectExplorer::SimpleTargetRunner +class QnxQmlProfilerWorkerFactory final : public ProjectExplorer::RunWorkerFactory { public: - explicit QnxQmlProfilerSupport(ProjectExplorer::RunControl *runControl); + QnxQmlProfilerWorkerFactory(); }; } // Qnx::Internal diff --git a/src/plugins/qnx/qnxconstants.h b/src/plugins/qnx/qnxconstants.h index d1194383f9f..7c71de5511e 100644 --- a/src/plugins/qnx/qnxconstants.h +++ b/src/plugins/qnx/qnxconstants.h @@ -5,18 +5,13 @@ #include -namespace Qnx { -namespace Constants { +namespace Qnx::Constants { const char QNX_QNX_QT[] = "Qt4ProjectManager.QtVersion.QNX.QNX"; - const char QNX_QNX_FEATURE[] = "QtSupport.Wizards.FeatureQNX"; - const char QNX_QNX_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.QNX.QNXDeployConfiguration"; - +const char QNX_RUNCONFIG_ID[] = "Qt4ProjectManager.QNX.QNXRunConfiguration."; const char QNX_QNX_OS_TYPE[] = "QnxOsType"; // Also used for device type. - const char QNX_TOOLCHAIN_ID[] = "Qnx.QccToolChain"; -} // namespace Constants -} // namespace Qnx +} // Qnx::Constants diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index 9285fa29802..c401536d49a 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -102,33 +102,37 @@ public: // QnxDebugSupport -QnxDebugSupport::QnxDebugSupport(RunControl *runControl) - : DebuggerRunTool(runControl) +class QnxDebugSupport : public Debugger::DebuggerRunTool { - setId("QnxDebugSupport"); - appendMessage(Tr::tr("Preparing remote side..."), LogMessageFormat); +public: + explicit QnxDebugSupport(ProjectExplorer::RunControl *runControl) + : DebuggerRunTool(runControl) + { + setId("QnxDebugSupport"); + appendMessage(Tr::tr("Preparing remote side..."), LogMessageFormat); - setUsePortsGatherer(isCppDebugging(), isQmlDebugging()); + setUsePortsGatherer(isCppDebugging(), isQmlDebugging()); - auto debuggeeRunner = new QnxDebuggeeRunner(runControl, portsGatherer()); - debuggeeRunner->addStartDependency(portsGatherer()); + auto debuggeeRunner = new QnxDebuggeeRunner(runControl, portsGatherer()); + debuggeeRunner->addStartDependency(portsGatherer()); - auto slog2InfoRunner = new Slog2InfoRunner(runControl); - debuggeeRunner->addStartDependency(slog2InfoRunner); + auto slog2InfoRunner = new Slog2InfoRunner(runControl); + debuggeeRunner->addStartDependency(slog2InfoRunner); - addStartDependency(debuggeeRunner); + addStartDependency(debuggeeRunner); - Kit *k = runControl->kit(); + Kit *k = runControl->kit(); - setStartMode(AttachToRemoteServer); - setCloseMode(KillAtClose); - setUseCtrlCStub(true); - setSolibSearchPath(FileUtils::toFilePathList(searchPaths(k))); - if (auto qtVersion = dynamic_cast(QtSupport::QtKitAspect::qtVersion(k))) { - setSysRoot(qtVersion->qnxTarget()); - modifyDebuggerEnvironment(qtVersion->environment()); + setStartMode(AttachToRemoteServer); + setCloseMode(KillAtClose); + setUseCtrlCStub(true); + setSolibSearchPath(FileUtils::toFilePathList(searchPaths(k))); + if (auto qtVersion = dynamic_cast(QtSupport::QtKitAspect::qtVersion(k))) { + setSysRoot(qtVersion->qnxTarget()); + modifyDebuggerEnvironment(qtVersion->environment()); + } } -} +}; // QnxAttachDebugDialog @@ -183,20 +187,24 @@ public: } }; -QnxAttachDebugSupport::QnxAttachDebugSupport(RunControl *runControl) - : DebuggerRunTool(runControl) +class QnxAttachDebugSupport : public Debugger::DebuggerRunTool { - setId("QnxAttachDebugSupport"); +public: + explicit QnxAttachDebugSupport(ProjectExplorer::RunControl *runControl) + : DebuggerRunTool(runControl) + { + setId("QnxAttachDebugSupport"); - setUsePortsGatherer(isCppDebugging(), isQmlDebugging()); + setUsePortsGatherer(isCppDebugging(), isQmlDebugging()); - if (isCppDebugging()) { - auto pdebugRunner = new PDebugRunner(runControl, portsGatherer()); - addStartDependency(pdebugRunner); + if (isCppDebugging()) { + auto pdebugRunner = new PDebugRunner(runControl, portsGatherer()); + addStartDependency(pdebugRunner); + } } -} +}; -void QnxAttachDebugSupport::showProcessesDialog() +void showAttachToProcessDialog() { auto kitChooser = new KitChooser; kitChooser->setKitPredicate([](const Kit *k) { @@ -242,4 +250,13 @@ void QnxAttachDebugSupport::showProcessesDialog() ProjectExplorerPlugin::startRunControl(runControl); } +// QnxDebugWorkerFactory + +QnxDebugWorkerFactory::QnxDebugWorkerFactory() +{ + setProduct(); + addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE); + addSupportedRunConfig(Constants::QNX_RUNCONFIG_ID); +} + } // Qnx::Internal diff --git a/src/plugins/qnx/qnxdebugsupport.h b/src/plugins/qnx/qnxdebugsupport.h index 379604e87ca..3cbb6ef7fea 100644 --- a/src/plugins/qnx/qnxdebugsupport.h +++ b/src/plugins/qnx/qnxdebugsupport.h @@ -7,18 +7,12 @@ namespace Qnx::Internal { -class QnxDebugSupport : public Debugger::DebuggerRunTool +void showAttachToProcessDialog(); + +class QnxDebugWorkerFactory final : public ProjectExplorer::RunWorkerFactory { public: - explicit QnxDebugSupport(ProjectExplorer::RunControl *runControl); -}; - -class QnxAttachDebugSupport : public Debugger::DebuggerRunTool -{ -public: - explicit QnxAttachDebugSupport(ProjectExplorer::RunControl *runControl); - - static void showProcessesDialog(); + QnxDebugWorkerFactory(); }; } // Qnx::Internal diff --git a/src/plugins/qnx/qnxplugin.cpp b/src/plugins/qnx/qnxplugin.cpp index 0759db5225c..590ff64d758 100644 --- a/src/plugins/qnx/qnxplugin.cpp +++ b/src/plugins/qnx/qnxplugin.cpp @@ -103,17 +103,8 @@ public: QnxSettingsPage settingsPage; QnxToolChainFactory toolChainFactory; SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}}; - - RunWorkerFactory debugWorkerFactory{ - RunWorkerFactory::make(), - {ProjectExplorer::Constants::DEBUG_RUN_MODE}, - {runConfigFactory.runConfigurationId()} - }; - RunWorkerFactory qmlProfilerWorkerFactory{ - RunWorkerFactory::make(), - {}, // FIXME: Shouldn't this use the run mode id somehow? - {runConfigFactory.runConfigurationId()} - }; + QnxDebugWorkerFactory debugWorkerFactory; + QnxQmlProfilerWorkerFactory qmlProfilerWorkerFactory; }; static QnxPluginPrivate *dd = nullptr; @@ -136,8 +127,7 @@ bool QnxPlugin::initialize(const QStringList &arguments, QString *errorString) void QnxPlugin::extensionsInitialized() { // Attach support - connect(&dd->m_attachToQnxApplication, &QAction::triggered, - this, [] { QnxAttachDebugSupport::showProcessesDialog(); }); + connect(&dd->m_attachToQnxApplication, &QAction::triggered, this, &showAttachToProcessDialog); const char QNX_DEBUGGING_GROUP[] = "Debugger.Group.Qnx"; diff --git a/src/plugins/qnx/qnxrunconfiguration.cpp b/src/plugins/qnx/qnxrunconfiguration.cpp index 0291e9fc5d9..e80c4d2c2ae 100644 --- a/src/plugins/qnx/qnxrunconfiguration.cpp +++ b/src/plugins/qnx/qnxrunconfiguration.cpp @@ -80,7 +80,7 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Id id) QnxRunConfigurationFactory::QnxRunConfigurationFactory() { - registerRunConfiguration("Qt4ProjectManager.QNX.QNXRunConfiguration."); + registerRunConfiguration(Constants::QNX_RUNCONFIG_ID); addSupportedTargetDeviceType(Constants::QNX_QNX_OS_TYPE); }