forked from qt-creator/qt-creator
GenericLinuxDeviceTester: Reuse LoopList
Instead of LoopRepeat + container capture. Change-Id: Ie021c618808dad3ac3e0ba5993009074aa9a8313 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -243,18 +243,17 @@ GroupItem GenericLinuxDeviceTesterPrivate::transferTasks() const
|
|||||||
|
|
||||||
GroupItem GenericLinuxDeviceTesterPrivate::commandTasks() const
|
GroupItem GenericLinuxDeviceTesterPrivate::commandTasks() const
|
||||||
{
|
{
|
||||||
const QStringList commands = commandsToTest();
|
const LoopList iterator(commandsToTest());
|
||||||
const LoopRepeat repeater(commands.size());
|
|
||||||
|
|
||||||
const auto onSetup = [this, commands, repeater](Process &process) {
|
const auto onSetup = [this, iterator](Process &process) {
|
||||||
const QString commandName = commands.at(repeater.iteration());
|
const QString &commandName = *iterator;
|
||||||
emit q->progressMessage(Tr::tr("%1...").arg(commandName));
|
emit q->progressMessage(Tr::tr("%1...").arg(commandName));
|
||||||
CommandLine command{m_device->filePath("/bin/sh"), {"-c"}};
|
CommandLine command{m_device->filePath("/bin/sh"), {"-c"}};
|
||||||
command.addArgs(QLatin1String("\"command -v %1\"").arg(commandName), CommandLine::Raw);
|
command.addArgs(QLatin1String("\"command -v %1\"").arg(commandName), CommandLine::Raw);
|
||||||
process.setCommand(command);
|
process.setCommand(command);
|
||||||
};
|
};
|
||||||
const auto onDone = [this, commands, repeater](const Process &process, DoneWith result) {
|
const auto onDone = [this, iterator](const Process &process, DoneWith result) {
|
||||||
const QString commandName = commands.at(repeater.iteration());
|
const QString &commandName = *iterator;
|
||||||
if (result == DoneWith::Success) {
|
if (result == DoneWith::Success) {
|
||||||
emit q->progressMessage(Tr::tr("%1 found.").arg(commandName));
|
emit q->progressMessage(Tr::tr("%1 found.").arg(commandName));
|
||||||
return;
|
return;
|
||||||
@@ -271,7 +270,7 @@ GroupItem GenericLinuxDeviceTesterPrivate::commandTasks() const
|
|||||||
onGroupSetup([this] {
|
onGroupSetup([this] {
|
||||||
emit q->progressMessage(Tr::tr("Checking if required commands are available..."));
|
emit q->progressMessage(Tr::tr("Checking if required commands are available..."));
|
||||||
}),
|
}),
|
||||||
repeater,
|
iterator,
|
||||||
ProcessTask(onSetup, onDone)
|
ProcessTask(onSetup, onDone)
|
||||||
};
|
};
|
||||||
return root;
|
return root;
|
||||||
|
Reference in New Issue
Block a user