ProjectExplorer/RemoteLinux/Qnx: Use centralized access to device

ToolRunner have access to the RunControl, which have a device.
No need for another copy anymore.

Change-Id: I1b71cf2fad9ecbadba859b7963175c1b7057f94d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2017-04-05 16:14:58 +02:00
parent 0410f4e0ba
commit fa3d597e5f
6 changed files with 11 additions and 20 deletions

View File

@@ -1187,6 +1187,11 @@ void ToolRunner::appendMessage(const QString &msg, OutputFormat format)
m_runControl->appendMessage(msg, format); m_runControl->appendMessage(msg, format);
} }
IDevice::ConstPtr ToolRunner::device() const
{
return m_runControl->device();
}
// SimpleRunControl // SimpleRunControl

View File

@@ -483,6 +483,7 @@ public:
RunControl *runControl() const; RunControl *runControl() const;
void appendMessage(const QString &msg, Utils::OutputFormat format); void appendMessage(const QString &msg, Utils::OutputFormat format);
IDevice::ConstPtr device() const;
virtual void prepare() { emit prepared(); } virtual void prepare() { emit prepared(); }
virtual void start() { emit started(); } virtual void start() { emit started(); }

View File

@@ -40,7 +40,6 @@ namespace Internal {
QnxAbstractRunSupport::QnxAbstractRunSupport(RunControl *runControl) QnxAbstractRunSupport::QnxAbstractRunSupport(RunControl *runControl)
: ToolRunner(runControl) : ToolRunner(runControl)
, m_device(DeviceKitInformation::device(runControl->runConfiguration()->target()->kit()))
, m_state(Inactive) , m_state(Inactive)
{ {
m_launcher = new ApplicationLauncher(this); m_launcher = new ApplicationLauncher(this);
@@ -63,7 +62,7 @@ void QnxAbstractRunSupport::handleAdapterSetupRequested()
void QnxAbstractRunSupport::handlePortListReady() void QnxAbstractRunSupport::handlePortListReady()
{ {
QTC_ASSERT(m_state == GatheringPorts, return); QTC_ASSERT(m_state == GatheringPorts, return);
m_portList = m_device->freePorts(); m_portList = device()->freePorts();
startExecution(); startExecution();
} }
@@ -99,11 +98,6 @@ ApplicationLauncher *QnxAbstractRunSupport::appRunner() const
return m_launcher; return m_launcher;
} }
const IDevice::ConstPtr QnxAbstractRunSupport::device() const
{
return m_device;
}
void QnxAbstractRunSupport::handleProgressReport(const QString &) void QnxAbstractRunSupport::handleProgressReport(const QString &)
{ {
} }

View File

@@ -66,7 +66,6 @@ protected:
void setState(State state); void setState(State state);
ProjectExplorer::ApplicationLauncher *appRunner() const; ProjectExplorer::ApplicationLauncher *appRunner() const;
const ProjectExplorer::IDevice::ConstPtr device() const;
public slots: public slots:
virtual void handleAdapterSetupRequested(); virtual void handleAdapterSetupRequested();

View File

@@ -43,8 +43,7 @@ class AbstractRemoteLinuxRunSupportPrivate
public: public:
AbstractRemoteLinuxRunSupportPrivate(const RunConfiguration *runConfig) AbstractRemoteLinuxRunSupportPrivate(const RunConfiguration *runConfig)
: state(AbstractRemoteLinuxRunSupport::Inactive), : state(AbstractRemoteLinuxRunSupport::Inactive),
runnable(runConfig->runnable().as<StandardRunnable>()), runnable(runConfig->runnable().as<StandardRunnable>())
device(DeviceKitInformation::device(runConfig->target()->kit()))
{ {
} }
@@ -53,7 +52,6 @@ public:
ApplicationLauncher appLauncher; ApplicationLauncher appLauncher;
DeviceUsedPortsGatherer portsGatherer; DeviceUsedPortsGatherer portsGatherer;
ApplicationLauncher fifoCreator; ApplicationLauncher fifoCreator;
const IDevice::ConstPtr device;
Utils::PortList portList; Utils::PortList portList;
QString fifo; QString fifo;
}; };
@@ -94,7 +92,7 @@ void AbstractRemoteLinuxRunSupport::handleResourcesAvailable()
{ {
QTC_ASSERT(d->state == GatheringResources, return); QTC_ASSERT(d->state == GatheringResources, return);
d->portList = d->device->freePorts(); d->portList = device()->freePorts();
startExecution(); startExecution();
} }
@@ -136,7 +134,7 @@ void AbstractRemoteLinuxRunSupport::startPortsGathering()
this, &AbstractRemoteLinuxRunSupport::handleResourcesError); this, &AbstractRemoteLinuxRunSupport::handleResourcesError);
connect(&d->portsGatherer, &DeviceUsedPortsGatherer::portListReady, connect(&d->portsGatherer, &DeviceUsedPortsGatherer::portListReady,
this, &AbstractRemoteLinuxRunSupport::handleResourcesAvailable); this, &AbstractRemoteLinuxRunSupport::handleResourcesAvailable);
d->portsGatherer.start(d->device); d->portsGatherer.start(device());
} }
void AbstractRemoteLinuxRunSupport::createRemoteFifo() void AbstractRemoteLinuxRunSupport::createRemoteFifo()
@@ -173,12 +171,7 @@ void AbstractRemoteLinuxRunSupport::createRemoteFifo()
errors->append(data); errors->append(data);
}); });
d->fifoCreator.start(r, d->device); d->fifoCreator.start(r, device());
}
const IDevice::ConstPtr AbstractRemoteLinuxRunSupport::device() const
{
return d->device;
} }
const StandardRunnable &AbstractRemoteLinuxRunSupport::runnable() const const StandardRunnable &AbstractRemoteLinuxRunSupport::runnable() const

View File

@@ -78,7 +78,6 @@ protected:
void createRemoteFifo(); void createRemoteFifo();
QString fifo() const; QString fifo() const;
const ProjectExplorer::IDevice::ConstPtr device() const;
const ProjectExplorer::StandardRunnable &runnable() const; const ProjectExplorer::StandardRunnable &runnable() const;
void reset(); void reset();