RemoteLinux: Use base RunConfiguration if possible

Change-Id: I500faf9846f610f224808a4664d43d50cc5ad870
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
hjk
2015-04-21 16:26:53 +02:00
parent c92adf5ab4
commit 69de1da74c
3 changed files with 15 additions and 11 deletions

View File

@@ -74,7 +74,7 @@ public:
using namespace Internal; using namespace Internal;
AnalyzerStartParameters RemoteLinuxAnalyzeSupport::startParameters(const AbstractRemoteLinuxRunConfiguration *runConfig, AnalyzerStartParameters RemoteLinuxAnalyzeSupport::startParameters(const RunConfiguration *runConfig,
RunMode runMode) RunMode runMode)
{ {
AnalyzerStartParameters params; AnalyzerStartParameters params;
@@ -98,6 +98,8 @@ RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfi
SLOT(handleRemoteSetupRequested())); SLOT(handleRemoteSetupRequested()));
connect(&d->outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort, connect(&d->outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort,
this, &RemoteLinuxAnalyzeSupport::remoteIsRunning); this, &RemoteLinuxAnalyzeSupport::remoteIsRunning);
connect(engine, &RunControl::finished,
this, &RemoteLinuxAnalyzeSupport::handleProfilingFinished);
} }
RemoteLinuxAnalyzeSupport::~RemoteLinuxAnalyzeSupport() RemoteLinuxAnalyzeSupport::~RemoteLinuxAnalyzeSupport()

View File

@@ -34,6 +34,8 @@
#include "abstractremotelinuxrunsupport.h" #include "abstractremotelinuxrunsupport.h"
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfiguration.h>
#include <utils/outputformat.h> #include <utils/outputformat.h>
namespace Analyzer { namespace Analyzer {
@@ -50,7 +52,7 @@ class REMOTELINUX_EXPORT RemoteLinuxAnalyzeSupport : public AbstractRemoteLinuxR
{ {
Q_OBJECT Q_OBJECT
public: public:
static Analyzer::AnalyzerStartParameters startParameters(const AbstractRemoteLinuxRunConfiguration *runConfig, static Analyzer::AnalyzerStartParameters startParameters(const ProjectExplorer::RunConfiguration *runConfig,
ProjectExplorer::RunMode runMode); ProjectExplorer::RunMode runMode);
RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig, RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig,

View File

@@ -81,18 +81,18 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Ru
{ {
QTC_ASSERT(canRun(runConfig, mode), return 0); QTC_ASSERT(canRun(runConfig, mode), return 0);
auto * const rc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig);
QTC_ASSERT(rc, return 0);
switch (mode) { switch (mode) {
case NormalRunMode: case NormalRunMode:
return new RemoteLinuxRunControl(rc); return new RemoteLinuxRunControl(runConfig);
case DebugRunMode: case DebugRunMode:
case DebugRunModeWithBreakOnMain: { case DebugRunModeWithBreakOnMain: {
IDevice::ConstPtr dev = DeviceKitInformation::device(rc->target()->kit()); IDevice::ConstPtr dev = DeviceKitInformation::device(runConfig->target()->kit());
if (!dev) { if (!dev) {
*errorMessage = tr("Cannot debug: Kit has no device."); *errorMessage = tr("Cannot debug: Kit has no device.");
return 0; return 0;
} }
auto * const rc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig);
QTC_ASSERT(rc, return 0);
if (rc->portsUsedByDebuggers() > dev->freePorts().count()) { if (rc->portsUsedByDebuggers() > dev->freePorts().count()) {
*errorMessage = tr("Cannot debug: Not enough free ports available."); *errorMessage = tr("Cannot debug: Not enough free ports available.");
return 0; return 0;
@@ -106,7 +106,7 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Ru
DebuggerStartParameters params = LinuxDeviceDebugSupport::startParameters(rc); DebuggerStartParameters params = LinuxDeviceDebugSupport::startParameters(rc);
if (mode == DebugRunModeWithBreakOnMain) if (mode == DebugRunModeWithBreakOnMain)
params.breakOnMain = true; params.breakOnMain = true;
params.runConfiguration = rc; params.runConfiguration = runConfig;
DebuggerRunControl * const runControl DebuggerRunControl * const runControl
= DebuggerRunControlFactory::doCreate(params, errorMessage); = DebuggerRunControlFactory::doCreate(params, errorMessage);
if (!runControl) if (!runControl)
@@ -117,11 +117,11 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Ru
return runControl; return runControl;
} }
case QmlProfilerRunMode: { case QmlProfilerRunMode: {
AnalyzerStartParameters params = RemoteLinuxAnalyzeSupport::startParameters(rc, mode); AnalyzerStartParameters params = RemoteLinuxAnalyzeSupport::startParameters(runConfig, mode);
auto * const rc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig);
QTC_ASSERT(rc, return 0);
AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(params, runConfig); AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(params, runConfig);
RemoteLinuxAnalyzeSupport * const analyzeSupport = (void) new RemoteLinuxAnalyzeSupport(rc, runControl, mode);
new RemoteLinuxAnalyzeSupport(rc, runControl, mode);
connect(runControl, SIGNAL(finished()), analyzeSupport, SLOT(handleProfilingFinished()));
return runControl; return runControl;
} }
case PerfProfilerRunMode: case PerfProfilerRunMode: