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);
}
IDevice::ConstPtr ToolRunner::device() const
{
return m_runControl->device();
}
// SimpleRunControl

View File

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

View File

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

View File

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

View File

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

View File

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