diff options
Diffstat (limited to 'src/plugins')
32 files changed, 274 insertions, 278 deletions
diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp index aee4d2eec5..de3dd9c1df 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp @@ -26,6 +26,7 @@ #include "abstractremotelinuxdeployservice.h" #include "deploymenttimeinfo.h" +#include "remotelinuxtr.h" #include <projectexplorer/deployablefile.h> #include <projectexplorer/devicesupport/idevice.h> @@ -127,7 +128,7 @@ void AbstractRemoteLinuxDeployService::start() } if (!isDeploymentNecessary()) { - emit progressMessage(tr("No deployment action necessary. Skipping.")); + emit progressMessage(Tr::tr("No deployment action necessary. Skipping.")); emit finished(); return; } @@ -150,7 +151,7 @@ void AbstractRemoteLinuxDeployService::stop() CheckResult AbstractRemoteLinuxDeployService::isDeploymentPossible() const { if (!deviceConfiguration()) - return CheckResult::failure(tr("No device configuration set.")); + return CheckResult::failure(Tr::tr("No device configuration set.")); return CheckResult::success(); } diff --git a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp index b23f724433..facd43aad2 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp @@ -26,6 +26,7 @@ #include "abstractremotelinuxdeploystep.h" #include "abstractremotelinuxdeployservice.h" +#include "remotelinuxtr.h" #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/kitinformation.h> @@ -98,7 +99,7 @@ bool AbstractRemoteLinuxDeployStep::init() QTC_ASSERT(d->internalInit, return false); const CheckResult canDeploy = d->internalInit(); if (!canDeploy) { - emit addOutput(tr("Cannot deploy: %1").arg(canDeploy.errorMessage()), + emit addOutput(Tr::tr("Cannot deploy: %1").arg(canDeploy.errorMessage()), OutputFormat::ErrorMessage); } return canDeploy; @@ -131,7 +132,7 @@ void AbstractRemoteLinuxDeployStep::doCancel() if (d->hasError) return; - emit addOutput(tr("User requests deployment to stop; cleaning up."), + emit addOutput(Tr::tr("User requests deployment to stop; cleaning up."), OutputFormat::NormalMessage); d->hasError = true; d->deployService->stop(); @@ -158,9 +159,9 @@ void AbstractRemoteLinuxDeployStep::handleWarningMessage(const QString &message) void AbstractRemoteLinuxDeployStep::handleFinished() { if (d->hasError) - emit addOutput(tr("Deploy step failed."), OutputFormat::ErrorMessage); + emit addOutput(Tr::tr("Deploy step failed."), OutputFormat::ErrorMessage); else - emit addOutput(tr("Deploy step finished."), OutputFormat::NormalMessage); + emit addOutput(Tr::tr("Deploy step finished."), OutputFormat::NormalMessage); disconnect(d->deployService, nullptr, this, nullptr); emit finished(!d->hasError); } diff --git a/src/plugins/remotelinux/customcommanddeploystep.cpp b/src/plugins/remotelinux/customcommanddeploystep.cpp index 1e11a1b779..38a8ab9481 100644 --- a/src/plugins/remotelinux/customcommanddeploystep.cpp +++ b/src/plugins/remotelinux/customcommanddeploystep.cpp @@ -28,6 +28,7 @@ #include "abstractremotelinuxdeployservice.h" #include "abstractremotelinuxdeploystep.h" #include "remotelinux_constants.h" +#include "remotelinuxtr.h" #include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/projectexplorerconstants.h> @@ -38,13 +39,10 @@ using namespace ProjectExplorer; using namespace Utils; -namespace RemoteLinux { -namespace Internal { +namespace RemoteLinux::Internal { class CustomCommandDeployService : public AbstractRemoteLinuxDeployService { - Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::CustomCommandDeployService) - public: CustomCommandDeployService(); @@ -72,12 +70,12 @@ CustomCommandDeployService::CustomCommandDeployService() connect(&m_process, &QtcProcess::done, this, [this] { if (m_process.error() != QProcess::UnknownError || m_process.exitStatus() != QProcess::NormalExit) { - emit errorMessage(tr("Remote process failed: %1").arg(m_process.errorString())); + emit errorMessage(Tr::tr("Remote process failed: %1").arg(m_process.errorString())); } else if (m_process.exitCode() != 0) { - emit errorMessage(tr("Remote process finished with exit code %1.") + emit errorMessage(Tr::tr("Remote process finished with exit code %1.") .arg(m_process.exitCode())); } else { - emit progressMessage(tr("Remote command finished successfully.")); + emit progressMessage(Tr::tr("Remote command finished successfully.")); } stopDeployment(); }); @@ -91,14 +89,14 @@ void CustomCommandDeployService::setCommandLine(const QString &commandLine) CheckResult CustomCommandDeployService::isDeploymentPossible() const { if (m_commandLine.isEmpty()) - return CheckResult::failure(tr("No command line given.")); + return CheckResult::failure(Tr::tr("No command line given.")); return AbstractRemoteLinuxDeployService::isDeploymentPossible(); } void CustomCommandDeployService::doDeploy() { - emit progressMessage(tr("Starting remote command \"%1\"...").arg(m_commandLine)); + emit progressMessage(Tr::tr("Starting remote command \"%1\"...").arg(m_commandLine)); m_process.setCommand({deviceConfiguration()->filePath("/bin/sh"), {"-c", m_commandLine}}); m_process.start(); @@ -112,8 +110,6 @@ void CustomCommandDeployService::stopDeployment() class CustomCommandDeployStep : public AbstractRemoteLinuxDeployStep { - Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::CustomCommandDeployStep) - public: CustomCommandDeployStep(BuildStepList *bsl, Id id) : AbstractRemoteLinuxDeployStep(bsl, id) @@ -122,7 +118,7 @@ public: auto commandLine = addAspect<StringAspect>(); commandLine->setSettingsKey("RemoteLinuxCustomCommandDeploymentStep.CommandLine"); - commandLine->setLabelText(tr("Command line:")); + commandLine->setLabelText(Tr::tr("Command line:")); commandLine->setDisplayStyle(StringAspect::LineEditDisplay); commandLine->setHistoryCompleter("RemoteLinuxCustomCommandDeploymentStep.History"); @@ -141,10 +137,9 @@ public: CustomCommandDeployStepFactory::CustomCommandDeployStepFactory() { registerStep<CustomCommandDeployStep>(Constants::CustomCommandDeployStepId); - setDisplayName(CustomCommandDeployStep::tr("Run custom remote command")); + setDisplayName(Tr::tr("Run custom remote command")); setSupportedConfiguration(RemoteLinux::Constants::DeployToGenericLinux); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); } -} // Internal -} // RemoteLinux +} // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/customcommanddeploystep.h b/src/plugins/remotelinux/customcommanddeploystep.h index 09b6aaceaf..de80ce7b40 100644 --- a/src/plugins/remotelinux/customcommanddeploystep.h +++ b/src/plugins/remotelinux/customcommanddeploystep.h @@ -27,8 +27,7 @@ #include <projectexplorer/buildstep.h> -namespace RemoteLinux { -namespace Internal { +namespace RemoteLinux::Internal { class CustomCommandDeployStepFactory : public ProjectExplorer::BuildStepFactory { @@ -36,5 +35,4 @@ public: CustomCommandDeployStepFactory(); }; -} // Internal -} // RemoteLinux +} // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/genericdirectuploadservice.cpp b/src/plugins/remotelinux/genericdirectuploadservice.cpp index 6842eb4331..b9ef6840fb 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.cpp +++ b/src/plugins/remotelinux/genericdirectuploadservice.cpp @@ -25,9 +25,12 @@ #include "genericdirectuploadservice.h" +#include "remotelinuxtr.h" + #include <projectexplorer/deployablefile.h> #include <projectexplorer/devicesupport/filetransfer.h> #include <projectexplorer/devicesupport/idevice.h> + #include <utils/hostosinfo.h> #include <utils/processinterface.h> #include <utils/qtcassert.h> @@ -141,23 +144,23 @@ QDateTime GenericDirectUploadService::timestampFromStat(const DeployableFile &fi bool succeeded = false; QString error; if (statProc->error() == QProcess::FailedToStart) { - error = tr("Failed to start \"stat\": %1").arg(statProc->errorString()); + error = Tr::tr("Failed to start \"stat\": %1").arg(statProc->errorString()); } else if (statProc->exitStatus() == QProcess::CrashExit) { - error = tr("\"stat\" crashed."); + error = Tr::tr("\"stat\" crashed."); } else if (statProc->exitCode() != 0) { - error = tr("\"stat\" failed with exit code %1: %2") + error = Tr::tr("\"stat\" failed with exit code %1: %2") .arg(statProc->exitCode()).arg(statProc->cleanedStdErr()); } else { succeeded = true; } if (!succeeded) { - emit warningMessage(tr("Failed to retrieve remote timestamp for file \"%1\". " + emit warningMessage(Tr::tr("Failed to retrieve remote timestamp for file \"%1\". " "Incremental deployment will not work. Error message was: %2") .arg(file.remoteFilePath(), error)); return QDateTime(); } const QByteArray output = statProc->readAllStandardOutput().trimmed(); - const QString warningString(tr("Unexpected stat output for remote file \"%1\": %2") + const QString warningString(Tr::tr("Unexpected stat output for remote file \"%1\": %2") .arg(file.remoteFilePath()).arg(QString::fromUtf8(output))); if (!output.startsWith(file.remoteFilePath().toUtf8())) { emit warningMessage(warningString); @@ -188,7 +191,7 @@ void GenericDirectUploadService::checkForStateChangeOnRemoteProcFinished() return; } QTC_ASSERT(d->state == PostProcessing, return); - emit progressMessage(tr("All files successfully deployed.")); + emit progressMessage(Tr::tr("All files successfully deployed.")); setFinished(); handleDeploymentDone(); } @@ -290,16 +293,16 @@ void GenericDirectUploadService::uploadFiles() QTC_ASSERT(d->state == PreChecking, return); d->state = Uploading; if (d->filesToUpload.empty()) { - emit progressMessage(tr("No files need to be uploaded.")); + emit progressMessage(Tr::tr("No files need to be uploaded.")); setFinished(); handleDeploymentDone(); return; } - emit progressMessage(tr("%n file(s) need to be uploaded.", "", d->filesToUpload.size())); + emit progressMessage(Tr::tr("%n file(s) need to be uploaded.", "", d->filesToUpload.size())); FilesToTransfer files; for (const DeployableFile &file : qAsConst(d->filesToUpload)) { if (!file.localFilePath().exists()) { - const QString message = tr("Local file \"%1\" does not exist.") + const QString message = Tr::tr("Local file \"%1\" does not exist.") .arg(file.localFilePath().toUserOutput()); if (d->ignoreMissingFiles) { emit warningMessage(message); @@ -336,10 +339,10 @@ void GenericDirectUploadService::chmod() QTC_ASSERT(file.isValid(), return); const QString error = chmodProc->errorString(); if (!error.isEmpty()) { - emit warningMessage(tr("Remote chmod failed for file \"%1\": %2") + emit warningMessage(Tr::tr("Remote chmod failed for file \"%1\": %2") .arg(file.remoteFilePath(), error)); } else if (chmodProc->exitCode() != 0) { - emit warningMessage(tr("Remote chmod failed for file \"%1\": %2") + emit warningMessage(Tr::tr("Remote chmod failed for file \"%1\": %2") .arg(file.remoteFilePath(), QString::fromUtf8(chmodProc->readAllStandardError()))); } diff --git a/src/plugins/remotelinux/genericdirectuploadstep.cpp b/src/plugins/remotelinux/genericdirectuploadstep.cpp index 70e9a4591a..0768b6a32a 100644 --- a/src/plugins/remotelinux/genericdirectuploadstep.cpp +++ b/src/plugins/remotelinux/genericdirectuploadstep.cpp @@ -27,6 +27,7 @@ #include "genericdirectuploadservice.h" #include "remotelinux_constants.h" +#include "remotelinuxtr.h" #include <projectexplorer/deploymentdata.h> #include <projectexplorer/target.h> @@ -47,7 +48,7 @@ GenericDirectUploadStep::GenericDirectUploadStep(BuildStepList *bsl, Utils::Id i if (offerIncrementalDeployment) { incremental = addAspect<BoolAspect>(); incremental->setSettingsKey("RemoteLinux.GenericDirectUploadStep.Incremental"); - incremental->setLabel(tr("Incremental deployment"), + incremental->setLabel(Tr::tr("Incremental deployment"), BoolAspect::LabelPlacement::AtCheckBox); incremental->setValue(true); incremental->setDefaultValue(true); @@ -55,7 +56,7 @@ GenericDirectUploadStep::GenericDirectUploadStep(BuildStepList *bsl, Utils::Id i auto ignoreMissingFiles = addAspect<BoolAspect>(); ignoreMissingFiles->setSettingsKey("RemoteLinux.GenericDirectUploadStep.IgnoreMissingFiles"); - ignoreMissingFiles->setLabel(tr("Ignore missing files"), + ignoreMissingFiles->setLabel(Tr::tr("Ignore missing files"), BoolAspect::LabelPlacement::AtCheckBox); ignoreMissingFiles->setValue(false); @@ -84,7 +85,7 @@ Utils::Id GenericDirectUploadStep::stepId() QString GenericDirectUploadStep::displayName() { - return tr("Upload files via SFTP"); + return Tr::tr("Upload files via SFTP"); } } //namespace RemoteLinux diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp index ee4a7bd6ec..e32909693f 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp @@ -25,6 +25,7 @@ #include "genericlinuxdeviceconfigurationwidget.h" +#include "remotelinuxtr.h" #include "sshkeycreationdialog.h" #include <projectexplorer/devicesupport/idevice.h> @@ -55,22 +56,22 @@ GenericLinuxDeviceConfigurationWidget::GenericLinuxDeviceConfigurationWidget( { resize(556, 309); - m_defaultAuthButton = new QRadioButton(tr("Default"), this); + m_defaultAuthButton = new QRadioButton(Tr::tr("Default"), this); - m_keyButton = new QRadioButton(tr("Specific &key")); + m_keyButton = new QRadioButton(Tr::tr("Specific &key")); m_hostLineEdit = new QLineEdit(this); - m_hostLineEdit->setPlaceholderText(tr("IP or host name of the device")); + m_hostLineEdit->setPlaceholderText(Tr::tr("IP or host name of the device")); m_sshPortSpinBox = new QSpinBox(this); m_sshPortSpinBox->setMinimum(0); m_sshPortSpinBox->setMaximum(65535); m_sshPortSpinBox->setValue(22); - m_hostKeyCheckBox = new QCheckBox(tr("&Check host key")); + m_hostKeyCheckBox = new QCheckBox(Tr::tr("&Check host key")); m_portsLineEdit = new QLineEdit(this); - m_portsLineEdit->setToolTip(tr("You can enter lists and ranges like this: '1024,1026-1028,1030'.")); + m_portsLineEdit->setToolTip(Tr::tr("You can enter lists and ranges like this: '1024,1026-1028,1030'.")); m_portsWarningLabel = new QLabel(this); @@ -78,22 +79,22 @@ GenericLinuxDeviceConfigurationWidget::GenericLinuxDeviceConfigurationWidget( m_timeoutSpinBox->setMaximum(10000); m_timeoutSpinBox->setSingleStep(10); m_timeoutSpinBox->setValue(1000); - m_timeoutSpinBox->setSuffix(tr("s")); + m_timeoutSpinBox->setSuffix(Tr::tr("s")); m_userLineEdit = new QLineEdit(this); - m_keyLabel = new QLabel(tr("Private key file:")); + m_keyLabel = new QLabel(Tr::tr("Private key file:")); m_keyFileLineEdit = new Utils::PathChooser(this); - auto createKeyButton = new QPushButton(tr("Create New...")); + auto createKeyButton = new QPushButton(Tr::tr("Create New...")); m_machineTypeValueLabel = new QLabel(this); m_gdbServerLineEdit = new QLineEdit(this); - m_gdbServerLineEdit->setPlaceholderText(tr("Leave empty to look up executable in $PATH")); + m_gdbServerLineEdit->setPlaceholderText(Tr::tr("Leave empty to look up executable in $PATH")); - auto sshPortLabel = new QLabel(tr("&SSH port:")); + auto sshPortLabel = new QLabel(Tr::tr("&SSH port:")); sshPortLabel->setBuddy(m_sshPortSpinBox); using namespace Layouting; @@ -101,13 +102,13 @@ GenericLinuxDeviceConfigurationWidget::GenericLinuxDeviceConfigurationWidget( const Stretch st; Form { - tr("Machine type:"), m_machineTypeValueLabel, st, nl, - tr("Authentication type:"), m_defaultAuthButton, m_keyButton, st, nl, - tr("&Host name:"), m_hostLineEdit, sshPortLabel, m_sshPortSpinBox, m_hostKeyCheckBox, st, nl, - tr("Free ports:"), m_portsLineEdit, m_portsWarningLabel, tr("Timeout:"), m_timeoutSpinBox, st, nl, - tr("&Username:"), m_userLineEdit, st, nl, + Tr::tr("Machine type:"), m_machineTypeValueLabel, st, nl, + Tr::tr("Authentication type:"), m_defaultAuthButton, m_keyButton, st, nl, + Tr::tr("&Host name:"), m_hostLineEdit, sshPortLabel, m_sshPortSpinBox, m_hostKeyCheckBox, st, nl, + Tr::tr("Free ports:"), m_portsLineEdit, m_portsWarningLabel, Tr::tr("Timeout:"), m_timeoutSpinBox, st, nl, + Tr::tr("&Username:"), m_userLineEdit, st, nl, m_keyLabel, m_keyFileLineEdit, createKeyButton, st, nl, - tr("GDB server executable:"), m_gdbServerLineEdit, st, nl + Tr::tr("GDB server executable:"), m_gdbServerLineEdit, st, nl }.attachTo(this); connect(m_hostLineEdit, &QLineEdit::editingFinished, @@ -241,12 +242,12 @@ void GenericLinuxDeviceConfigurationWidget::updatePortsWarningLabel() void GenericLinuxDeviceConfigurationWidget::initGui() { if (device()->machineType() == IDevice::Hardware) - m_machineTypeValueLabel->setText(tr("Physical Device")); + m_machineTypeValueLabel->setText(Tr::tr("Physical Device")); else - m_machineTypeValueLabel->setText(tr("Emulator")); + m_machineTypeValueLabel->setText(Tr::tr("Emulator")); m_portsWarningLabel->setPixmap(Utils::Icons::CRITICAL.pixmap()); m_portsWarningLabel->setToolTip(QLatin1String("<font color=\"red\">") - + tr("You will need at least one port.") + QLatin1String("</font>")); + + Tr::tr("You will need at least one port.") + QLatin1String("</font>")); m_keyFileLineEdit->setExpectedKind(PathChooser::File); m_keyFileLineEdit->setHistoryCompleter(QLatin1String("Ssh.KeyFile.History")); m_keyFileLineEdit->lineEdit()->setMinimumWidth(0); diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizard.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizard.cpp index f17d786b91..6d087c024f 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizard.cpp +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizard.cpp @@ -28,9 +28,11 @@ #include "genericlinuxdeviceconfigurationwizardpages.h" #include "linuxdevice.h" #include "remotelinux_constants.h" +#include "remotelinuxtr.h" #include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/sshparameters.h> + #include <utils/portlist.h> #include <utils/fileutils.h> @@ -59,7 +61,7 @@ GenericLinuxDeviceConfigurationWizard::GenericLinuxDeviceConfigurationWizard(QWi : Utils::Wizard(parent), d(new Internal::GenericLinuxDeviceConfigurationWizardPrivate(this)) { - setWindowTitle(tr("New Remote Linux Device Configuration Setup")); + setWindowTitle(Tr::tr("New Remote Linux Device Configuration Setup")); setPage(Internal::SetupPageId, &d->setupPage); setPage(Internal::KeyDeploymentPageId, &d->keyDeploymentPage); setPage(Internal::FinalPageId, &d->finalPage); diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp index 7b990098dd..565c7c10fa 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp @@ -26,6 +26,7 @@ #include "genericlinuxdeviceconfigurationwizardpages.h" #include "publickeydeploymentdialog.h" +#include "remotelinuxtr.h" #include "sshkeycreationdialog.h" #include <projectexplorer/devicesupport/sshparameters.h> @@ -68,8 +69,8 @@ GenericLinuxDeviceConfigurationWizardSetupPage::GenericLinuxDeviceConfigurationW QWidget *parent) : QWizardPage(parent), d(new Internal::GenericLinuxDeviceConfigurationWizardSetupPagePrivate) { - setTitle(tr("Connection")); - setWindowTitle(tr("WizardPage")); + setTitle(Tr::tr("Connection")); + setWindowTitle(Tr::tr("WizardPage")); d->nameLineEdit = new QLineEdit(this); d->hostNameLineEdit = new QLineEdit(this); @@ -80,9 +81,9 @@ GenericLinuxDeviceConfigurationWizardSetupPage::GenericLinuxDeviceConfigurationW const Stretch st; Form { - tr("The name to identify this configuration:"), d->nameLineEdit, nl, - tr("The device's host name or IP address:"), d->hostNameLineEdit, st, nl, - tr("The username to log into the device:"), d->userNameLineEdit, st, nl + Tr::tr("The name to identify this configuration:"), d->nameLineEdit, nl, + Tr::tr("The device's host name or IP address:"), d->hostNameLineEdit, st, nl, + Tr::tr("The username to log into the device:"), d->userNameLineEdit, st, nl }.attachTo(this); setSubTitle(QLatin1String(" ")); // For Qt bug (background color) @@ -142,7 +143,7 @@ GenericLinuxDeviceConfigurationWizardFinalPage::GenericLinuxDeviceConfigurationW QWidget *parent) : QWizardPage(parent), d(new Internal::GenericLinuxDeviceConfigurationWizardFinalPagePrivate) { - setTitle(tr("Summary")); + setTitle(Tr::tr("Summary")); setSubTitle(QLatin1String(" ")); // For Qt bug (background color) d->infoLabel.setWordWrap(true); auto const layout = new QVBoxLayout(this); @@ -161,8 +162,8 @@ void GenericLinuxDeviceConfigurationWizardFinalPage::initializePage() QString GenericLinuxDeviceConfigurationWizardFinalPage::infoText() const { - return tr("The new device configuration will now be created.\n" - "In addition, device connectivity will be tested."); + return Tr::tr("The new device configuration will now be created.\n" + "In addition, device connectivity will be tested."); } struct GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::Private @@ -181,30 +182,30 @@ struct GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::Private GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::GenericLinuxDeviceConfigurationWizardKeyDeploymentPage(QWidget *parent) : QWizardPage(parent), d(new Private) { - setTitle(tr("Key Deployment")); + setTitle(Tr::tr("Key Deployment")); setSubTitle(" "); - const QString info = tr("We recommend that you log into your device using public key " - "authentication.\n" - "If your device is already set up for this, you do not have to do " - "anything here.\n" - "Otherwise, please deploy the public key for the private key " - "with which to connect in the future.\n" - "If you do not have a private key yet, you can also " - "create one here."); + const QString info = Tr::tr("We recommend that you log into your device using public key " + "authentication.\n" + "If your device is already set up for this, you do not have to do " + "anything here.\n" + "Otherwise, please deploy the public key for the private key " + "with which to connect in the future.\n" + "If you do not have a private key yet, you can also " + "create one here."); d->keyFileChooser.setExpectedKind(PathChooser::File); d->keyFileChooser.setHistoryCompleter("Ssh.KeyFile.History"); - d->keyFileChooser.setPromptDialogTitle(tr("Choose a Private Key File")); - auto const deployButton = new QPushButton(tr("Deploy Public Key"), this); + d->keyFileChooser.setPromptDialogTitle(Tr::tr("Choose a Private Key File")); + auto const deployButton = new QPushButton(Tr::tr("Deploy Public Key"), this); connect(deployButton, &QPushButton::clicked, this, &GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::deployKey); - auto const createButton = new QPushButton(tr("Create New Key Pair"), this); + auto const createButton = new QPushButton(Tr::tr("Create New Key Pair"), this); connect(createButton, &QPushButton::clicked, this, &GenericLinuxDeviceConfigurationWizardKeyDeploymentPage::createKey); auto const mainLayout = new QVBoxLayout(this); auto const keyLayout = new QHBoxLayout; auto const deployLayout = new QHBoxLayout; mainLayout->addWidget(new QLabel(info)); - keyLayout->addWidget(new QLabel(tr("Private key file:"))); + keyLayout->addWidget(new QLabel(Tr::tr("Private key file:"))); keyLayout->addWidget(&d->keyFileChooser); keyLayout->addWidget(createButton); keyLayout->addStretch(); diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index fa83b6d7da..b085edd68f 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -31,8 +31,9 @@ #include "linuxprocessinterface.h" #include "publickeydeploymentdialog.h" #include "remotelinux_constants.h" -#include "remotelinuxsignaloperation.h" #include "remotelinuxenvironmentreader.h" +#include "remotelinuxsignaloperation.h" +#include "remotelinuxtr.h" #include "sshprocessinterface.h" #include <coreplugin/icore.h> @@ -169,15 +170,16 @@ void SshSharedConnection::connectToHost() const FilePath sshBinary = SshSettings::sshFilePath(); if (!sshBinary.exists()) { - emitError(QProcess::FailedToStart, tr("Cannot establish SSH connection: ssh binary " + emitError(QProcess::FailedToStart, Tr::tr("Cannot establish SSH connection: ssh binary " "\"%1\" does not exist.").arg(sshBinary.toUserOutput())); return; } m_masterSocketDir.reset(new QTemporaryDir); if (!m_masterSocketDir->isValid()) { - emitError(QProcess::FailedToStart, tr("Cannot establish SSH connection: Failed to create temporary " - "directory for control socket: %1") + emitError(QProcess::FailedToStart, + Tr::tr("Cannot establish SSH connection: Failed to create temporary " + "directory for control socket: %1") .arg(m_masterSocketDir->errorString())); m_masterSocketDir.reset(); return; @@ -199,8 +201,8 @@ void SshSharedConnection::connectToHost() const ProcessResult result = m_masterProcess->result(); const ProcessResultData resultData = m_masterProcess->resultData(); if (result == ProcessResult::StartFailed) { - emitError(QProcess::FailedToStart, tr("Cannot establish SSH connection.\n" - "Control process failed to start.")); + emitError(QProcess::FailedToStart, Tr::tr("Cannot establish SSH connection.\n" + "Control process failed to start.")); return; } else if (result == ProcessResult::FinishedWithError) { emitError(resultData.m_error, fullProcessError()); @@ -263,7 +265,7 @@ QString SshSharedConnection::fullProcessError() const ? m_masterProcess->errorString() : QString(); const QString standardError = m_masterProcess->cleanedStdErr(); const QString errorPrefix = errorString.isEmpty() && standardError.isEmpty() - ? tr("SSH connection failure.") : tr("SSH connection failure:"); + ? Tr::tr("SSH connection failure.") : Tr::tr("SSH connection failure:"); QStringList allErrors {errorPrefix, errorString, standardError}; allErrors.removeAll({}); return allErrors.join('\n'); @@ -920,11 +922,11 @@ private: LinuxDevice::LinuxDevice() : d(new LinuxDevicePrivate(this)) { - setDisplayType(tr("Remote Linux")); - setDefaultDisplayName(tr("Remote Linux Device")); + setDisplayType(Tr::tr("Remote Linux")); + setDefaultDisplayName(Tr::tr("Remote Linux Device")); setOsType(OsTypeLinux); - addDeviceAction({tr("Deploy Public Key..."), [](const IDevice::Ptr &device, QWidget *parent) { + addDeviceAction({Tr::tr("Deploy Public Key..."), [](const IDevice::Ptr &device, QWidget *parent) { if (auto d = PublicKeyDeploymentDialog::createDialog(device, parent)) { d->exec(); delete d; @@ -939,11 +941,11 @@ LinuxDevice::LinuxDevice() const QString errorString = proc->errorString(); QString message; if (proc->error() == QProcess::FailedToStart) - message = tr("Error starting remote shell."); + message = Tr::tr("Error starting remote shell."); else if (errorString.isEmpty()) - message = tr("Error running remote shell."); + message = Tr::tr("Error running remote shell."); else - message = tr("Error running remote shell: %1").arg(errorString); + message = Tr::tr("Error running remote shell: %1").arg(errorString); Core::MessageManager::writeDisrupting(message); } proc->deleteLater(); @@ -957,7 +959,7 @@ LinuxDevice::LinuxDevice() proc->start(); }); - addDeviceAction({tr("Open Remote Shell"), [](const IDevice::Ptr &device, QWidget *) { + addDeviceAction({Tr::tr("Open Remote Shell"), [](const IDevice::Ptr &device, QWidget *) { device->openTerminal(Environment(), FilePath()); }}); } @@ -1399,10 +1401,10 @@ protected: { ProcessResultData resultData = m_process.resultData(); if (resultData.m_error == QProcess::FailedToStart) { - resultData.m_errorString = tr("\"%1\" failed to start: %2") + resultData.m_errorString = Tr::tr("\"%1\" failed to start: %2") .arg(FileTransfer::transferMethodName(m_setup.m_method), resultData.m_errorString); } else if (resultData.m_exitStatus != QProcess::NormalExit) { - resultData.m_errorString = tr("\"%1\" crashed.") + resultData.m_errorString = Tr::tr("\"%1\" crashed.") .arg(FileTransfer::transferMethodName(m_setup.m_method)); } else if (resultData.m_exitCode != 0) { resultData.m_errorString = QString::fromLocal8Bit(m_process.readAllStandardError()); @@ -1499,14 +1501,14 @@ private: { const FilePath sftpBinary = SshSettings::sftpFilePath(); if (!sftpBinary.exists()) { - startFailed(SshTransferInterface::tr("\"sftp\" binary \"%1\" does not exist.") + startFailed(Tr::tr("\"sftp\" binary \"%1\" does not exist.") .arg(sftpBinary.toUserOutput())); return; } m_batchFile.reset(new QTemporaryFile(this)); if (!m_batchFile->isOpen() && !m_batchFile->open()) { - startFailed(SshTransferInterface::tr("Could not create temporary file: %1") + startFailed(Tr::tr("Could not create temporary file: %1") .arg(m_batchFile->errorString())); return; } @@ -1518,7 +1520,7 @@ private: + '\n'); } else if (direction() == FileTransferDirection::Download) { if (!QDir::root().mkpath(dir.path())) { - startFailed(SshTransferInterface::tr("Failed to create local directory \"%1\".") + startFailed(Tr::tr("Failed to create local directory \"%1\".") .arg(QDir::toNativeSeparators(dir.path()))); return; } @@ -1662,7 +1664,7 @@ namespace Internal { LinuxDeviceFactory::LinuxDeviceFactory() : IDeviceFactory(Constants::GenericLinuxOsType) { - setDisplayName(LinuxDevice::tr("Remote Linux Device")); + setDisplayName(Tr::tr("Remote Linux Device")); setIcon(QIcon()); setConstructionFunction(&LinuxDevice::create); setCreator([] { diff --git a/src/plugins/remotelinux/linuxdevice.h b/src/plugins/remotelinux/linuxdevice.h index 32e42ee908..2df1560f84 100644 --- a/src/plugins/remotelinux/linuxdevice.h +++ b/src/plugins/remotelinux/linuxdevice.h @@ -34,8 +34,6 @@ namespace RemoteLinux { class REMOTELINUX_EXPORT LinuxDevice : public ProjectExplorer::IDevice { - Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::LinuxDevice) - public: using Ptr = QSharedPointer<LinuxDevice>; using ConstPtr = QSharedPointer<const LinuxDevice>; diff --git a/src/plugins/remotelinux/linuxdevicetester.cpp b/src/plugins/remotelinux/linuxdevicetester.cpp index 6d0028fb80..7b7c57895d 100644 --- a/src/plugins/remotelinux/linuxdevicetester.cpp +++ b/src/plugins/remotelinux/linuxdevicetester.cpp @@ -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); } diff --git a/src/plugins/remotelinux/makeinstallstep.cpp b/src/plugins/remotelinux/makeinstallstep.cpp index 79a90814ee..4af8945810 100644 --- a/src/plugins/remotelinux/makeinstallstep.cpp +++ b/src/plugins/remotelinux/makeinstallstep.cpp @@ -26,6 +26,7 @@ #include "makeinstallstep.h" #include "remotelinux_constants.h" +#include "remotelinuxtr.h" #include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildsteplist.h> @@ -88,7 +89,7 @@ MakeInstallStep::MakeInstallStep(BuildStepList *parent, Id id) : MakeStep(parent makeAspect->setId(MakeAspectId); makeAspect->setSettingsKey(MakeAspectId); makeAspect->setDisplayStyle(StringAspect::PathChooserDisplay); - makeAspect->setLabelText(tr("Command:")); + makeAspect->setLabelText(Tr::tr("Command:")); connect(makeAspect, &ExecutableAspect::changed, this, &MakeInstallStep::updateCommandFromAspect); @@ -97,7 +98,7 @@ MakeInstallStep::MakeInstallStep(BuildStepList *parent, Id id) : MakeStep(parent installRootAspect->setSettingsKey(InstallRootAspectId); installRootAspect->setDisplayStyle(StringAspect::PathChooserDisplay); installRootAspect->setExpectedKind(PathChooser::Directory); - installRootAspect->setLabelText(tr("Install root:")); + installRootAspect->setLabelText(Tr::tr("Install root:")); installRootAspect->setFilePath(rootPath); connect(installRootAspect, &StringAspect::changed, this, &MakeInstallStep::updateArgsFromAspect); @@ -105,22 +106,22 @@ MakeInstallStep::MakeInstallStep(BuildStepList *parent, Id id) : MakeStep(parent const auto cleanInstallRootAspect = addAspect<BoolAspect>(); cleanInstallRootAspect->setId(CleanInstallRootAspectId); cleanInstallRootAspect->setSettingsKey(CleanInstallRootAspectId); - cleanInstallRootAspect->setLabel(tr("Clean install root first:"), + cleanInstallRootAspect->setLabel(Tr::tr("Clean install root first:"), BoolAspect::LabelPlacement::InExtraLabel); cleanInstallRootAspect->setValue(true); const auto commandLineAspect = addAspect<StringAspect>(); commandLineAspect->setId(FullCommandLineAspectId); commandLineAspect->setDisplayStyle(StringAspect::LabelDisplay); - commandLineAspect->setLabelText(tr("Full command line:")); + commandLineAspect->setLabelText(Tr::tr("Full command line:")); const auto customCommandLineAspect = addAspect<StringAspect>(); customCommandLineAspect->setId(CustomCommandLineAspectId); customCommandLineAspect->setSettingsKey(CustomCommandLineAspectId); customCommandLineAspect->setDisplayStyle(StringAspect::LineEditDisplay); - customCommandLineAspect->setLabelText(tr("Custom command line:")); + customCommandLineAspect->setLabelText(Tr::tr("Custom command line:")); customCommandLineAspect->makeCheckable(StringAspect::CheckBoxPlacement::Top, - tr("Use custom command line instead:"), + Tr::tr("Use custom command line instead:"), "RemoteLinux.MakeInstall.EnableCustomCommandLine"); const auto updateCommand = [this] { updateCommandFromAspect(); @@ -146,7 +147,7 @@ Utils::Id MakeInstallStep::stepId() QString MakeInstallStep::displayName() { - return tr("Install into temporary host directory"); + return Tr::tr("Install into temporary host directory"); } QWidget *MakeInstallStep::createConfigWidget() @@ -162,24 +163,24 @@ bool MakeInstallStep::init() const FilePath rootDir = installRoot().onDevice(makeCommand()); if (rootDir.isEmpty()) { - emit addTask(BuildSystemTask(Task::Error, tr("You must provide an install root."))); + emit addTask(BuildSystemTask(Task::Error, Tr::tr("You must provide an install root."))); return false; } if (cleanInstallRoot() && !rootDir.removeRecursively()) { emit addTask(BuildSystemTask(Task::Error, - tr("The install root \"%1\" could not be cleaned.") + Tr::tr("The install root \"%1\" could not be cleaned.") .arg(rootDir.displayName()))); return false; } if (!rootDir.exists() && !rootDir.createDir()) { emit addTask(BuildSystemTask(Task::Error, - tr("The install root \"%1\" could not be created.") + Tr::tr("The install root \"%1\" could not be created.") .arg(rootDir.displayName()))); return false; } if (this == deployConfiguration()->stepList()->steps().last()) { emit addTask(BuildSystemTask(Task::Warning, - tr("The \"make install\" step should probably not be " + Tr::tr("The \"make install\" step should probably not be " "last in the list of deploy steps. " "Consider moving it up."))); } @@ -241,7 +242,7 @@ void MakeInstallStep::finish(bool success) buildSystem()->setDeploymentData(m_deploymentData); } else if (m_noInstallTarget && m_isCmakeProject) { - emit addTask(DeploymentTask(Task::Warning, tr("You need to add an install statement " + emit addTask(DeploymentTask(Task::Warning, Tr::tr("You need to add an install statement " "to your CMakeLists.txt file for deployment to work."))); } MakeStep::finish(success); diff --git a/src/plugins/remotelinux/publickeydeploymentdialog.cpp b/src/plugins/remotelinux/publickeydeploymentdialog.cpp index 3ba3f011d7..79e090322c 100644 --- a/src/plugins/remotelinux/publickeydeploymentdialog.cpp +++ b/src/plugins/remotelinux/publickeydeploymentdialog.cpp @@ -25,10 +25,13 @@ #include "publickeydeploymentdialog.h" +#include "remotelinuxtr.h" + #include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/sshparameters.h> #include <projectexplorer/devicesupport/sshsettings.h> -#include <utils/fileutils.h> + +#include <utils/filepath.h> #include <utils/qtcprocess.h> #include <utils/theme/theme.h> @@ -53,8 +56,8 @@ PublicKeyDeploymentDialog *PublicKeyDeploymentDialog::createDialog( { const FilePath dir = deviceConfig->sshParameters().privateKeyFile.parentDir(); const FilePath publicKeyFileName = FileUtils::getOpenFilePath(nullptr, - tr("Choose Public Key File"), dir, - tr("Public Key Files (*.pub);;All Files (*)")); + Tr::tr("Choose Public Key File"), dir, + Tr::tr("Public Key Files (*.pub);;All Files (*)")); if (publicKeyFileName.isEmpty()) return nullptr; return new PublicKeyDeploymentDialog(deviceConfig, publicKeyFileName, parent); @@ -70,7 +73,7 @@ PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const IDevice::ConstPtr &de setMaximum(1); d->m_done = false; - setLabelText(tr("Deploying...")); + setLabelText(Tr::tr("Deploying...")); setValue(0); connect(this, &PublicKeyDeploymentDialog::canceled, this, [this] { d->m_done ? accept() : reject(); }); @@ -83,7 +86,7 @@ PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const IDevice::ConstPtr &de errorMessage = d->m_process.cleanedStdErr(); if (errorMessage.endsWith('\n')) errorMessage.chop(1); - finalMessage = tr("Key deployment failed."); + finalMessage = Tr::tr("Key deployment failed."); if (!errorMessage.isEmpty()) finalMessage += '\n' + errorMessage; } @@ -92,7 +95,7 @@ PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const IDevice::ConstPtr &de FileReader reader; if (!reader.fetch(publicKeyFileName)) { - handleDeploymentDone(false, tr("Public key error: %1").arg(reader.errorString())); + handleDeploymentDone(false, Tr::tr("Public key error: %1").arg(reader.errorString())); return; } @@ -136,12 +139,12 @@ PublicKeyDeploymentDialog::~PublicKeyDeploymentDialog() void PublicKeyDeploymentDialog::handleDeploymentDone(bool succeeded, const QString &errorMessage) { - QString buttonText = succeeded ? tr("Deployment finished successfully.") : errorMessage; + QString buttonText = succeeded ? Tr::tr("Deployment finished successfully.") : errorMessage; const QString textColor = creatorTheme()->color( succeeded ? Theme::TextColorNormal : Theme::TextColorError).name(); setLabelText(QString::fromLatin1("<font color=\"%1\">%2</font>") .arg(textColor, buttonText.replace("\n", "<br/>"))); - setCancelButtonText(tr("Close")); + setCancelButtonText(Tr::tr("Close")); if (!succeeded) return; diff --git a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp index 38668ae1b5..e003d938e7 100644 --- a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp @@ -26,6 +26,7 @@ #include "remotelinuxcustomrunconfiguration.h" #include "remotelinux_constants.h" +#include "remotelinuxtr.h" #include "remotelinuxenvironmentaspect.h" #include "x11forwardingaspect.h" @@ -38,13 +39,10 @@ using namespace ProjectExplorer; using namespace Utils; -namespace RemoteLinux { -namespace Internal { +namespace RemoteLinux::Internal { class RemoteLinuxCustomRunConfiguration : public RunConfiguration { - Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::RemoteLinuxCustomRunConfiguration) - public: RemoteLinuxCustomRunConfiguration(Target *target, Id id); @@ -61,14 +59,14 @@ RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(Target *tar auto exeAspect = addAspect<ExecutableAspect>(target, ExecutableAspect::RunDevice); exeAspect->setSettingsKey("RemoteLinux.CustomRunConfig.RemoteExecutable"); - exeAspect->setLabelText(tr("Remote executable:")); + exeAspect->setLabelText(Tr::tr("Remote executable:")); exeAspect->setDisplayStyle(StringAspect::LineEditDisplay); exeAspect->setHistoryCompleter("RemoteLinux.CustomExecutable.History"); exeAspect->setExpectedKind(PathChooser::Any); auto symbolsAspect = addAspect<SymbolFileAspect>(); symbolsAspect->setSettingsKey("RemoteLinux.CustomRunConfig.LocalExecutable"); - symbolsAspect->setLabelText(tr("Local executable:")); + symbolsAspect->setLabelText(Tr::tr("Local executable:")); symbolsAspect->setDisplayStyle(SymbolFileAspect::PathChooserDisplay); addAspect<ArgumentsAspect>(macroExpander()); @@ -90,7 +88,7 @@ QString RemoteLinuxCustomRunConfiguration::runConfigDefaultDisplayName() { QString remoteExecutable = aspect<ExecutableAspect>()->executable().toString(); QString display = remoteExecutable.isEmpty() - ? tr("Custom Executable") : tr("Run \"%1\"").arg(remoteExecutable); + ? Tr::tr("Custom Executable") : Tr::tr("Run \"%1\"").arg(remoteExecutable); return RunConfigurationFactory::decoratedTargetName(display, target()); } @@ -98,8 +96,8 @@ Tasks RemoteLinuxCustomRunConfiguration::checkForIssues() const { Tasks tasks; if (aspect<ExecutableAspect>()->executable().isEmpty()) { - tasks << createConfigurationIssue(tr("The remote executable must be set in order to run " - "a custom remote run configuration.")); + tasks << createConfigurationIssue(Tr::tr("The remote executable must be set in order to run " + "a custom remote run configuration.")); } return tasks; } @@ -107,11 +105,10 @@ Tasks RemoteLinuxCustomRunConfiguration::checkForIssues() const // RemoteLinuxCustomRunConfigurationFactory RemoteLinuxCustomRunConfigurationFactory::RemoteLinuxCustomRunConfigurationFactory() - : FixedRunConfigurationFactory(RemoteLinuxCustomRunConfiguration::tr("Custom Executable"), true) + : FixedRunConfigurationFactory(Tr::tr("Custom Executable"), true) { registerRunConfiguration<RemoteLinuxCustomRunConfiguration>("RemoteLinux.CustomRunConfig"); addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType); } -} // namespace Internal -} // namespace RemoteLinux +} // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.h b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.h index aeed4c55df..98a255cd2d 100644 --- a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.h @@ -27,8 +27,7 @@ #include <projectexplorer/runconfiguration.h> -namespace RemoteLinux { -namespace Internal { +namespace RemoteLinux::Internal { class RemoteLinuxCustomRunConfigurationFactory : public ProjectExplorer::FixedRunConfigurationFactory @@ -37,5 +36,4 @@ public: RemoteLinuxCustomRunConfigurationFactory(); }; -} // namespace Internal -} // namespace RemoteLinux +} // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index 654b937aae..a0449a6734 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -30,8 +30,7 @@ using namespace Debugger; using namespace ProjectExplorer; -namespace RemoteLinux { -namespace Internal { +namespace RemoteLinux::Internal { LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunControl *runControl) : DebuggerRunTool(runControl, DebuggerRunTool::DoNotAllowTerminal) @@ -52,5 +51,4 @@ LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunControl *runControl) setLldbPlatform("remote-linux"); } -} // namespace Internal -} // namespace RemoteLinux +} // Internal::Internal diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.h b/src/plugins/remotelinux/remotelinuxdebugsupport.h index 34df20d2da..d676856dfc 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.h +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.h @@ -27,8 +27,7 @@ #include <debugger/debuggerruncontrol.h> -namespace RemoteLinux { -namespace Internal { +namespace RemoteLinux::Internal { class LinuxDeviceDebugSupport : public Debugger::DebuggerRunTool { @@ -36,5 +35,4 @@ public: LinuxDeviceDebugSupport(ProjectExplorer::RunControl *runControl); }; -} // namespace Internal -} // namespace RemoteLinux +} // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp index 37a4429801..c439407551 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp @@ -27,25 +27,22 @@ #include "makeinstallstep.h" #include "remotelinux_constants.h" +#include "remotelinuxtr.h" #include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/kitinformation.h> #include <projectexplorer/project.h> #include <projectexplorer/target.h> -#include <QCoreApplication> - using namespace ProjectExplorer; -namespace RemoteLinux { -namespace Internal { +namespace RemoteLinux::Internal { RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory() { setConfigBaseId(RemoteLinux::Constants::DeployToGenericLinux); addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType); - setDefaultDisplayName(QCoreApplication::translate("RemoteLinux", - "Deploy to Remote Linux Host")); + setDefaultDisplayName(Tr::tr("Deploy to Remote Linux Host")); setUseDeploymentDataView(); const auto needsMakeInstall = [](Target *target) @@ -74,5 +71,4 @@ RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory() }); } -} // namespace Internal -} // namespace RemoteLinux +} // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h index 3a4c803d21..5b9cb5523e 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h @@ -27,8 +27,7 @@ #include <projectexplorer/deployconfiguration.h> -namespace RemoteLinux { -namespace Internal { +namespace RemoteLinux::Internal { class RemoteLinuxDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory { @@ -36,5 +35,4 @@ public: RemoteLinuxDeployConfigurationFactory(); }; -} // namespace Internal -} // namespace RemoteLinux +} // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp b/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp index 4b8c4a5ad8..bd97e15359 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp +++ b/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp @@ -26,6 +26,8 @@ #include "remotelinuxenvironmentaspect.h" #include "remotelinuxenvironmentaspectwidget.h" +#include "remotelinuxtr.h" + #include <utils/algorithm.h> namespace RemoteLinux { @@ -43,8 +45,8 @@ static bool displayAlreadySet(const Utils::EnvironmentItems &changes) RemoteLinuxEnvironmentAspect::RemoteLinuxEnvironmentAspect(ProjectExplorer::Target *target) { - addSupportedBaseEnvironment(tr("Clean Environment"), {}); - addPreferredBaseEnvironment(tr("System Environment"), [this] { return m_remoteEnvironment; }); + addSupportedBaseEnvironment(Tr::tr("Clean Environment"), {}); + addPreferredBaseEnvironment(Tr::tr("System Environment"), [this] { return m_remoteEnvironment; }); setConfigWidgetCreator([this, target] { return new RemoteLinuxEnvironmentAspectWidget(this, target); diff --git a/src/plugins/remotelinux/remotelinuxenvironmentaspectwidget.cpp b/src/plugins/remotelinux/remotelinuxenvironmentaspectwidget.cpp index a301637104..1e18499061 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentaspectwidget.cpp +++ b/src/plugins/remotelinux/remotelinuxenvironmentaspectwidget.cpp @@ -28,11 +28,14 @@ #include "linuxdevice.h" #include "remotelinuxenvironmentaspect.h" #include "remotelinuxenvironmentreader.h" +#include "remotelinuxtr.h" #include <coreplugin/icore.h> + #include <projectexplorer/environmentwidget.h> #include <projectexplorer/kitinformation.h> #include <projectexplorer/target.h> + #include <utils/qtcassert.h> #include <QCoreApplication> @@ -43,14 +46,10 @@ using namespace ProjectExplorer; using namespace RemoteLinux::Internal; using namespace Utils; -namespace { -const QString FetchEnvButtonText - = QCoreApplication::translate("RemoteLinux::RemoteLinuxEnvironmentAspectWidget", - "Fetch Device Environment"); -} // anonymous namespace - namespace RemoteLinux { +const QString FetchEnvButtonText = Tr::tr("Fetch Device Environment"); + RemoteLinuxEnvironmentAspectWidget::RemoteLinuxEnvironmentAspectWidget (RemoteLinuxEnvironmentAspect *aspect, Target *target) : EnvironmentAspectWidget(aspect) @@ -71,12 +70,12 @@ RemoteLinuxEnvironmentAspectWidget::RemoteLinuxEnvironmentAspectWidget this, &RemoteLinuxEnvironmentAspectWidget::fetchEnvironmentError); const EnvironmentWidget::OpenTerminalFunc openTerminalFunc - = [target](const Utils::Environment &env) { + = [target](const Environment &env) { IDevice::ConstPtr device = DeviceKitAspect::device(target->kit()); if (!device) { QMessageBox::critical(Core::ICore::dialogParent(), - tr("Cannot Open Terminal"), - tr("Cannot open remote terminal: Current kit has no device.")); + Tr::tr("Cannot Open Terminal"), + Tr::tr("Cannot open remote terminal: Current kit has no device.")); return; } const auto linuxDevice = device.dynamicCast<const LinuxDevice>(); @@ -92,7 +91,7 @@ void RemoteLinuxEnvironmentAspectWidget::fetchEnvironment() this, &RemoteLinuxEnvironmentAspectWidget::fetchEnvironment); connect(m_fetchButton, &QPushButton::clicked, this, &RemoteLinuxEnvironmentAspectWidget::stopFetchEnvironment); - m_fetchButton->setText(tr("Cancel Fetch Operation")); + m_fetchButton->setText(Tr::tr("Cancel Fetch Operation")); m_deviceEnvReader->start(); } @@ -109,8 +108,8 @@ void RemoteLinuxEnvironmentAspectWidget::fetchEnvironmentFinished() void RemoteLinuxEnvironmentAspectWidget::fetchEnvironmentError(const QString &error) { - QMessageBox::warning(this, tr("Device Error"), - tr("Fetching environment failed: %1").arg(error)); + QMessageBox::warning(this, Tr::tr("Device Error"), + Tr::tr("Fetching environment failed: %1").arg(error)); } void RemoteLinuxEnvironmentAspectWidget::stopFetchEnvironment() @@ -119,8 +118,4 @@ void RemoteLinuxEnvironmentAspectWidget::stopFetchEnvironment() fetchEnvironmentFinished(); } -// -------------------------------------------------------------------- -// RemoteLinuxEnvironmentAspectWidget: -// -------------------------------------------------------------------- - -} // namespace RemoteLinux +} // RemoteLinux diff --git a/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp b/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp index 3f88ac4b5e..c3134a7bbf 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp +++ b/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp @@ -25,6 +25,8 @@ #include "remotelinuxenvironmentreader.h" +#include "remotelinuxtr.h" + #include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/runcontrol.h> @@ -48,7 +50,7 @@ RemoteLinuxEnvironmentReader::RemoteLinuxEnvironmentReader(const IDevice::ConstP void RemoteLinuxEnvironmentReader::start() { if (!m_device) { - emit error(tr("Error: No device")); + emit error(Tr::tr("Error: No device")); setFinished(); return; } @@ -77,7 +79,7 @@ void RemoteLinuxEnvironmentReader::handleCurrentDeviceConfigChanged() void RemoteLinuxEnvironmentReader::handleDone() { if (m_deviceProcess->result() != ProcessResult::FinishedWithSuccess) { - emit error(tr("Error: %1").arg(m_deviceProcess->errorString())); + emit error(Tr::tr("Error: %1").arg(m_deviceProcess->errorString())); setFinished(); return; } @@ -87,16 +89,16 @@ void RemoteLinuxEnvironmentReader::handleDone() if (m_deviceProcess->exitStatus() != QProcess::NormalExit) { errorMessage = m_deviceProcess->errorString(); } else if (m_deviceProcess->exitCode() != 0) { - errorMessage = tr("Process exited with code %1.") + errorMessage = Tr::tr("Process exited with code %1.") .arg(m_deviceProcess->exitCode()); } if (!errorMessage.isEmpty()) { - errorMessage = tr("Error running 'env': %1").arg(errorMessage); + errorMessage = Tr::tr("Error running 'env': %1").arg(errorMessage); const QString remoteStderr = QString::fromUtf8(m_deviceProcess->readAllStandardError()).trimmed(); if (!remoteStderr.isEmpty()) - errorMessage += QLatin1Char('\n') + tr("Remote stderr was: \"%1\"").arg(remoteStderr); + errorMessage += QLatin1Char('\n') + Tr::tr("Remote stderr was: \"%1\"").arg(remoteStderr); emit error(errorMessage); } else { const QString remoteOutput = QString::fromUtf8(m_deviceProcess->readAllStandardOutput()); diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index 14f9536561..1fca2f5f63 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -27,6 +27,7 @@ #include "remotelinux_constants.h" #include "remotelinuxenvironmentaspect.h" +#include "remotelinuxtr.h" #include "x11forwardingaspect.h" #include <projectexplorer/buildsystem.h> @@ -43,13 +44,10 @@ using namespace ProjectExplorer; using namespace Utils; -namespace RemoteLinux { -namespace Internal { +namespace RemoteLinux::Internal { class RemoteLinuxRunConfiguration final : public RunConfiguration { - Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::RemoteLinuxRunConfiguration) - public: RemoteLinuxRunConfiguration(Target *target, Id id); }; @@ -60,14 +58,14 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id) auto envAspect = addAspect<RemoteLinuxEnvironmentAspect>(target); auto exeAspect = addAspect<ExecutableAspect>(target, ExecutableAspect::RunDevice); - exeAspect->setLabelText(tr("Executable on device:")); - exeAspect->setPlaceHolderText(tr("Remote path not set")); + exeAspect->setLabelText(Tr::tr("Executable on device:")); + exeAspect->setPlaceHolderText(Tr::tr("Remote path not set")); exeAspect->makeOverridable("RemoteLinux.RunConfig.AlternateRemoteExecutable", "RemoteLinux.RunConfig.UseAlternateRemoteExecutable"); exeAspect->setHistoryCompleter("RemoteLinux.AlternateExecutable.History"); auto symbolsAspect = addAspect<SymbolFileAspect>(); - symbolsAspect->setLabelText(tr("Executable on host:")); + symbolsAspect->setLabelText(Tr::tr("Executable on host:")); symbolsAspect->setDisplayStyle(SymbolFileAspect::LabelDisplay); addAspect<ArgumentsAspect>(macroExpander()); @@ -105,5 +103,4 @@ RemoteLinuxRunConfigurationFactory::RemoteLinuxRunConfigurationFactory() addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType); } -} // namespace Internal -} // namespace RemoteLinux +} // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.h b/src/plugins/remotelinux/remotelinuxrunconfiguration.h index eceeb5b626..cb805f2824 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.h @@ -27,8 +27,7 @@ #include <projectexplorer/runconfiguration.h> -namespace RemoteLinux { -namespace Internal { +namespace RemoteLinux::Internal { class RemoteLinuxRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory { @@ -36,5 +35,4 @@ public: RemoteLinuxRunConfigurationFactory(); }; -} // namespace Internal -} // namespace RemoteLinux +} // namespace RemoteLinux::Internal diff --git a/src/plugins/remotelinux/remotelinuxsignaloperation.cpp b/src/plugins/remotelinux/remotelinuxsignaloperation.cpp index a0dec6b269..ed79b2d452 100644 --- a/src/plugins/remotelinux/remotelinuxsignaloperation.cpp +++ b/src/plugins/remotelinux/remotelinuxsignaloperation.cpp @@ -25,15 +25,18 @@ #include "remotelinuxsignaloperation.h" +#include "remotelinuxtr.h" + #include <utils/commandline.h> #include <utils/fileutils.h> #include <utils/qtcassert.h> #include <utils/qtcprocess.h> -using namespace RemoteLinux; using namespace ProjectExplorer; using namespace Utils; +namespace RemoteLinux { + RemoteLinuxSignalOperation::RemoteLinuxSignalOperation( const IDeviceConstPtr &device) : m_device(device) @@ -106,10 +109,12 @@ void RemoteLinuxSignalOperation::runnerDone() if (m_process->exitStatus() != QProcess::NormalExit) { m_errorMessage = m_process->errorString(); } else if (m_process->exitCode() != 0) { - m_errorMessage = tr("Exit code is %1. stderr:").arg(m_process->exitCode()) + m_errorMessage = Tr::tr("Exit code is %1. stderr:").arg(m_process->exitCode()) + QLatin1Char(' ') + QString::fromLatin1(m_process->readAllStandardError()); } m_process.release()->deleteLater(); emit finished(m_errorMessage); } + +} // RemoteLinux diff --git a/src/plugins/remotelinux/rsyncdeploystep.cpp b/src/plugins/remotelinux/rsyncdeploystep.cpp index 7b8cf858f1..eacd678966 100644 --- a/src/plugins/remotelinux/rsyncdeploystep.cpp +++ b/src/plugins/remotelinux/rsyncdeploystep.cpp @@ -27,12 +27,14 @@ #include "abstractremotelinuxdeployservice.h" #include "remotelinux_constants.h" +#include "remotelinuxtr.h" #include <projectexplorer/deploymentdata.h> #include <projectexplorer/devicesupport/filetransfer.h> #include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/runconfigurationaspects.h> #include <projectexplorer/target.h> + #include <utils/algorithm.h> #include <utils/processinterface.h> #include <utils/qtcprocess.h> @@ -45,7 +47,6 @@ namespace Internal { class RsyncDeployService : public AbstractRemoteLinuxDeployService { - Q_OBJECT public: RsyncDeployService(QObject *parent = nullptr) : AbstractRemoteLinuxDeployService(parent) { @@ -58,7 +59,7 @@ public: finalMessage += '\n'; finalMessage += stdErr; } - emit errorMessage(tr("Deploy via rsync: failed to create remote directories:") + emit errorMessage(Tr::tr("Deploy via rsync: failed to create remote directories:") + '\n' + finalMessage); setFinished(); return; @@ -76,11 +77,11 @@ public: setFinished(); }; if (result.m_error == QProcess::FailedToStart) - notifyError(tr("rsync failed to start: %1").arg(result.m_errorString)); + notifyError(Tr::tr("rsync failed to start: %1").arg(result.m_errorString)); else if (result.m_exitStatus == QProcess::CrashExit) - notifyError(tr("rsync crashed.")); + notifyError(Tr::tr("rsync crashed.")); else if (result.m_exitCode != 0) - notifyError(tr("rsync failed with exit code %1.").arg(result.m_exitCode)); + notifyError(Tr::tr("rsync failed with exit code %1.").arg(result.m_exitCode)); else setFinished(); }); @@ -170,12 +171,12 @@ RsyncDeployStep::RsyncDeployStep(BuildStepList *bsl, Utils::Id id) auto flags = addAspect<StringAspect>(); flags->setDisplayStyle(StringAspect::LineEditDisplay); flags->setSettingsKey("RemoteLinux.RsyncDeployStep.Flags"); - flags->setLabelText(tr("Flags:")); + flags->setLabelText(Tr::tr("Flags:")); flags->setValue(FileTransferSetupData::defaultRsyncFlags()); auto ignoreMissingFiles = addAspect<BoolAspect>(); ignoreMissingFiles->setSettingsKey("RemoteLinux.RsyncDeployStep.IgnoreMissingFiles"); - ignoreMissingFiles->setLabel(tr("Ignore missing files:"), + ignoreMissingFiles->setLabel(Tr::tr("Ignore missing files:"), BoolAspect::LabelPlacement::InExtraLabel); ignoreMissingFiles->setValue(false); @@ -199,9 +200,7 @@ Utils::Id RsyncDeployStep::stepId() QString RsyncDeployStep::displayName() { - return tr("Deploy files via rsync"); + return Tr::tr("Deploy files via rsync"); } -} //namespace RemoteLinux - -#include <rsyncdeploystep.moc> +} // RemoteLinux diff --git a/src/plugins/remotelinux/rsyncdeploystep.h b/src/plugins/remotelinux/rsyncdeploystep.h index 76373a2ef8..3595a67382 100644 --- a/src/plugins/remotelinux/rsyncdeploystep.h +++ b/src/plugins/remotelinux/rsyncdeploystep.h @@ -43,4 +43,4 @@ public: static QString displayName(); }; -} // namespace RemoteLinux +} // RemoteLinux diff --git a/src/plugins/remotelinux/sshkeycreationdialog.cpp b/src/plugins/remotelinux/sshkeycreationdialog.cpp index fc6649d669..74ddad4cd7 100644 --- a/src/plugins/remotelinux/sshkeycreationdialog.cpp +++ b/src/plugins/remotelinux/sshkeycreationdialog.cpp @@ -25,6 +25,8 @@ #include "sshkeycreationdialog.h" +#include "remotelinuxtr.h" + #include <projectexplorer/devicesupport/sshsettings.h> #include <utils/fileutils.h> @@ -50,13 +52,13 @@ namespace RemoteLinux { SshKeyCreationDialog::SshKeyCreationDialog(QWidget *parent) : QDialog(parent) { - setWindowTitle(tr("SSH Key Configuration")); + setWindowTitle(Tr::tr("SSH Key Configuration")); resize(385, 231); - m_rsa = new QRadioButton(tr("&RSA")); + m_rsa = new QRadioButton(Tr::tr("&RSA")); m_rsa->setChecked(true); - m_ecdsa = new QRadioButton(tr("ECDSA")); + m_ecdsa = new QRadioButton(Tr::tr("ECDSA")); m_comboBox = new QComboBox; @@ -65,8 +67,8 @@ SshKeyCreationDialog::SshKeyCreationDialog(QWidget *parent) m_publicKeyFileLabel = new QLabel; auto privateKeyFileButton = new QPushButton(PathChooser::browseButtonLabel()); - m_generateButton = new QPushButton(tr("&Generate And Save Key Pair")); - auto closeButton = new QPushButton(tr("&Cancel")); + m_generateButton = new QPushButton(Tr::tr("&Generate And Save Key Pair")); + auto closeButton = new QPushButton(Tr::tr("&Cancel")); using namespace Layouting; const Break nl; @@ -74,12 +76,12 @@ SshKeyCreationDialog::SshKeyCreationDialog(QWidget *parent) Column { Group { - Title(tr("Options")), + Title(Tr::tr("Options")), Form { - tr("Key algorithm:"), m_rsa, m_ecdsa, st, nl, - tr("Key &size:"), m_comboBox, st, nl, - tr("Private key file:"), m_privateKeyFileValueLabel, privateKeyFileButton, st, nl, - tr("Public key file:"), m_publicKeyFileLabel + Tr::tr("Key algorithm:"), m_rsa, m_ecdsa, st, nl, + Tr::tr("Key &size:"), m_comboBox, st, nl, + Tr::tr("Private key file:"), m_privateKeyFileValueLabel, privateKeyFileButton, st, nl, + Tr::tr("Public key file:"), m_publicKeyFileLabel } }, Stretch(), @@ -120,11 +122,11 @@ void SshKeyCreationDialog::keyTypeChanged() void SshKeyCreationDialog::generateKeys() { if (SshSettings::keygenFilePath().isEmpty()) { - showError(tr("The ssh-keygen tool was not found.")); + showError(Tr::tr("The ssh-keygen tool was not found.")); return; } if (privateKeyFilePath().exists()) { - showError(tr("Refusing to overwrite existing private key file \"%1\".") + showError(Tr::tr("Refusing to overwrite existing private key file \"%1\".") .arg(privateKeyFilePath().toUserOutput())); return; } @@ -141,7 +143,7 @@ void SshKeyCreationDialog::generateKeys() else if (keygen.exitCode() != 0) errorMsg = QString::fromLocal8Bit(keygen.readAllStandardError()); if (!errorMsg.isEmpty()) { - showError(tr("The ssh-keygen tool at \"%1\" failed: %2") + showError(Tr::tr("The ssh-keygen tool at \"%1\" failed: %2") .arg(SshSettings::keygenFilePath().toUserOutput(), errorMsg)); } QApplication::restoreOverrideCursor(); @@ -150,7 +152,7 @@ void SshKeyCreationDialog::generateKeys() void SshKeyCreationDialog::handleBrowseButtonClicked() { - const FilePath filePath = FileUtils::getSaveFilePath(this, tr("Choose Private Key File Name")); + const FilePath filePath = FileUtils::getSaveFilePath(this, Tr::tr("Choose Private Key File Name")); if (!filePath.isEmpty()) setPrivateKeyFile(filePath); } @@ -164,7 +166,7 @@ void SshKeyCreationDialog::setPrivateKeyFile(const FilePath &filePath) void SshKeyCreationDialog::showError(const QString &details) { - QMessageBox::critical(this, tr("Key Generation Failed"), details); + QMessageBox::critical(this, Tr::tr("Key Generation Failed"), details); } FilePath SshKeyCreationDialog::privateKeyFilePath() const diff --git a/src/plugins/remotelinux/tarpackagecreationstep.cpp b/src/plugins/remotelinux/tarpackagecreationstep.cpp index 23eb9745bd..c8e6b35a93 100644 --- a/src/plugins/remotelinux/tarpackagecreationstep.cpp +++ b/src/plugins/remotelinux/tarpackagecreationstep.cpp @@ -27,6 +27,7 @@ #include "deploymenttimeinfo.h" #include "remotelinux_constants.h" +#include "remotelinuxtr.h" #include <projectexplorer/buildmanager.h> #include <projectexplorer/deploymentdata.h> @@ -95,21 +96,21 @@ TarPackageCreationStep::TarPackageCreationStep(BuildStepList *bsl, Id id) d->m_deploymentDataModified = true; d->m_ignoreMissingFilesAspect = addAspect<BoolAspect>(); - d->m_ignoreMissingFilesAspect->setLabel(tr("Ignore missing files"), + d->m_ignoreMissingFilesAspect->setLabel(Tr::tr("Ignore missing files"), BoolAspect::LabelPlacement::AtCheckBox); d->m_ignoreMissingFilesAspect->setSettingsKey(IgnoreMissingFilesKey); d->m_incrementalDeploymentAspect = addAspect<BoolAspect>(); - d->m_incrementalDeploymentAspect->setLabel(tr("Package modified files only"), + d->m_incrementalDeploymentAspect->setLabel(Tr::tr("Package modified files only"), BoolAspect::LabelPlacement::AtCheckBox); d->m_incrementalDeploymentAspect->setSettingsKey(IncrementalDeploymentKey); setSummaryUpdater([this] { FilePath path = packageFilePath(); if (path.isEmpty()) - return QString("<font color=\"red\">" + tr("Tarball creation not possible.") + return QString("<font color=\"red\">" + Tr::tr("Tarball creation not possible.") + "</font>"); - return QString("<b>" + tr("Create tarball:") + "</b> " + path.toUserOutput()); + return QString("<b>" + Tr::tr("Create tarball:") + "</b> " + path.toUserOutput()); }); } @@ -122,7 +123,7 @@ Utils::Id TarPackageCreationStep::stepId() QString TarPackageCreationStep::displayName() { - return tr("Create tarball"); + return Tr::tr("Create tarball"); } FilePath TarPackageCreationStep::packageFilePath() const @@ -252,9 +253,9 @@ bool TarPackageCreationStep::runImpl() if (success) { d->m_deploymentDataModified = false; - emit addOutput(tr("Packaging finished successfully."), OutputFormat::NormalMessage); + emit addOutput(Tr::tr("Packaging finished successfully."), OutputFormat::NormalMessage); } else { - emit addOutput(tr("Packaging failed."), OutputFormat::ErrorMessage); + emit addOutput(Tr::tr("Packaging failed."), OutputFormat::ErrorMessage); } connect(BuildManager::instance(), &BuildManager::buildQueueFinished, @@ -265,9 +266,9 @@ bool TarPackageCreationStep::runImpl() bool TarPackageCreationStep::doPackage() { - emit addOutput(tr("Creating tarball..."), OutputFormat::NormalMessage); + emit addOutput(Tr::tr("Creating tarball..."), OutputFormat::NormalMessage); if (!d->m_packagingNeeded) { - emit addOutput(tr("Tarball up to date, skipping packaging."), OutputFormat::NormalMessage); + emit addOutput(Tr::tr("Tarball up to date, skipping packaging."), OutputFormat::NormalMessage); return true; } @@ -276,14 +277,14 @@ bool TarPackageCreationStep::doPackage() QFile tarFile(tarFilePath.toString()); if (!tarFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - raiseError(tr("Error: tar file %1 cannot be opened (%2).") + raiseError(Tr::tr("Error: tar file %1 cannot be opened (%2).") .arg(tarFilePath.toUserOutput(), tarFile.errorString())); return false; } for (const DeployableFile &d : qAsConst(d->m_files)) { if (d.remoteDirectory().isEmpty()) { - emit addOutput(tr("No remote path specified for file \"%1\", skipping.") + emit addOutput(Tr::tr("No remote path specified for file \"%1\", skipping.") .arg(d.localFilePath().toUserOutput()), OutputFormat::ErrorMessage); continue; } @@ -296,7 +297,7 @@ bool TarPackageCreationStep::doPackage() const QByteArray eofIndicator(2*sizeof(TarFileHeader), 0); if (tarFile.write(eofIndicator) != eofIndicator.length()) { - raiseError(tr("Error writing tar file \"%1\": %2.") + raiseError(Tr::tr("Error writing tar file \"%1\": %2.") .arg(QDir::toNativeSeparators(tarFile.fileName()), tarFile.errorString())); return false; } @@ -330,8 +331,8 @@ static bool writeHeader(QFile &tarFile, const QFileInfo &fileInfo, const QString TarFileHeader header; std::memset(&header, '\0', sizeof header); if (!setFilePath(header, remoteFilePath.toUtf8())) { - *errorMessage = QCoreApplication::translate("RemoteLinux::TarPackageCreationStep", - "Cannot add file \"%1\" to tar-archive: path too long.").arg(remoteFilePath); + *errorMessage = Tr::tr("Cannot add file \"%1\" to tar-archive: path too long.") + .arg(remoteFilePath); return false; } int permissions = (0400 * fileInfo.permission(QFile::ReadOwner)) @@ -376,8 +377,8 @@ static bool writeHeader(QFile &tarFile, const QFileInfo &fileInfo, const QString std::memcpy(&header.chksum, checksumString.data(), checksumString.length()); header.chksum[sizeof header.chksum-1] = 0; if (!tarFile.write(reinterpret_cast<char *>(&header), sizeof header)) { - *errorMessage = QCoreApplication::translate("RemoteLinux::TarPackageCreationStep", - "Error writing tar file \"%1\": %2").arg(cachedPackageFilePath, tarFile.errorString()); + *errorMessage = Tr::tr("Error writing tar file \"%1\": %2") + .arg(cachedPackageFilePath, tarFile.errorString()); return false; } return true; @@ -407,7 +408,7 @@ bool TarPackageCreationStep::appendFile(QFile &tarFile, const QFileInfo &fileInf const QString nativePath = QDir::toNativeSeparators(fileInfo.filePath()); QFile file(fileInfo.filePath()); if (!file.open(QIODevice::ReadOnly)) { - const QString message = tr("Error reading file \"%1\": %2.") + const QString message = Tr::tr("Error reading file \"%1\": %2.") .arg(nativePath, file.errorString()); if (d->m_ignoreMissingFilesAspect->value()) { raiseWarning(message); @@ -420,7 +421,7 @@ bool TarPackageCreationStep::appendFile(QFile &tarFile, const QFileInfo &fileInf const int chunkSize = 1024*1024; - emit addOutput(tr("Adding file \"%1\" to tarball...").arg(nativePath), + emit addOutput(Tr::tr("Adding file \"%1\" to tarball...").arg(nativePath), OutputFormat::NormalMessage); // TODO: Wasteful. Work with fixed-size buffer. @@ -431,7 +432,7 @@ bool TarPackageCreationStep::appendFile(QFile &tarFile, const QFileInfo &fileInf return false; } if (file.error() != QFile::NoError) { - raiseError(tr("Error reading file \"%1\": %2.").arg(nativePath, file.errorString())); + raiseError(Tr::tr("Error reading file \"%1\": %2.").arg(nativePath, file.errorString())); return false; } @@ -440,7 +441,7 @@ bool TarPackageCreationStep::appendFile(QFile &tarFile, const QFileInfo &fileInf tarFile.write(QByteArray(TarBlockSize - blockModulo, 0)); if (tarFile.error() != QFile::NoError) { - raiseError(tr("Error writing tar file \"%1\": %2.") + raiseError(Tr::tr("Error writing tar file \"%1\": %2.") .arg(QDir::toNativeSeparators(tarFile.fileName()), tarFile.errorString())); return false; } diff --git a/src/plugins/remotelinux/tarpackagedeploystep.cpp b/src/plugins/remotelinux/tarpackagedeploystep.cpp index 83732a071b..8dc325e512 100644 --- a/src/plugins/remotelinux/tarpackagedeploystep.cpp +++ b/src/plugins/remotelinux/tarpackagedeploystep.cpp @@ -28,6 +28,7 @@ #include "abstractremotelinuxdeployservice.h" #include "abstractremotelinuxdeploystep.h" #include "remotelinux_constants.h" +#include "remotelinuxtr.h" #include "tarpackagecreationstep.h" #include <projectexplorer/deployconfiguration.h> @@ -79,7 +80,7 @@ TarPackageInstaller::TarPackageInstaller() }); connect(&m_installer, &QtcProcess::done, this, [this] { const QString errorMessage = m_installer.result() == ProcessResult::FinishedWithSuccess - ? QString() : tr("Installing package failed.") + m_installer.errorString(); + ? QString() : Tr::tr("Installing package failed.") + m_installer.errorString(); emit finished(errorMessage); }); } @@ -198,10 +199,10 @@ void TarPackageDeployService::handleUploadFinished(const ProcessResultData &resu return; } - emit progressMessage(tr("Successfully uploaded package file.")); + emit progressMessage(Tr::tr("Successfully uploaded package file.")); const QString remoteFilePath = uploadDir() + '/' + m_packageFilePath.fileName(); m_state = Installing; - emit progressMessage(tr("Installing package to device...")); + emit progressMessage(Tr::tr("Installing package to device...")); connect(&m_installer, &TarPackageInstaller::stdoutData, this, &AbstractRemoteLinuxDeployService::stdOutData); connect(&m_installer, &TarPackageInstaller::stderrData, @@ -217,7 +218,7 @@ void TarPackageDeployService::handleInstallationFinished(const QString &errorMsg if (errorMsg.isEmpty()) { saveDeploymentTimeStamp(DeployableFile(m_packageFilePath, {}), {}); - emit progressMessage(tr("Package installed.")); + emit progressMessage(Tr::tr("Package installed.")); } else { emit errorMessage(errorMsg); } @@ -236,8 +237,6 @@ void TarPackageDeployService::setFinished() class TarPackageDeployStep : public AbstractRemoteLinuxDeployStep { - Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::TarPackageDeployStep) - public: TarPackageDeployStep(BuildStepList *bsl, Id id) : AbstractRemoteLinuxDeployStep(bsl, id) @@ -256,7 +255,7 @@ public: break; } if (!pStep) - return CheckResult::failure(tr("No tarball creation step found.")); + return CheckResult::failure(Tr::tr("No tarball creation step found.")); service->setPackageFilePath(pStep->packageFilePath()); return service->isDeploymentPossible(); @@ -270,7 +269,7 @@ public: TarPackageDeployStepFactory::TarPackageDeployStepFactory() { registerStep<TarPackageDeployStep>(Constants::TarPackageDeployStepId); - setDisplayName(TarPackageDeployStep::tr("Deploy tarball via SFTP upload")); + setDisplayName(Tr::tr("Deploy tarball via SFTP upload")); setSupportedConfiguration(RemoteLinux::Constants::DeployToGenericLinux); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); } diff --git a/src/plugins/remotelinux/x11forwardingaspect.cpp b/src/plugins/remotelinux/x11forwardingaspect.cpp index 952170a822..efeb86c683 100644 --- a/src/plugins/remotelinux/x11forwardingaspect.cpp +++ b/src/plugins/remotelinux/x11forwardingaspect.cpp @@ -25,6 +25,8 @@ #include "x11forwardingaspect.h" +#include "remotelinuxtr.h" + #include <utils/macroexpander.h> #include <utils/qtcassert.h> @@ -37,11 +39,11 @@ static QString defaultDisplay() { return qEnvironmentVariable("DISPLAY"); } X11ForwardingAspect::X11ForwardingAspect(const MacroExpander *expander) : m_macroExpander(expander) { - setLabelText(tr("X11 Forwarding:")); + setLabelText(Tr::tr("X11 Forwarding:")); setDisplayStyle(LineEditDisplay); setId("X11ForwardingAspect"); setSettingsKey("RunConfiguration.X11Forwarding"); - makeCheckable(CheckBoxPlacement::Right, tr("Forward to local display"), + makeCheckable(CheckBoxPlacement::Right, Tr::tr("Forward to local display"), "RunConfiguration.UseX11Forwarding"); setValue(defaultDisplay()); |