RemoteLinux: Make mode parameter in RemoteLinuxAnalyzeSupport optional

It's available through the runControl. Plan is to completely
remove when downstream users (B2Qt, GammaRay) have adapted.

Change-Id: Iab78513dfc99fa775dafae56ae8c1bfa5bcc3b03
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2017-03-30 15:04:28 +02:00
parent 8e56c5be3e
commit 1ad6c9465c
3 changed files with 14 additions and 14 deletions

View File

@@ -51,10 +51,9 @@ namespace Internal {
class RemoteLinuxAnalyzeSupportPrivate class RemoteLinuxAnalyzeSupportPrivate
{ {
public: public:
RemoteLinuxAnalyzeSupportPrivate(RunControl *runControl, Core::Id runMode) RemoteLinuxAnalyzeSupportPrivate(RunControl *runControl)
: runMode(runMode)
{ {
if (runMode != ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) if (runControl->runMode() != ProjectExplorer::Constants::PERFPROFILER_RUN_MODE)
return; return;
RunConfiguration *runConfiguration = runControl->runConfiguration(); RunConfiguration *runConfiguration = runControl->runConfiguration();
QTC_ASSERT(runConfiguration, return); QTC_ASSERT(runConfiguration, return);
@@ -66,7 +65,6 @@ public:
.join(' '); .join(' ');
} }
Core::Id runMode;
Utils::Port qmlPort; Utils::Port qmlPort;
QString remoteFifo; QString remoteFifo;
QString perfRecordArguments; QString perfRecordArguments;
@@ -79,9 +77,9 @@ public:
using namespace Internal; using namespace Internal;
RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(RunControl *runControl, Core::Id runMode) RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(RunControl *runControl, Core::Id)
: AbstractRemoteLinuxRunSupport(runControl), : AbstractRemoteLinuxRunSupport(runControl),
d(new RemoteLinuxAnalyzeSupportPrivate(runControl, runMode)) d(new RemoteLinuxAnalyzeSupportPrivate(runControl))
{ {
connect(runControl, &RunControl::starting, connect(runControl, &RunControl::starting,
this, &RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested); this, &RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested);
@@ -107,11 +105,12 @@ void RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested()
{ {
QTC_ASSERT(state() == Inactive, return); QTC_ASSERT(state() == Inactive, return);
if (d->runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { const Core::Id runMode = runControl()->runMode();
if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
showMessage(tr("Checking available ports...") + QLatin1Char('\n'), showMessage(tr("Checking available ports...") + QLatin1Char('\n'),
Utils::NormalMessageFormat); Utils::NormalMessageFormat);
startPortsGathering(); startPortsGathering();
} else if (d->runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) { } else if (runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) {
showMessage(tr("Creating remote socket...") + QLatin1Char('\n'), showMessage(tr("Creating remote socket...") + QLatin1Char('\n'),
Utils::NormalMessageFormat); Utils::NormalMessageFormat);
createRemoteFifo(); createRemoteFifo();
@@ -122,13 +121,14 @@ void RemoteLinuxAnalyzeSupport::startExecution()
{ {
QTC_ASSERT(state() == GatheringResources, return); QTC_ASSERT(state() == GatheringResources, return);
if (d->runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { const Core::Id runMode = runControl()->runMode();
if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
d->qmlPort = findPort(); d->qmlPort = findPort();
if (!d->qmlPort.isValid()) { if (!d->qmlPort.isValid()) {
handleAdapterSetupFailed(tr("Not enough free ports on device for profiling.")); handleAdapterSetupFailed(tr("Not enough free ports on device for profiling."));
return; return;
} }
} else if (d->runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) { } else if (runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) {
d->remoteFifo = fifo(); d->remoteFifo = fifo();
if (d->remoteFifo.isEmpty()) { if (d->remoteFifo.isEmpty()) {
handleAdapterSetupFailed(tr("FIFO for profiling data could not be created.")); handleAdapterSetupFailed(tr("FIFO for profiling data could not be created."));
@@ -154,12 +154,12 @@ void RemoteLinuxAnalyzeSupport::startExecution()
auto r = runnable(); auto r = runnable();
if (d->runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
if (!r.commandLineArguments.isEmpty()) if (!r.commandLineArguments.isEmpty())
r.commandLineArguments.append(QLatin1Char(' ')); r.commandLineArguments.append(QLatin1Char(' '));
r.commandLineArguments += QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, r.commandLineArguments += QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices,
d->qmlPort); d->qmlPort);
} else if (d->runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) { } else if (runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) {
r.commandLineArguments = QLatin1String("-c 'perf record -o - ") + d->perfRecordArguments r.commandLineArguments = QLatin1String("-c 'perf record -o - ") + d->perfRecordArguments
+ QLatin1String(" -- ") + r.executable + QLatin1String(" ") + QLatin1String(" -- ") + r.executable + QLatin1String(" ")
+ r.commandLineArguments + QLatin1String(" > ") + d->remoteFifo + r.commandLineArguments + QLatin1String(" > ") + d->remoteFifo

View File

@@ -40,7 +40,7 @@ class REMOTELINUX_EXPORT RemoteLinuxAnalyzeSupport : public AbstractRemoteLinuxR
{ {
Q_OBJECT Q_OBJECT
public: public:
RemoteLinuxAnalyzeSupport(ProjectExplorer::RunControl *runConfig, Core::Id runMode); RemoteLinuxAnalyzeSupport(ProjectExplorer::RunControl *runControl, Core::Id = Core::Id());
~RemoteLinuxAnalyzeSupport() override; ~RemoteLinuxAnalyzeSupport() override;
protected: protected:

View File

@@ -149,7 +149,7 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co
DeviceKitInformation::device(runConfig->target()->kit())->sshParameters(); DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
connection.analyzerHost = connection.connParams.host; connection.analyzerHost = connection.connParams.host;
runControl->setConnection(connection); runControl->setConnection(connection);
(void) new RemoteLinuxAnalyzeSupport(runControl, mode); (void) new RemoteLinuxAnalyzeSupport(runControl);
return runControl; return runControl;
} }