forked from qt-creator/qt-creator
RemoteLinux: Reuse IDevice::portsGatheringRecipe()
Instead of DeviceUsedPortsGatherer. Change-Id: I3b2250bdc1d5b6ed0455c643671a80bd0bb32c05 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -5,9 +5,7 @@
|
|||||||
|
|
||||||
#include "linuxdevice.h"
|
#include "linuxdevice.h"
|
||||||
#include "remotelinuxtr.h"
|
#include "remotelinuxtr.h"
|
||||||
#include "utils/async.h"
|
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
|
||||||
#include <projectexplorer/devicesupport/filetransfer.h>
|
#include <projectexplorer/devicesupport/filetransfer.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
|
||||||
@@ -161,28 +159,33 @@ GroupItem GenericLinuxDeviceTesterPrivate::unameTask() const
|
|||||||
|
|
||||||
GroupItem GenericLinuxDeviceTesterPrivate::gathererTask() const
|
GroupItem GenericLinuxDeviceTesterPrivate::gathererTask() const
|
||||||
{
|
{
|
||||||
const auto onSetup = [this](DeviceUsedPortsGatherer &gatherer) {
|
const Storage<PortsOutputData> portsStorage;
|
||||||
|
|
||||||
|
const auto onSetup = [this] {
|
||||||
emit q->progressMessage(Tr::tr("Checking if specified ports are available..."));
|
emit q->progressMessage(Tr::tr("Checking if specified ports are available..."));
|
||||||
gatherer.setDevice(m_device);
|
|
||||||
};
|
};
|
||||||
const auto onDone = [this](const DeviceUsedPortsGatherer &gatherer, DoneWith result) {
|
const auto onDone = [this, portsStorage] {
|
||||||
if (result != DoneWith::Success) {
|
const auto ports = *portsStorage;
|
||||||
emit q->errorMessage(Tr::tr("Error gathering ports: %1").arg(gatherer.errorString()) + '\n'
|
if (!ports) {
|
||||||
|
emit q->errorMessage(Tr::tr("Error gathering ports: %1").arg(ports.error()) + '\n'
|
||||||
+ Tr::tr("Some tools will not work out of the box.\n"));
|
+ Tr::tr("Some tools will not work out of the box.\n"));
|
||||||
} else if (gatherer.usedPorts().isEmpty()) {
|
} else if (ports->isEmpty()) {
|
||||||
emit q->progressMessage(Tr::tr("All specified ports are available.") + '\n');
|
emit q->progressMessage(Tr::tr("All specified ports are available.") + '\n');
|
||||||
} else {
|
} else {
|
||||||
const QString portList = transform(gatherer.usedPorts(), [](const Port &port) {
|
const QString portList = transform(*ports, [](const Port &port) {
|
||||||
return QString::number(port.number());
|
return QString::number(port.number());
|
||||||
}).join(", ");
|
}).join(", ");
|
||||||
emit q->errorMessage(Tr::tr("The following specified ports are currently in use: %1")
|
emit q->errorMessage(Tr::tr("The following specified ports are currently in use: %1")
|
||||||
.arg(portList) + '\n');
|
.arg(portList) + '\n');
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
return Group {
|
return Group {
|
||||||
finishAllAndSuccess,
|
portsStorage,
|
||||||
DeviceUsedPortsGathererTask(onSetup, onDone)
|
onGroupSetup(onSetup),
|
||||||
|
m_device->portsGatheringRecipe(portsStorage),
|
||||||
|
onGroupDone(onDone)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user