Fix lupdate issues

Change-Id: I7256c8aff5eb77b264b76ba24e79c26ab2924e84
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Eike Ziller
2022-06-24 13:19:04 +02:00
parent 67f98c0c83
commit 92c74abbf1
10 changed files with 79 additions and 57 deletions

View File

@@ -285,8 +285,10 @@ bool DefaultImpl::dissolveCommand(QString *program, QStringList *arguments)
*arguments = QStringList(); *arguments = QStringList();
} else { } else {
if (!success) { if (!success) {
const ProcessResultData result = { 0, QProcess::NormalExit, QProcess::FailedToStart, const ProcessResultData result = {0,
tr("Error in command line.") }; QProcess::NormalExit,
QProcess::FailedToStart,
QtcProcess::tr("Error in command line.")};
emit done(result); emit done(result);
return false; return false;
} }
@@ -314,8 +316,8 @@ bool DefaultImpl::ensureProgramExists(const QString &program)
if (programFilePath.exists() && programFilePath.isExecutableFile()) if (programFilePath.exists() && programFilePath.isExecutableFile())
return true; return true;
const QString errorString = tr("The program \"%1\" does not exist or is not executable.") const QString errorString
.arg(program); = QtcProcess::tr("The program \"%1\" does not exist or is not executable.").arg(program);
const ProcessResultData result = { 0, QProcess::NormalExit, QProcess::FailedToStart, const ProcessResultData result = { 0, QProcess::NormalExit, QProcess::FailedToStart,
errorString }; errorString };
emit done(result); emit done(result);

View File

@@ -79,43 +79,44 @@ static QString modeOption(TerminalMode m)
static QString msgCommChannelFailed(const QString &error) static QString msgCommChannelFailed(const QString &error)
{ {
return TerminalImpl::tr("Cannot set up communication channel: %1").arg(error); return QtcProcess::tr("Cannot set up communication channel: %1").arg(error);
} }
static QString msgPromptToClose() static QString msgPromptToClose()
{ {
// Shown in a terminal which might have a different character set on Windows. // Shown in a terminal which might have a different character set on Windows.
return TerminalImpl::tr("Press <RETURN> to close this window..."); return QtcProcess::tr("Press <RETURN> to close this window...");
} }
static QString msgCannotCreateTempFile(const QString &why) static QString msgCannotCreateTempFile(const QString &why)
{ {
return TerminalImpl::tr("Cannot create temporary file: %1").arg(why); return QtcProcess::tr("Cannot create temporary file: %1").arg(why);
} }
static QString msgCannotWriteTempFile() static QString msgCannotWriteTempFile()
{ {
return TerminalImpl::tr("Cannot write temporary file. Disk full?"); return QtcProcess::tr("Cannot write temporary file. Disk full?");
} }
static QString msgCannotCreateTempDir(const QString & dir, const QString &why) static QString msgCannotCreateTempDir(const QString & dir, const QString &why)
{ {
return TerminalImpl::tr("Cannot create temporary directory \"%1\": %2").arg(dir, why); return QtcProcess::tr("Cannot create temporary directory \"%1\": %2").arg(dir, why);
} }
static QString msgUnexpectedOutput(const QByteArray &what) static QString msgUnexpectedOutput(const QByteArray &what)
{ {
return TerminalImpl::tr("Unexpected output from helper program (%1).").arg(QString::fromLatin1(what)); return QtcProcess::tr("Unexpected output from helper program (%1).")
.arg(QString::fromLatin1(what));
} }
static QString msgCannotChangeToWorkDir(const FilePath &dir, const QString &why) static QString msgCannotChangeToWorkDir(const FilePath &dir, const QString &why)
{ {
return TerminalImpl::tr("Cannot change to working directory \"%1\": %2").arg(dir.toString(), why); return QtcProcess::tr("Cannot change to working directory \"%1\": %2").arg(dir.toString(), why);
} }
static QString msgCannotExecute(const QString & p, const QString &why) static QString msgCannotExecute(const QString & p, const QString &why)
{ {
return TerminalImpl::tr("Cannot execute \"%1\": %2").arg(p, why); return QtcProcess::tr("Cannot execute \"%1\": %2").arg(p, why);
} }
class TerminalProcessPrivate class TerminalProcessPrivate
@@ -310,7 +311,7 @@ void TerminalImpl::start()
if (!success) { if (!success) {
delete d->m_pid; delete d->m_pid;
d->m_pid = nullptr; d->m_pid = nullptr;
const QString msg = tr("The process \"%1\" could not be started: %2") const QString msg = QtcProcess::tr("The process \"%1\" could not be started: %2")
.arg(cmdLine, winErrorMessage(GetLastError())); .arg(cmdLine, winErrorMessage(GetLastError()));
cleanupAfterStartFailure(msg); cleanupAfterStartFailure(msg);
return; return;
@@ -335,12 +336,13 @@ void TerminalImpl::start()
pcmd = m_setup.m_commandLine.executable().toString(); pcmd = m_setup.m_commandLine.executable().toString();
} else { } else {
if (perr != ProcessArgs::FoundMeta) { if (perr != ProcessArgs::FoundMeta) {
emitError(QProcess::FailedToStart, tr("Quoting error in command.")); emitError(QProcess::FailedToStart, QtcProcess::tr("Quoting error in command."));
return; return;
} }
if (m_setup.m_terminalMode == TerminalMode::Debug) { if (m_setup.m_terminalMode == TerminalMode::Debug) {
// FIXME: QTCREATORBUG-2809 // FIXME: QTCREATORBUG-2809
emitError(QProcess::FailedToStart, tr("Debugging complex shell commands in a terminal" emitError(QProcess::FailedToStart,
QtcProcess::tr("Debugging complex shell commands in a terminal"
" is currently not supported.")); " is currently not supported."));
return; return;
} }
@@ -358,9 +360,10 @@ void TerminalImpl::start()
&m_setup.m_environment, &m_setup.m_environment,
&m_setup.m_workingDirectory); &m_setup.m_workingDirectory);
if (qerr != ProcessArgs::SplitOk) { if (qerr != ProcessArgs::SplitOk) {
emitError(QProcess::FailedToStart, qerr == ProcessArgs::BadQuoting emitError(QProcess::FailedToStart,
? tr("Quoting error in terminal command.") qerr == ProcessArgs::BadQuoting
: tr("Terminal command may not be a shell command.")); ? QtcProcess::tr("Quoting error in terminal command.")
: QtcProcess::tr("Terminal command may not be a shell command."));
return; return;
} }
@@ -414,8 +417,10 @@ void TerminalImpl::start()
d->m_process.setReaperTimeout(m_setup.m_reaperTimeout); d->m_process.setReaperTimeout(m_setup.m_reaperTimeout);
d->m_process.start(); d->m_process.start();
if (!d->m_process.waitForStarted()) { if (!d->m_process.waitForStarted()) {
const QString msg = tr("Cannot start the terminal emulator \"%1\", change the setting in the " const QString msg
"Environment options.").arg(terminal.command); = QtcProcess::tr("Cannot start the terminal emulator \"%1\", change the setting in the "
"Environment options.")
.arg(terminal.command);
cleanupAfterStartFailure(msg); cleanupAfterStartFailure(msg);
return; return;
} }
@@ -542,7 +547,8 @@ QString TerminalImpl::stubServerListen()
const QString stubServer = stubFifoDir + QLatin1String("/stub-socket"); const QString stubServer = stubFifoDir + QLatin1String("/stub-socket");
if (!d->m_stubServer.listen(stubServer)) { if (!d->m_stubServer.listen(stubServer)) {
::rmdir(d->m_stubServerDir.constData()); ::rmdir(d->m_stubServerDir.constData());
return tr("Cannot create socket \"%1\": %2").arg(stubServer, d->m_stubServer.errorString()); return QtcProcess::tr("Cannot create socket \"%1\": %2")
.arg(stubServer, d->m_stubServer.errorString());
} }
return QString(); return QString();
#endif #endif
@@ -613,7 +619,8 @@ void TerminalImpl::readStubOutput()
SYNCHRONIZE | PROCESS_QUERY_INFORMATION | PROCESS_TERMINATE, SYNCHRONIZE | PROCESS_QUERY_INFORMATION | PROCESS_TERMINATE,
FALSE, d->m_processId); FALSE, d->m_processId);
if (d->m_hInferior == NULL) { if (d->m_hInferior == NULL) {
emitError(QProcess::FailedToStart, tr("Cannot obtain a handle to the inferior: %1") emitError(QProcess::FailedToStart,
QtcProcess::tr("Cannot obtain a handle to the inferior: %1")
.arg(winErrorMessage(GetLastError()))); .arg(winErrorMessage(GetLastError())));
// Uhm, and now what? // Uhm, and now what?
continue; continue;
@@ -623,7 +630,8 @@ void TerminalImpl::readStubOutput()
DWORD chldStatus; DWORD chldStatus;
if (!GetExitCodeProcess(d->m_hInferior, &chldStatus)) if (!GetExitCodeProcess(d->m_hInferior, &chldStatus))
emitError(QProcess::UnknownError, tr("Cannot obtain exit status from inferior: %1") emitError(QProcess::UnknownError,
QtcProcess::tr("Cannot obtain exit status from inferior: %1")
.arg(winErrorMessage(GetLastError()))); .arg(winErrorMessage(GetLastError())));
cleanupInferior(); cleanupInferior();
emitFinished(chldStatus, QProcess::NormalExit); emitFinished(chldStatus, QProcess::NormalExit);

View File

@@ -81,7 +81,8 @@ void CMakeProcess::run(const BuildDirParameters &parameters, const QStringList &
const FilePath buildDirectory = parameters.buildDirectory.onDevice(cmakeExecutable); const FilePath buildDirectory = parameters.buildDirectory.onDevice(cmakeExecutable);
if (!buildDirectory.exists()) { if (!buildDirectory.exists()) {
QString msg = tr("The build directory \"%1\" does not exist") QString msg = ::CMakeProjectManager::Internal::CMakeProcess::tr(
"The build directory \"%1\" does not exist")
.arg(buildDirectory.toUserOutput()); .arg(buildDirectory.toUserOutput());
BuildSystem::appendBuildSystemOutput(msg + '\n'); BuildSystem::appendBuildSystemOutput(msg + '\n');
emit finished(); emit finished();
@@ -90,9 +91,11 @@ void CMakeProcess::run(const BuildDirParameters &parameters, const QStringList &
if (buildDirectory.needsDevice()) { if (buildDirectory.needsDevice()) {
if (cmake->cmakeExecutable().host() != buildDirectory.host()) { if (cmake->cmakeExecutable().host() != buildDirectory.host()) {
QString msg = tr("CMake executable \"%1\" and build directory " QString msg = ::CMakeProjectManager::Internal::CMakeProcess::tr(
"CMake executable \"%1\" and build directory "
"\"%2\" must be on the same device.") "\"%2\" must be on the same device.")
.arg(cmake->cmakeExecutable().toUserOutput(), buildDirectory.toUserOutput()); .arg(cmake->cmakeExecutable().toUserOutput(),
buildDirectory.toUserOutput());
BuildSystem::appendBuildSystemOutput(msg + '\n'); BuildSystem::appendBuildSystemOutput(msg + '\n');
emit finished(); emit finished();
return; return;
@@ -131,12 +134,15 @@ void CMakeProcess::run(const BuildDirParameters &parameters, const QStringList &
TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM); TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
BuildSystem::startNewBuildSystemOutput( BuildSystem::startNewBuildSystemOutput(
tr("Running %1 in %2.").arg(commandLine.toUserOutput(), buildDirectory.toUserOutput())); ::CMakeProjectManager::Internal::CMakeProcess::tr("Running %1 in %2.")
.arg(commandLine.toUserOutput(), buildDirectory.toUserOutput()));
m_futureInterface = QFutureInterface<void>(); m_futureInterface = QFutureInterface<void>();
m_futureInterface.setProgressRange(0, 1); m_futureInterface.setProgressRange(0, 1);
Core::ProgressManager::addTimedTask(m_futureInterface, Core::ProgressManager::addTimedTask(m_futureInterface,
tr("Configuring \"%1\"").arg(parameters.projectName), ::CMakeProjectManager::Internal::CMakeProcess::tr(
"Configuring \"%1\"")
.arg(parameters.projectName),
"CMake.Configure", "CMake.Configure",
10); 10);
m_futureWatcher.reset(new QFutureWatcher<void>); m_futureWatcher.reset(new QFutureWatcher<void>);
@@ -167,14 +173,17 @@ void CMakeProcess::handleProcessDone(const Utils::ProcessResultData &resultData)
QString msg; QString msg;
if (resultData.m_error == QProcess::FailedToStart) { if (resultData.m_error == QProcess::FailedToStart) {
msg = tr("CMake process failed to start."); msg = ::CMakeProjectManager::Internal::CMakeProcess::tr("CMake process failed to start.");
} else if (resultData.m_exitStatus != QProcess::NormalExit) { } else if (resultData.m_exitStatus != QProcess::NormalExit) {
if (m_futureInterface.isCanceled() || code == USER_STOP_EXIT_CODE) if (m_futureInterface.isCanceled() || code == USER_STOP_EXIT_CODE)
msg = tr("CMake process was canceled by the user."); msg = ::CMakeProjectManager::Internal::CMakeProcess::tr(
"CMake process was canceled by the user.");
else else
msg = tr("CMake process crashed."); msg = ::CMakeProjectManager::Internal::CMakeProcess::tr("CMake process crashed.");
} else if (code != 0) { } else if (code != 0) {
msg = tr("CMake process exited with exit code %1.").arg(code); msg = ::CMakeProjectManager::Internal::CMakeProcess::tr(
"CMake process exited with exit code %1.")
.arg(code);
} }
m_lastExitCode = code; m_lastExitCode = code;

View File

@@ -109,7 +109,8 @@ static std::vector<std::unique_ptr<CMakeTool>> autoDetectCMakeTools()
for (const FilePath &command : qAsConst(suspects)) { for (const FilePath &command : qAsConst(suspects)) {
auto item = std::make_unique<CMakeTool>(CMakeTool::AutoDetection, CMakeTool::createId()); auto item = std::make_unique<CMakeTool>(CMakeTool::AutoDetection, CMakeTool::createId());
item->setFilePath(command); item->setFilePath(command);
item->setDisplayName(CMakeToolManager::tr("System CMake at %1").arg(command.toUserOutput())); item->setDisplayName(::CMakeProjectManager::CMakeToolManager::tr("System CMake at %1")
.arg(command.toUserOutput()));
found.emplace_back(std::move(item)); found.emplace_back(std::move(item));
} }

View File

@@ -84,7 +84,7 @@ CppcheckTextMark::CppcheckTextMark (const Diagnostic &diagnostic)
// Copy to clipboard action // Copy to clipboard action
QAction *action = new QAction(); QAction *action = new QAction();
action->setIcon(QIcon::fromTheme("edit-copy", Utils::Icons::COPY.icon())); action->setIcon(QIcon::fromTheme("edit-copy", Utils::Icons::COPY.icon()));
action->setToolTip(tr("Copy to Clipboard")); action->setToolTip(TextMark::tr("Copy to Clipboard"));
QObject::connect(action, &QAction::triggered, [diagnostic]() { QObject::connect(action, &QAction::triggered, [diagnostic]() {
const QString text = QString("%1:%2: %3") const QString text = QString("%1:%2: %3")
.arg(diagnostic.fileName.toUserOutput()) .arg(diagnostic.fileName.toUserOutput())

View File

@@ -64,27 +64,27 @@ GitLabServerWidget::GitLabServerWidget(Mode m, QWidget *parent)
: QWidget(parent) : QWidget(parent)
, m_mode(m) , m_mode(m)
{ {
m_host.setLabelText(tr("Host:")); m_host.setLabelText(GitLabOptionsPage::tr("Host:"));
m_host.setDisplayStyle(m == Display ? Utils::StringAspect::LabelDisplay m_host.setDisplayStyle(m == Display ? Utils::StringAspect::LabelDisplay
: Utils::StringAspect::LineEditDisplay); : Utils::StringAspect::LineEditDisplay);
m_host.setValidationFunction([](Utils::FancyLineEdit *l, QString *) { m_host.setValidationFunction([](Utils::FancyLineEdit *l, QString *) {
return hostValid(l->text()); return hostValid(l->text());
}); });
m_description.setLabelText(tr("Description:")); m_description.setLabelText(GitLabOptionsPage::tr("Description:"));
m_description.setDisplayStyle(m == Display ? Utils::StringAspect::LabelDisplay m_description.setDisplayStyle(m == Display ? Utils::StringAspect::LabelDisplay
: Utils::StringAspect::LineEditDisplay); : Utils::StringAspect::LineEditDisplay);
m_token.setLabelText(tr("Access token:")); m_token.setLabelText(GitLabOptionsPage::tr("Access token:"));
m_token.setDisplayStyle(m == Display ? Utils::StringAspect::LabelDisplay m_token.setDisplayStyle(m == Display ? Utils::StringAspect::LabelDisplay
: Utils::StringAspect::LineEditDisplay); : Utils::StringAspect::LineEditDisplay);
m_token.setVisible(m == Edit); m_token.setVisible(m == Edit);
m_port.setRange(1, 65535); m_port.setRange(1, 65535);
m_port.setValue(GitLabServer::defaultPort); m_port.setValue(GitLabServer::defaultPort);
auto portLabel = new QLabel(tr("Port:"), this); auto portLabel = new QLabel(GitLabOptionsPage::tr("Port:"), this);
m_port.setEnabled(m == Edit); m_port.setEnabled(m == Edit);
m_secure.setLabelText(tr("HTTPS:")); m_secure.setLabelText(GitLabOptionsPage::tr("HTTPS:"));
m_secure.setLabelPlacement(Utils::BoolAspect::LabelPlacement::InExtraLabel); m_secure.setLabelPlacement(Utils::BoolAspect::LabelPlacement::InExtraLabel);
m_secure.setDefaultValue(true); m_secure.setDefaultValue(true);
m_secure.setEnabled(m == Edit); m_secure.setEnabled(m == Edit);

View File

@@ -105,7 +105,7 @@ void PySideBuildStep::doRun()
PySideBuildConfiguration::PySideBuildConfiguration(Target *target, Id id) PySideBuildConfiguration::PySideBuildConfiguration(Target *target, Id id)
: BuildConfiguration(target, id) : BuildConfiguration(target, id)
{ {
setConfigWidgetDisplayName(tr("General")); setConfigWidgetDisplayName(PySideBuildConfigurationFactory::tr("General"));
setInitializer([this](const BuildInfo &) { setInitializer([this](const BuildInfo &) {
buildSteps()->appendStep(pySideBuildStep); buildSteps()->appendStep(pySideBuildStep);

View File

@@ -400,8 +400,8 @@ public:
PyLSConfigureWidget() PyLSConfigureWidget()
: m_editor(LanguageClient::jsonEditor()) : m_editor(LanguageClient::jsonEditor())
, m_advancedLabel(new QLabel) , m_advancedLabel(new QLabel)
, m_pluginsGroup(new QGroupBox(tr("Plugins:"))) , m_pluginsGroup(new QGroupBox(PythonSettings::tr("Plugins:")))
, m_mainGroup(new QGroupBox(tr("Use Python Language Server"))) , m_mainGroup(new QGroupBox(PythonSettings::tr("Use Python Language Server")))
{ {
m_mainGroup->setCheckable(true); m_mainGroup->setCheckable(true);
@@ -422,7 +422,7 @@ public:
mainGroupLayout->addWidget(m_pluginsGroup); mainGroupLayout->addWidget(m_pluginsGroup);
const QString labelText = tr( const QString labelText = PythonSettings::tr(
"For a complete list of avilable options, consult the <a " "For a complete list of avilable options, consult the <a "
"href=\"https://github.com/python-lsp/python-lsp-server/blob/develop/" "href=\"https://github.com/python-lsp/python-lsp-server/blob/develop/"
"CONFIGURATION.md\">Python LSP Server configuration documentation</a>."); "CONFIGURATION.md\">Python LSP Server configuration documentation</a>.");
@@ -436,7 +436,7 @@ public:
mainGroupLayout->addStretch(); mainGroupLayout->addStretch();
auto advanced = new QCheckBox(tr("Advanced")); auto advanced = new QCheckBox(PythonSettings::tr("Advanced"));
advanced->setChecked(false); advanced->setChecked(false);
connect(advanced, connect(advanced,

View File

@@ -1553,13 +1553,15 @@ private:
{ {
const FilePath sftpBinary = SshSettings::sftpFilePath(); const FilePath sftpBinary = SshSettings::sftpFilePath();
if (!sftpBinary.exists()) { if (!sftpBinary.exists()) {
startFailed(tr("\"sftp\" binary \"%1\" does not exist.").arg(sftpBinary.toUserOutput())); startFailed(SshTransferInterface::tr("\"sftp\" binary \"%1\" does not exist.")
.arg(sftpBinary.toUserOutput()));
return; return;
} }
m_batchFile.reset(new QTemporaryFile(this)); m_batchFile.reset(new QTemporaryFile(this));
if (!m_batchFile->isOpen() && !m_batchFile->open()) { if (!m_batchFile->isOpen() && !m_batchFile->open()) {
startFailed(tr("Could not create temporary file: %1").arg(m_batchFile->errorString())); startFailed(SshTransferInterface::tr("Could not create temporary file: %1")
.arg(m_batchFile->errorString()));
return; return;
} }
@@ -1570,7 +1572,7 @@ private:
+ '\n'); + '\n');
} else if (direction() == FileTransferDirection::Download) { } else if (direction() == FileTransferDirection::Download) {
if (!QDir::root().mkpath(dir.path())) { if (!QDir::root().mkpath(dir.path())) {
startFailed(tr("Failed to create local directory \"%1\".") startFailed(SshTransferInterface::tr("Failed to create local directory \"%1\".")
.arg(QDir::toNativeSeparators(dir.path()))); .arg(QDir::toNativeSeparators(dir.path())));
return; return;
} }

View File

@@ -34,8 +34,8 @@ constexpr int NameRole = Qt::UserRole;
constexpr int ScreenSizeRole = Qt::UserRole + 1; constexpr int ScreenSizeRole = Qt::UserRole + 1;
constexpr int IsUserPresetRole = Qt::UserRole + 2; constexpr int IsUserPresetRole = Qt::UserRole + 2;
static const QString RecentsTabName = QObject::tr("Recents"); static const QString RecentsTabName = ::StudioWelcome::PresetModel::tr("Recents");
static const QString CustomTabName = QObject::tr("Custom"); static const QString CustomTabName = ::StudioWelcome::PresetModel::tr("Custom");
/****************** PresetData ******************/ /****************** PresetData ******************/