diff --git a/src/plugins/remotelinux/CMakeLists.txt b/src/plugins/remotelinux/CMakeLists.txt index fe0bfe75054..7f486510e97 100644 --- a/src/plugins/remotelinux/CMakeLists.txt +++ b/src/plugins/remotelinux/CMakeLists.txt @@ -25,7 +25,6 @@ add_qtc_plugin(RemoteLinux remotelinuxdeployconfiguration.cpp remotelinuxdeployconfiguration.h remotelinuxenvironmentaspect.cpp remotelinuxenvironmentaspect.h remotelinuxplugin.cpp remotelinuxplugin.h - remotelinuxqmltoolingsupport.cpp remotelinuxqmltoolingsupport.h remotelinuxrunconfiguration.cpp remotelinuxrunconfiguration.h remotelinuxsignaloperation.cpp remotelinuxsignaloperation.h rsyncdeploystep.cpp rsyncdeploystep.h diff --git a/src/plugins/remotelinux/remotelinux.qbs b/src/plugins/remotelinux/remotelinux.qbs index 29f82737bf8..cea281f43c1 100644 --- a/src/plugins/remotelinux/remotelinux.qbs +++ b/src/plugins/remotelinux/remotelinux.qbs @@ -55,8 +55,6 @@ Project { "remotelinuxenvironmentaspect.h", "remotelinuxplugin.cpp", "remotelinuxplugin.h", - "remotelinuxqmltoolingsupport.cpp", - "remotelinuxqmltoolingsupport.h", "remotelinuxrunconfiguration.cpp", "remotelinuxrunconfiguration.h", "remotelinuxsignaloperation.cpp", diff --git a/src/plugins/remotelinux/remotelinux_constants.h b/src/plugins/remotelinux/remotelinux_constants.h index 159b6c31677..31a97588281 100644 --- a/src/plugins/remotelinux/remotelinux_constants.h +++ b/src/plugins/remotelinux/remotelinux_constants.h @@ -21,5 +21,8 @@ const char KillAppStepId[] = "RemoteLinux.KillAppStep"; const char SupportsRSync[] = "RemoteLinux.SupportsRSync"; +const char RunConfigId[] = "RemoteLinuxRunConfiguration:"; +const char CustomRunConfigId[] = "RemoteLinux.CustomRunConfig"; + } // Constants } // RemoteLinux diff --git a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp index 7f44f336412..36e4b0bda24 100644 --- a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp @@ -84,7 +84,7 @@ Tasks RemoteLinuxCustomRunConfiguration::checkForIssues() const RemoteLinuxCustomRunConfigurationFactory::RemoteLinuxCustomRunConfigurationFactory() : FixedRunConfigurationFactory(Tr::tr("Custom Executable"), true) { - registerRunConfiguration("RemoteLinux.CustomRunConfig"); + registerRunConfiguration(Constants::CustomRunConfigId); addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType); } diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index 2f706c6e94c..af476d48b94 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -10,15 +10,18 @@ #include +#include + using namespace Debugger; using namespace ProjectExplorer; +using namespace Utils; namespace RemoteLinux::Internal { class RemoteLinuxDebugWorker final : public DebuggerRunTool { public: - RemoteLinuxDebugWorker(RunControl *runControl) + explicit RemoteLinuxDebugWorker(RunControl *runControl) : DebuggerRunTool(runControl, DoNotAllowTerminal) { setId("RemoteLinuxDebugWorker"); @@ -38,22 +41,72 @@ public: } }; +class RemoteLinuxQmlToolingSupport final : public SimpleTargetRunner +{ +public: + explicit RemoteLinuxQmlToolingSupport(RunControl *runControl) + : SimpleTargetRunner(runControl) + { + setId("RemoteLinuxQmlToolingSupport"); + + auto portsGatherer = new PortsGatherer(runControl); + addStartDependency(portsGatherer); + + // The ports gatherer can safely be stopped once the process is running, even though it has to + // be started before. + addStopDependency(portsGatherer); + + auto runworker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode())); + runworker->addStartDependency(this); + addStopDependency(runworker); + + setStartModifier([this, runControl, portsGatherer, runworker] { + const QUrl serverUrl = portsGatherer->findEndPoint(); + runworker->recordData("QmlServerUrl", serverUrl); + + QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode()); + + CommandLine cmd = commandLine(); + cmd.addArg(QmlDebug::qmlDebugTcpArguments(services, serverUrl)); + setCommandLine(cmd); + }); + } +}; + // Factories -RemoteLinuxRunWorkerFactory::RemoteLinuxRunWorkerFactory(const QList &runConfigs) +static const QList supportedRunConfigs() +{ + return { + Constants::RunConfigId, + Constants::CustomRunConfigId, + "QmlProjectManager.QmlRunConfiguration" + }; +} + +RemoteLinuxRunWorkerFactory::RemoteLinuxRunWorkerFactory() { setProduct(); addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE); - setSupportedRunConfigs(runConfigs); addSupportedDeviceType(Constants::GenericLinuxOsType); + setSupportedRunConfigs(supportedRunConfigs()); } -RemoteLinuxDebugWorkerFactory::RemoteLinuxDebugWorkerFactory(const QList &runConfigs) +RemoteLinuxDebugWorkerFactory::RemoteLinuxDebugWorkerFactory() { setProduct(); addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE); - setSupportedRunConfigs(runConfigs); addSupportedDeviceType(Constants::GenericLinuxOsType); + setSupportedRunConfigs(supportedRunConfigs()); } -} // Internal::Internal +RemoteLinuxQmlToolingWorkerFactory::RemoteLinuxQmlToolingWorkerFactory() +{ + setProduct(); + addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE); + addSupportedRunMode(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE); + addSupportedDeviceType(Constants::GenericLinuxOsType); + setSupportedRunConfigs(supportedRunConfigs()); +} + +} // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.h b/src/plugins/remotelinux/remotelinuxdebugsupport.h index a8142c79363..dd781167f29 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.h +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.h @@ -10,13 +10,19 @@ namespace RemoteLinux::Internal { class RemoteLinuxRunWorkerFactory final : public ProjectExplorer::RunWorkerFactory { public: - explicit RemoteLinuxRunWorkerFactory(const QList &runConfigs); + explicit RemoteLinuxRunWorkerFactory(); }; class RemoteLinuxDebugWorkerFactory final : public ProjectExplorer::RunWorkerFactory { public: - explicit RemoteLinuxDebugWorkerFactory(const QList &runConfigs); + explicit RemoteLinuxDebugWorkerFactory(); +}; + +class RemoteLinuxQmlToolingWorkerFactory final : public ProjectExplorer::RunWorkerFactory +{ +public: + explicit RemoteLinuxQmlToolingWorkerFactory(); }; } // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp index aaf457197ed..4048c392e43 100644 --- a/src/plugins/remotelinux/remotelinuxplugin.cpp +++ b/src/plugins/remotelinux/remotelinuxplugin.cpp @@ -10,7 +10,6 @@ #include "makeinstallstep.h" #include "remotelinux_constants.h" #include "remotelinuxdeployconfiguration.h" -#include "remotelinuxqmltoolingsupport.h" #include "remotelinuxcustomrunconfiguration.h" #include "remotelinuxdebugsupport.h" #include "remotelinuxdeployconfiguration.h" @@ -62,15 +61,9 @@ public: CustomCommandDeployStepFactory customCommandDeployStepFactory; KillAppStepFactory killAppStepFactory; GenericDeployStepFactory makeInstallStepFactory; - - const QList supportedRunConfigs { - runConfigurationFactory.runConfigurationId(), - customRunConfigurationFactory.runConfigurationId(), - "QmlProjectManager.QmlRunConfiguration" - }; - RemoteLinuxRunWorkerFactory runWorkerFactory{supportedRunConfigs}; - RemoteLinuxDebugWorkerFactory debugWorkerFactory{supportedRunConfigs}; - RemoteLinuxQmlToolingWorkerFactory qmlToolingWorkerFactory{supportedRunConfigs}; + RemoteLinuxRunWorkerFactory runWorkerFactory; + RemoteLinuxDebugWorkerFactory debugWorkerFactory; + RemoteLinuxQmlToolingWorkerFactory qmlToolingWorkerFactory; }; static RemoteLinuxPluginPrivate *dd = nullptr; diff --git a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp b/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp deleted file mode 100644 index cf74a176c8d..00000000000 --- a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#include "remotelinuxqmltoolingsupport.h" - -#include "remotelinux_constants.h" - -#include -#include - -#include - -using namespace ProjectExplorer; -using namespace Utils; - -namespace RemoteLinux::Internal { - -class RemoteLinuxQmlToolingSupport : public SimpleTargetRunner -{ -public: - explicit RemoteLinuxQmlToolingSupport(RunControl *runControl) - : SimpleTargetRunner(runControl) - { - setId("RemoteLinuxQmlToolingSupport"); - - auto portsGatherer = new PortsGatherer(runControl); - addStartDependency(portsGatherer); - - // The ports gatherer can safely be stopped once the process is running, even though it has to - // be started before. - addStopDependency(portsGatherer); - - auto runworker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode())); - runworker->addStartDependency(this); - addStopDependency(runworker); - - setStartModifier([this, runControl, portsGatherer, runworker] { - const QUrl serverUrl = portsGatherer->findEndPoint(); - runworker->recordData("QmlServerUrl", serverUrl); - - QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode()); - - CommandLine cmd = commandLine(); - cmd.addArg(QmlDebug::qmlDebugTcpArguments(services, serverUrl)); - setCommandLine(cmd); - }); - } -}; - -RemoteLinuxQmlToolingWorkerFactory::RemoteLinuxQmlToolingWorkerFactory(const QList &runConfigs) -{ - setProduct(); - addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE); - addSupportedRunMode(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE); - setSupportedRunConfigs(runConfigs); - addSupportedDeviceType(Constants::GenericLinuxOsType); -} - -} // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.h b/src/plugins/remotelinux/remotelinuxqmltoolingsupport.h deleted file mode 100644 index f9dbdf14bbe..00000000000 --- a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.h +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - -#include - -namespace RemoteLinux::Internal { - -class RemoteLinuxQmlToolingWorkerFactory final : public ProjectExplorer::RunWorkerFactory -{ -public: - explicit RemoteLinuxQmlToolingWorkerFactory(const QList &runConfigs); -}; - -} // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index 741034b5a81..18ad4794062 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -90,7 +90,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id) RemoteLinuxRunConfigurationFactory::RemoteLinuxRunConfigurationFactory() { - registerRunConfiguration("RemoteLinuxRunConfiguration:"); + registerRunConfiguration(Constants::RunConfigId); setDecorateDisplayNames(true); addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType); }