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

View File

@@ -79,43 +79,44 @@ static QString modeOption(TerminalMode m)
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()
{
// 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)
{
return TerminalImpl::tr("Cannot create temporary file: %1").arg(why);
return QtcProcess::tr("Cannot create temporary file: %1").arg(why);
}
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)
{
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)
{
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)
{
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)
{
return TerminalImpl::tr("Cannot execute \"%1\": %2").arg(p, why);
return QtcProcess::tr("Cannot execute \"%1\": %2").arg(p, why);
}
class TerminalProcessPrivate
@@ -310,7 +311,7 @@ void TerminalImpl::start()
if (!success) {
delete d->m_pid;
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()));
cleanupAfterStartFailure(msg);
return;
@@ -335,12 +336,13 @@ void TerminalImpl::start()
pcmd = m_setup.m_commandLine.executable().toString();
} else {
if (perr != ProcessArgs::FoundMeta) {
emitError(QProcess::FailedToStart, tr("Quoting error in command."));
emitError(QProcess::FailedToStart, QtcProcess::tr("Quoting error in command."));
return;
}
if (m_setup.m_terminalMode == TerminalMode::Debug) {
// 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."));
return;
}
@@ -358,9 +360,10 @@ void TerminalImpl::start()
&m_setup.m_environment,
&m_setup.m_workingDirectory);
if (qerr != ProcessArgs::SplitOk) {
emitError(QProcess::FailedToStart, qerr == ProcessArgs::BadQuoting
? tr("Quoting error in terminal command.")
: tr("Terminal command may not be a shell command."));
emitError(QProcess::FailedToStart,
qerr == ProcessArgs::BadQuoting
? QtcProcess::tr("Quoting error in terminal command.")
: QtcProcess::tr("Terminal command may not be a shell command."));
return;
}
@@ -414,8 +417,10 @@ void TerminalImpl::start()
d->m_process.setReaperTimeout(m_setup.m_reaperTimeout);
d->m_process.start();
if (!d->m_process.waitForStarted()) {
const QString msg = tr("Cannot start the terminal emulator \"%1\", change the setting in the "
"Environment options.").arg(terminal.command);
const QString msg
= QtcProcess::tr("Cannot start the terminal emulator \"%1\", change the setting in the "
"Environment options.")
.arg(terminal.command);
cleanupAfterStartFailure(msg);
return;
}
@@ -542,7 +547,8 @@ QString TerminalImpl::stubServerListen()
const QString stubServer = stubFifoDir + QLatin1String("/stub-socket");
if (!d->m_stubServer.listen(stubServer)) {
::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();
#endif
@@ -613,7 +619,8 @@ void TerminalImpl::readStubOutput()
SYNCHRONIZE | PROCESS_QUERY_INFORMATION | PROCESS_TERMINATE,
FALSE, d->m_processId);
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())));
// Uhm, and now what?
continue;
@@ -623,7 +630,8 @@ void TerminalImpl::readStubOutput()
DWORD 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())));
cleanupInferior();
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);
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());
BuildSystem::appendBuildSystemOutput(msg + '\n');
emit finished();
@@ -90,9 +91,11 @@ void CMakeProcess::run(const BuildDirParameters &parameters, const QStringList &
if (buildDirectory.needsDevice()) {
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.")
.arg(cmake->cmakeExecutable().toUserOutput(), buildDirectory.toUserOutput());
.arg(cmake->cmakeExecutable().toUserOutput(),
buildDirectory.toUserOutput());
BuildSystem::appendBuildSystemOutput(msg + '\n');
emit finished();
return;
@@ -131,12 +134,15 @@ void CMakeProcess::run(const BuildDirParameters &parameters, const QStringList &
TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
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.setProgressRange(0, 1);
Core::ProgressManager::addTimedTask(m_futureInterface,
tr("Configuring \"%1\"").arg(parameters.projectName),
::CMakeProjectManager::Internal::CMakeProcess::tr(
"Configuring \"%1\"")
.arg(parameters.projectName),
"CMake.Configure",
10);
m_futureWatcher.reset(new QFutureWatcher<void>);
@@ -167,14 +173,17 @@ void CMakeProcess::handleProcessDone(const Utils::ProcessResultData &resultData)
QString msg;
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) {
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
msg = tr("CMake process crashed.");
msg = ::CMakeProjectManager::Internal::CMakeProcess::tr("CMake process crashed.");
} 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;

View File

@@ -109,7 +109,8 @@ static std::vector<std::unique_ptr<CMakeTool>> autoDetectCMakeTools()
for (const FilePath &command : qAsConst(suspects)) {
auto item = std::make_unique<CMakeTool>(CMakeTool::AutoDetection, CMakeTool::createId());
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));
}

View File

@@ -84,7 +84,7 @@ CppcheckTextMark::CppcheckTextMark (const Diagnostic &diagnostic)
// Copy to clipboard action
QAction *action = new QAction();
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]() {
const QString text = QString("%1:%2: %3")
.arg(diagnostic.fileName.toUserOutput())

View File

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

View File

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

View File

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

View File

@@ -1553,13 +1553,15 @@ private:
{
const FilePath sftpBinary = SshSettings::sftpFilePath();
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;
}
m_batchFile.reset(new QTemporaryFile(this));
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;
}
@@ -1570,7 +1572,7 @@ private:
+ '\n');
} else if (direction() == FileTransferDirection::Download) {
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())));
return;
}

View File

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