diff --git a/src/plugins/android/androiddevice.cpp b/src/plugins/android/androiddevice.cpp index 6f9b11ba1d3..6bad5d22827 100644 --- a/src/plugins/android/androiddevice.cpp +++ b/src/plugins/android/androiddevice.cpp @@ -27,6 +27,8 @@ #include "androidconstants.h" #include "androidsignaloperation.h" +#include + #include using namespace ProjectExplorer; @@ -96,9 +98,9 @@ IDevice::Ptr AndroidDevice::clone() const return IDevice::Ptr(new AndroidDevice(*this)); } -QString AndroidDevice::qmlProfilerHost() const +Connection AndroidDevice::toolControlChannel(const ControlChannelHint &) const { - return QLatin1String("localhost"); + return HostName("localhost"); } } // namespace Internal diff --git a/src/plugins/android/androiddevice.h b/src/plugins/android/androiddevice.h index b9dfe6ea70a..f050b445373 100644 --- a/src/plugins/android/androiddevice.h +++ b/src/plugins/android/androiddevice.h @@ -46,7 +46,7 @@ class AndroidDevice : public ProjectExplorer::IDevice ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override; ProjectExplorer::IDevice::Ptr clone() const override; - QString qmlProfilerHost() const override; + ProjectExplorer::Connection toolControlChannel(const ControlChannelHint &) const override; protected: friend class AndroidDeviceFactory; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 03e424b803f..3bfa4f9771c 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -2156,7 +2156,9 @@ void DebuggerPluginPrivate::attachToQmlPort() IDevice::ConstPtr device = DeviceKitInformation::device(kit); if (device) { rp.connParams = device->sshParameters(); - rp.qmlServerAddress = device->qmlProfilerHost(); + Connection toolControl = device->toolControlChannel(IDevice::QmlControlChannel); + QTC_ASSERT(toolControl.is(), return); + rp.qmlServerAddress = toolControl.as().host(); } rp.qmlServerPort = Utils::Port(dlg.port()); rp.startMode = AttachToRemoteProcess; diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp index 71ecf037d54..0b305b9818c 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp @@ -29,7 +29,9 @@ #include "localprocesslist.h" #include "desktopdeviceconfigurationwidget.h" #include "desktopprocesssignaloperation.h" + #include +#include #include @@ -134,9 +136,9 @@ DeviceEnvironmentFetcher::Ptr DesktopDevice::environmentFetcher() const return DeviceEnvironmentFetcher::Ptr(new DesktopDeviceEnvironmentFetcher()); } -QString DesktopDevice::qmlProfilerHost() const +Connection DesktopDevice::toolControlChannel(const ControlChannelHint &) const { - return QLatin1String("localhost"); + return HostName("localhost"); } IDevice::Ptr DesktopDevice::clone() const diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.h b/src/plugins/projectexplorer/devicesupport/desktopdevice.h index b99d83457de..752bd20075f 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.h +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.h @@ -52,7 +52,7 @@ class PROJECTEXPLORER_EXPORT DesktopDevice : public IDevice DeviceProcess *createProcess(QObject *parent) const override; DeviceProcessSignalOperation::Ptr signalOperation() const override; DeviceEnvironmentFetcher::Ptr environmentFetcher() const override; - QString qmlProfilerHost() const override; + Connection toolControlChannel(const ControlChannelHint &) const override; IDevice::Ptr clone() const override; diff --git a/src/plugins/projectexplorer/devicesupport/idevice.cpp b/src/plugins/projectexplorer/devicesupport/idevice.cpp index b48a6b51eca..691bfbfe2d4 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/idevice.cpp @@ -30,6 +30,7 @@ #include "../kit.h" #include "../kitinformation.h" +#include "../runconfiguration.h" #include #include @@ -407,9 +408,9 @@ void IDevice::setSshParameters(const QSsh::SshConnectionParameters &sshParameter d->sshParameters.hostKeyDatabase = DeviceManager::instance()->hostKeyDatabase(); } -QString IDevice::qmlProfilerHost() const +Connection IDevice::toolControlChannel(const ControlChannelHint &) const { - return d->sshParameters.host; + return HostName(d->sshParameters.host); } void IDevice::setFreePorts(const Utils::PortList &freePorts) diff --git a/src/plugins/projectexplorer/devicesupport/idevice.h b/src/plugins/projectexplorer/devicesupport/idevice.h index ff30c66cf1d..c5043e8a3b3 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.h +++ b/src/plugins/projectexplorer/devicesupport/idevice.h @@ -48,9 +48,10 @@ class Port; } // Utils namespace ProjectExplorer { + +class Connection; class DeviceProcess; class DeviceProcessList; - class Kit; namespace Internal { class IDevicePrivate; } @@ -107,6 +108,16 @@ class PROJECTEXPLORER_EXPORT PortsGatheringMethod virtual QList usedPorts(const QByteArray &commandOutput) const = 0; }; +class PROJECTEXPLORER_EXPORT HostName +{ +public: + explicit HostName(const QString &host) : m_host(host) {} + QString host() const { return m_host; } + +private: + QString m_host; +}; + // See cpp file for documentation. class PROJECTEXPLORER_EXPORT IDevice { @@ -178,7 +189,8 @@ class PROJECTEXPLORER_EXPORT IDevice QSsh::SshConnectionParameters sshParameters() const; void setSshParameters(const QSsh::SshConnectionParameters &sshParameters); - virtual QString qmlProfilerHost() const; + enum ControlChannelHint { QmlControlChannel }; + virtual Connection toolControlChannel(const ControlChannelHint &) const; Utils::PortList freePorts() const; void setFreePorts(const Utils::PortList &freePorts); diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 8e793b75996..3427b9a522e 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -562,8 +562,10 @@ void QmlProfilerTool::startRemoteTool(ProjectExplorer::RunConfiguration *rc) IDevice::ConstPtr device = DeviceKitInformation::device(kit); if (device) { + Connection toolControl = device->toolControlChannel(IDevice::QmlControlChannel); + QTC_ASSERT(toolControl.is(), return); + connection.analyzerHost = toolControl.as().host(); connection.connParams = device->sshParameters(); - connection.analyzerHost = device->qmlProfilerHost(); } connection.analyzerPort = Utils::Port(port);