forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
@@ -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 &)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -66,7 +66,6 @@ protected:
|
||||
void setState(State state);
|
||||
|
||||
ProjectExplorer::ApplicationLauncher *appRunner() const;
|
||||
const ProjectExplorer::IDevice::ConstPtr device() const;
|
||||
|
||||
public slots:
|
||||
virtual void handleAdapterSetupRequested();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -78,7 +78,6 @@ protected:
|
||||
void createRemoteFifo();
|
||||
QString fifo() const;
|
||||
|
||||
const ProjectExplorer::IDevice::ConstPtr device() const;
|
||||
const ProjectExplorer::StandardRunnable &runnable() const;
|
||||
|
||||
void reset();
|
||||
|
||||
Reference in New Issue
Block a user