forked from qt-creator/qt-creator
RemoteLinux: Convert to Tr::tr
Change-Id: I1c541d392992fb37acecbb98f331e01d7b73fbc7 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -26,9 +26,11 @@
|
||||
#include "linuxdevicetester.h"
|
||||
|
||||
#include "remotelinux_constants.h"
|
||||
#include "remotelinuxtr.h"
|
||||
|
||||
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
||||
#include <projectexplorer/devicesupport/filetransfer.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/port.h>
|
||||
#include <utils/processinterface.h>
|
||||
@@ -164,7 +166,7 @@ static const char s_echoContents[] = "Hello Remote World!";
|
||||
void GenericLinuxDeviceTester::testEcho()
|
||||
{
|
||||
d->state = TestingEcho;
|
||||
emit progressMessage(tr("Sending echo to device..."));
|
||||
emit progressMessage(Tr::tr("Sending echo to device..."));
|
||||
|
||||
d->echoProcess.setCommand({d->device->filePath("echo"), {s_echoContents}});
|
||||
d->echoProcess.start();
|
||||
@@ -176,18 +178,18 @@ void GenericLinuxDeviceTester::handleEchoDone()
|
||||
if (d->echoProcess.result() != ProcessResult::FinishedWithSuccess) {
|
||||
const QByteArray stdErrOutput = d->echoProcess.readAllStandardError();
|
||||
if (!stdErrOutput.isEmpty())
|
||||
emit errorMessage(tr("echo failed: %1").arg(QString::fromUtf8(stdErrOutput)) + '\n');
|
||||
emit errorMessage(Tr::tr("echo failed: %1").arg(QString::fromUtf8(stdErrOutput)) + '\n');
|
||||
else
|
||||
emit errorMessage(tr("echo failed.") + '\n');
|
||||
emit errorMessage(Tr::tr("echo failed.") + '\n');
|
||||
setFinished(TestFailure);
|
||||
return;
|
||||
}
|
||||
|
||||
const QString reply = d->echoProcess.cleanedStdOut().chopped(1); // Remove trailing \n
|
||||
if (reply != s_echoContents)
|
||||
emit errorMessage(tr("Device replied to echo with unexpected contents.") + '\n');
|
||||
emit errorMessage(Tr::tr("Device replied to echo with unexpected contents.") + '\n');
|
||||
else
|
||||
emit progressMessage(tr("Device replied to echo with expected contents.") + '\n');
|
||||
emit progressMessage(Tr::tr("Device replied to echo with expected contents.") + '\n');
|
||||
|
||||
testUname();
|
||||
}
|
||||
@@ -195,7 +197,7 @@ void GenericLinuxDeviceTester::handleEchoDone()
|
||||
void GenericLinuxDeviceTester::testUname()
|
||||
{
|
||||
d->state = TestingUname;
|
||||
emit progressMessage(tr("Checking kernel version..."));
|
||||
emit progressMessage(Tr::tr("Checking kernel version..."));
|
||||
|
||||
d->unameProcess.setCommand({d->device->filePath("uname"), {"-rsm"}});
|
||||
d->unameProcess.start();
|
||||
@@ -208,9 +210,9 @@ void GenericLinuxDeviceTester::handleUnameDone()
|
||||
if (!d->unameProcess.errorString().isEmpty() || d->unameProcess.exitCode() != 0) {
|
||||
const QByteArray stderrOutput = d->unameProcess.readAllStandardError();
|
||||
if (!stderrOutput.isEmpty())
|
||||
emit errorMessage(tr("uname failed: %1").arg(QString::fromUtf8(stderrOutput)) + QLatin1Char('\n'));
|
||||
emit errorMessage(Tr::tr("uname failed: %1").arg(QString::fromUtf8(stderrOutput)) + QLatin1Char('\n'));
|
||||
else
|
||||
emit errorMessage(tr("uname failed.") + QLatin1Char('\n'));
|
||||
emit errorMessage(Tr::tr("uname failed.") + QLatin1Char('\n'));
|
||||
} else {
|
||||
emit progressMessage(QString::fromUtf8(d->unameProcess.readAllStandardOutput()));
|
||||
}
|
||||
@@ -221,7 +223,7 @@ void GenericLinuxDeviceTester::handleUnameDone()
|
||||
void GenericLinuxDeviceTester::testPortsGatherer()
|
||||
{
|
||||
d->state = TestingPorts;
|
||||
emit progressMessage(tr("Checking if specified ports are available..."));
|
||||
emit progressMessage(Tr::tr("Checking if specified ports are available..."));
|
||||
|
||||
d->portsGatherer.start(d->device);
|
||||
}
|
||||
@@ -230,7 +232,7 @@ void GenericLinuxDeviceTester::handlePortsGathererError(const QString &message)
|
||||
{
|
||||
QTC_ASSERT(d->state == TestingPorts, return);
|
||||
|
||||
emit errorMessage(tr("Error gathering ports: %1").arg(message) + QLatin1Char('\n'));
|
||||
emit errorMessage(Tr::tr("Error gathering ports: %1").arg(message) + QLatin1Char('\n'));
|
||||
setFinished(TestFailure);
|
||||
}
|
||||
|
||||
@@ -239,12 +241,12 @@ void GenericLinuxDeviceTester::handlePortsGathererDone()
|
||||
QTC_ASSERT(d->state == TestingPorts, return);
|
||||
|
||||
if (d->portsGatherer.usedPorts().isEmpty()) {
|
||||
emit progressMessage(tr("All specified ports are available.") + QLatin1Char('\n'));
|
||||
emit progressMessage(Tr::tr("All specified ports are available.") + QLatin1Char('\n'));
|
||||
} else {
|
||||
const QString portList = transform(d->portsGatherer.usedPorts(), [](const Port &port) {
|
||||
return QString::number(port.number());
|
||||
}).join(", ");
|
||||
emit errorMessage(tr("The following specified ports are currently in use: %1")
|
||||
emit errorMessage(Tr::tr("The following specified ports are currently in use: %1")
|
||||
.arg(portList) + QLatin1Char('\n'));
|
||||
}
|
||||
|
||||
@@ -257,7 +259,7 @@ void GenericLinuxDeviceTester::testFileTransfer(FileTransferMethod method)
|
||||
case FileTransferMethod::Sftp: d->state = TestingSftp; break;
|
||||
case FileTransferMethod::Rsync: d->state = TestingRsync; break;
|
||||
}
|
||||
emit progressMessage(tr("Checking whether \"%1\" works...")
|
||||
emit progressMessage(Tr::tr("Checking whether \"%1\" works...")
|
||||
.arg(FileTransfer::transferMethodName(method)));
|
||||
|
||||
d->fileTransfer.setTransferMethod(method);
|
||||
@@ -272,18 +274,18 @@ void GenericLinuxDeviceTester::handleFileTransferDone(const ProcessResultData &r
|
||||
QString error;
|
||||
const QString methodName = FileTransfer::transferMethodName(d->fileTransfer.transferMethod());
|
||||
if (resultData.m_error == QProcess::FailedToStart) {
|
||||
error = tr("Failed to start \"%1\": %2\n").arg(methodName, resultData.m_errorString);
|
||||
error = Tr::tr("Failed to start \"%1\": %2\n").arg(methodName, resultData.m_errorString);
|
||||
} else if (resultData.m_exitStatus == QProcess::CrashExit) {
|
||||
error = tr("\"%1\" crashed.\n").arg(methodName);
|
||||
error = Tr::tr("\"%1\" crashed.\n").arg(methodName);
|
||||
} else if (resultData.m_exitCode != 0) {
|
||||
error = tr("\"%1\" failed with exit code %2: %3\n")
|
||||
error = Tr::tr("\"%1\" failed with exit code %2: %3\n")
|
||||
.arg(methodName).arg(resultData.m_exitCode).arg(resultData.m_errorString);
|
||||
} else {
|
||||
succeeded = true;
|
||||
}
|
||||
|
||||
if (succeeded)
|
||||
emit progressMessage(tr("\"%1\" is functional.\n").arg(methodName));
|
||||
emit progressMessage(Tr::tr("\"%1\" is functional.\n").arg(methodName));
|
||||
else
|
||||
emit errorMessage(error);
|
||||
|
||||
@@ -293,10 +295,10 @@ void GenericLinuxDeviceTester::handleFileTransferDone(const ProcessResultData &r
|
||||
} else {
|
||||
if (!succeeded) {
|
||||
if (d->sftpWorks) {
|
||||
emit progressMessage(tr("SFTP will be used for deployment, because rsync "
|
||||
emit progressMessage(Tr::tr("SFTP will be used for deployment, because rsync "
|
||||
"is not available.\n"));
|
||||
} else {
|
||||
emit errorMessage(tr("Deployment to this device will not work out of the box.\n"));
|
||||
emit errorMessage(Tr::tr("Deployment to this device will not work out of the box.\n"));
|
||||
}
|
||||
}
|
||||
d->device->setExtraData(Constants::SupportsRSync, succeeded);
|
||||
@@ -310,7 +312,7 @@ void GenericLinuxDeviceTester::handleFileTransferDone(const ProcessResultData &r
|
||||
void GenericLinuxDeviceTester::testCommands()
|
||||
{
|
||||
d->state = TestingCommands;
|
||||
emit progressMessage(tr("Checking if required commands are available..."));
|
||||
emit progressMessage(Tr::tr("Checking if required commands are available..."));
|
||||
|
||||
d->currentCommandIndex = 0;
|
||||
d->commandFailed = false;
|
||||
@@ -326,7 +328,7 @@ void GenericLinuxDeviceTester::testNextCommand()
|
||||
}
|
||||
|
||||
const QString commandName = s_commandsToTest[d->currentCommandIndex];
|
||||
emit progressMessage(tr("%1...").arg(commandName));
|
||||
emit progressMessage(Tr::tr("%1...").arg(commandName));
|
||||
CommandLine command{d->device->filePath("/bin/sh"), {"-c"}};
|
||||
command.addArgs(QLatin1String("\"command -v %1\"").arg(commandName), CommandLine::Raw);
|
||||
d->commandsProcess.setCommand(command);
|
||||
@@ -339,13 +341,13 @@ void GenericLinuxDeviceTester::handleCommandDone()
|
||||
|
||||
const QString command = s_commandsToTest[d->currentCommandIndex];
|
||||
if (d->commandsProcess.result() == ProcessResult::FinishedWithSuccess) {
|
||||
emit progressMessage(tr("%1 found.").arg(command));
|
||||
emit progressMessage(Tr::tr("%1 found.").arg(command));
|
||||
} else {
|
||||
d->commandFailed = true;
|
||||
const QString message = d->commandsProcess.result() == ProcessResult::StartFailed
|
||||
? tr("An error occurred while checking for %1.").arg(command)
|
||||
? Tr::tr("An error occurred while checking for %1.").arg(command)
|
||||
+ '\n' + d->commandsProcess.errorString()
|
||||
: tr("%1 not found.").arg(command);
|
||||
: Tr::tr("%1 not found.").arg(command);
|
||||
emit errorMessage(message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user