@@ -128,13 +129,13 @@ SubmitEditorWidget::SubmitEditorWidget() :
{
resize(507, 419);
setMinimumSize(QSize(0, 0));
- setWindowTitle(tr("Subversion Submit"));
+ setWindowTitle(Tr::tr("Subversion Submit"));
auto scrollAreaWidgetContents = new QWidget();
scrollAreaWidgetContents->setGeometry(QRect(0, 0, 505, 417));
scrollAreaWidgetContents->setMinimumSize(QSize(400, 400));
- d->descriptionBox = new QGroupBox(tr("Descriptio&n"));
+ d->descriptionBox = new QGroupBox(Tr::tr("Descriptio&n"));
d->descriptionBox->setObjectName("descriptionBox");
d->descriptionBox->setFlat(true);
@@ -158,11 +159,11 @@ SubmitEditorWidget::SubmitEditorWidget() :
connect(&d->delayedVerifyDescriptionTimer, &QTimer::timeout,
this, &SubmitEditorWidget::verifyDescription);
- auto groupBox = new QGroupBox(tr("F&iles"));
+ auto groupBox = new QGroupBox(Tr::tr("F&iles"));
groupBox->setObjectName("groupBox");
groupBox->setFlat(true);
- d->checkAllCheckBox = new QCheckBox(tr("Select a&ll"));
+ d->checkAllCheckBox = new QCheckBox(Tr::tr("Select a&ll"));
d->checkAllCheckBox->setObjectName("checkAllCheckBox");
d->checkAllCheckBox->setTristate(false);
@@ -187,7 +188,7 @@ SubmitEditorWidget::SubmitEditorWidget() :
d->buttonLayout->setContentsMargins(0, -1, -1, -1);
QToolButton *openSettingsButton = new QToolButton;
openSettingsButton->setIcon(Utils::Icons::SETTINGS.icon());
- openSettingsButton->setToolTip(tr("Open Settings Page..."));
+ openSettingsButton->setToolTip(Tr::tr("Open Settings Page..."));
connect(openSettingsButton, &QToolButton::clicked, this, [] {
Core::ICore::showOptionsDialog(Constants::VCS_COMMON_SETTINGS_ID);
});
@@ -493,7 +494,7 @@ void SubmitEditorWidget::updateSubmitAction()
// Update button text.
const int fileCount = d->fileView->model()->rowCount();
const QString msg = checkedCount ?
- tr("%1 %2/%n File(s)", nullptr, fileCount)
+ Tr::tr("%1 %2/%n File(s)", nullptr, fileCount)
.arg(commitName()).arg(checkedCount) :
commitName();
emit submitActionTextChanged(msg);
@@ -606,28 +607,28 @@ void SubmitEditorWidget::verifyDescription()
enum { MinSubjectLength = 20, MaxSubjectLength = 72, WarningSubjectLength = 55 };
QStringList hints;
if (0 < subjectLength && subjectLength < MinSubjectLength)
- hints.append(warning + tr("Warning: The commit subject is very short."));
+ hints.append(warning + Tr::tr("Warning: The commit subject is very short."));
if (subjectLength > MaxSubjectLength)
- hints.append(warning + tr("Warning: The commit subject is too long."));
+ hints.append(warning + Tr::tr("Warning: The commit subject is too long."));
else if (subjectLength > WarningSubjectLength)
- hints.append(hint + tr("Hint: Aim for a shorter commit subject."));
+ hints.append(hint + Tr::tr("Hint: Aim for a shorter commit subject."));
if (secondLineLength > 0)
- hints.append(hint + tr("Hint: The second line of a commit message should be empty."));
+ hints.append(hint + Tr::tr("Hint: The second line of a commit message should be empty."));
d->descriptionHint->setText(hints.join("
"));
if (!d->descriptionHint->text().isEmpty()) {
d->descriptionHint->setToolTip(
- tr("Writing good commit messages
"
- ""
- "- Avoid very short commit messages.
"
- "- Consider the first line as subject (like in email) "
- "and keep it shorter than %n characters.
"
- "- After an empty second line, a longer description can be added.
"
- "- Describe why the change was done, not how it was done.
"
- "
", nullptr, MaxSubjectLength));
- }
+ Tr::tr("Writing good commit messages
"
+ ""
+ "- Avoid very short commit messages.
"
+ "- Consider the first line as subject (like in email) "
+ "and keep it shorter than %n characters.
"
+ "- After an empty second line, a longer description can be added.
"
+ "- Describe why the change was done, not how it was done.
"
+ "
", nullptr, MaxSubjectLength));
+ }
}
void SubmitEditorWidget::descriptionTextChanged()
@@ -646,18 +647,18 @@ bool SubmitEditorWidget::canSubmit(QString *whyNot) const
{
if (d->m_updateInProgress) {
if (whyNot)
- *whyNot = tr("Update in progress");
+ *whyNot = Tr::tr("Update in progress");
return false;
}
if (isDescriptionMandatory() && d->m_description.trimmed().isEmpty()) {
if (whyNot)
- *whyNot = tr("Description is empty");
+ *whyNot = Tr::tr("Description is empty");
return false;
}
const unsigned checkedCount = checkedFilesCount();
const bool res = d->m_emptyFileListEnabled || checkedCount > 0;
if (!res && whyNot)
- *whyNot = tr("No files checked");
+ *whyNot = Tr::tr("No files checked");
return res;
}
@@ -695,7 +696,7 @@ void SubmitEditorWidget::setSelectedRows(const QList &rows)
QString SubmitEditorWidget::commitName() const
{
- return tr("&Commit");
+ return Tr::tr("&Commit");
}
void SubmitEditorWidget::addSubmitFieldWidget(SubmitFieldWidget *f)
@@ -760,9 +761,9 @@ void SubmitEditorWidget::fileListCustomContextMenuRequested(const QPoint & pos)
// Execute menu offering to check/uncheck all
QMenu menu;
//: Check all for submit
- QAction *checkAllAction = menu.addAction(tr("Select All"));
+ QAction *checkAllAction = menu.addAction(Tr::tr("Select All"));
//: Uncheck all for submit
- QAction *uncheckAllAction = menu.addAction(tr("Unselect All"));
+ QAction *uncheckAllAction = menu.addAction(Tr::tr("Unselect All"));
QAction *action = menu.exec(d->fileView->mapToGlobal(pos));
if (action == checkAllAction) {
fileModel()->setAllChecked(true);;
diff --git a/src/plugins/vcsbase/submitfilemodel.cpp b/src/plugins/vcsbase/submitfilemodel.cpp
index 33812de8daa..4ee4b35f3cf 100644
--- a/src/plugins/vcsbase/submitfilemodel.cpp
+++ b/src/plugins/vcsbase/submitfilemodel.cpp
@@ -3,6 +3,8 @@
#include "submitfilemodel.h"
+#include "vcsbasetr.h"
+
#include
#include
#include
@@ -92,7 +94,7 @@ static QList createFileRow(const FilePath &repositoryRoot,
SubmitFileModel::SubmitFileModel(QObject *parent) :
QStandardItemModel(0, 2, parent)
{
- setHorizontalHeaderLabels({tr("State"), tr("File")});
+ setHorizontalHeaderLabels({Tr::tr("State"), Tr::tr("File")});
}
const FilePath &SubmitFileModel::repositoryRoot() const
diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp
index 8493955cd15..f152e8d549e 100644
--- a/src/plugins/vcsbase/vcsbaseclient.cpp
+++ b/src/plugins/vcsbase/vcsbaseclient.cpp
@@ -2,10 +2,12 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "vcsbaseclient.h"
+
#include "vcsbaseclientsettings.h"
#include "vcsbaseeditor.h"
#include "vcsbaseeditorconfig.h"
#include "vcsbaseplugin.h"
+#include "vcsbasetr.h"
#include "vcscommand.h"
#include "vcsoutputwindow.h"
@@ -79,7 +81,7 @@ VcsCommand *VcsBaseClientImpl::createCommand(const FilePath &workingDirectory,
editor->setCommand(cmd);
connect(cmd, &VcsCommand::done, editor, [editor, cmd] {
if (cmd->result() != ProcessResult::FinishedWithSuccess) {
- editor->textDocument()->setPlainText(tr("Failed to retrieve data."));
+ editor->textDocument()->setPlainText(Tr::tr("Failed to retrieve data."));
return;
}
editor->setPlainText(cmd->cleanedStdOut());
@@ -208,7 +210,7 @@ VcsBaseEditorWidget *VcsBaseClientImpl::createVcsEditor(Id kind, QString title,
{
VcsBaseEditorWidget *baseEditor = nullptr;
IEditor *outputEditor = locateEditor(registerDynamicProperty, dynamicPropertyValue);
- const QString progressMsg = tr("Working...");
+ const QString progressMsg = Tr::tr("Working...");
if (outputEditor) {
// Exists already
outputEditor->document()->setContents(progressMsg.toUtf8());
diff --git a/src/plugins/vcsbase/vcsbaseclientsettings.cpp b/src/plugins/vcsbase/vcsbaseclientsettings.cpp
index 04c185fbbf1..7dfd8b3760b 100644
--- a/src/plugins/vcsbase/vcsbaseclientsettings.cpp
+++ b/src/plugins/vcsbase/vcsbaseclientsettings.cpp
@@ -3,6 +3,8 @@
#include "vcsbaseclientsettings.h"
+#include "vcsbasetr.h"
+
#include
#include
#include
@@ -35,7 +37,7 @@ VcsBaseSettings::VcsBaseSettings()
logCount.setSettingsKey("LogCount");
logCount.setRange(0, 1000 * 1000);
logCount.setDefaultValue(100);
- logCount.setLabelText(tr("Log count:"));
+ logCount.setLabelText(Tr::tr("Log count:"));
registerAspect(&path);
path.setSettingsKey("Path");
@@ -44,8 +46,8 @@ VcsBaseSettings::VcsBaseSettings()
timeout.setSettingsKey("Timeout");
timeout.setRange(0, 3600 * 24 * 365);
timeout.setDefaultValue(30);
- timeout.setLabelText(tr("Timeout:"));
- timeout.setSuffix(tr("s"));
+ timeout.setLabelText(Tr::tr("Timeout:"));
+ timeout.setSuffix(Tr::tr("s"));
}
VcsBaseSettings::~VcsBaseSettings() = default;
diff --git a/src/plugins/vcsbase/vcsbaseclientsettings.h b/src/plugins/vcsbase/vcsbaseclientsettings.h
index 0be6b45057a..87835755ca0 100644
--- a/src/plugins/vcsbase/vcsbaseclientsettings.h
+++ b/src/plugins/vcsbase/vcsbaseclientsettings.h
@@ -11,8 +11,6 @@ namespace VcsBase {
class VCSBASE_EXPORT VcsBaseSettings : public Utils::AspectContainer
{
- Q_DECLARE_TR_FUNCTIONS(VcsBase::VcsBaseSettings)
-
public:
VcsBaseSettings();
~VcsBaseSettings();
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index b22db1236a7..a03b696a529 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -8,6 +8,7 @@
#include "diffandloghighlighter.h"
#include "vcsbaseeditorconfig.h"
#include "vcsbaseplugin.h"
+#include "vcsbasetr.h"
#include "vcscommand.h"
#include
@@ -307,7 +308,7 @@ void ChangeTextCursorHandler::slotCopyRevision()
void ChangeTextCursorHandler::addDescribeAction(QMenu *menu, const QString &change) const
{
- auto a = new QAction(VcsBaseEditorWidget::tr("&Describe Change %1").arg(change), nullptr);
+ auto a = new QAction(Tr::tr("&Describe Change %1").arg(change), nullptr);
connect(a, &QAction::triggered, this, &ChangeTextCursorHandler::slotDescribe);
menu->addAction(a);
menu->setDefaultAction(a);
@@ -330,7 +331,7 @@ QAction *ChangeTextCursorHandler::createAnnotateAction(const QString &change, bo
QAction *ChangeTextCursorHandler::createCopyRevisionAction(const QString &change) const
{
- auto a = new QAction(VcsBaseEditorWidget::tr("Copy \"%1\"").arg(change), nullptr);
+ auto a = new QAction(Tr::tr("Copy \"%1\"").arg(change), nullptr);
a->setData(change);
connect(a, &QAction::triggered, this, &ChangeTextCursorHandler::slotCopyRevision);
return a;
@@ -436,8 +437,8 @@ void UrlTextCursorHandler::fillContextMenu(QMenu *menu, EditorContentType type)
{
Q_UNUSED(type)
menu->addSeparator();
- menu->addAction(createOpenUrlAction(tr("Open URL in Browser...")));
- menu->addAction(createCopyUrlAction(tr("Copy URL Location")));
+ menu->addAction(createOpenUrlAction(Tr::tr("Open URL in Browser...")));
+ menu->addAction(createCopyUrlAction(Tr::tr("Copy URL Location")));
}
QString UrlTextCursorHandler::currentContents() const
@@ -503,8 +504,8 @@ void EmailTextCursorHandler::fillContextMenu(QMenu *menu, EditorContentType type
{
Q_UNUSED(type)
menu->addSeparator();
- menu->addAction(createOpenUrlAction(tr("Send Email To...")));
- menu->addAction(createCopyUrlAction(tr("Copy Email Address")));
+ menu->addAction(createOpenUrlAction(Tr::tr("Send Email To...")));
+ menu->addAction(createCopyUrlAction(Tr::tr("Copy Email Address")));
}
void EmailTextCursorHandler::slotOpenUrl()
@@ -551,7 +552,7 @@ private:
VcsBaseEditorWidgetPrivate::VcsBaseEditorWidgetPrivate(VcsBaseEditorWidget *editorWidget) :
q(editorWidget),
- m_annotateRevisionTextFormat(VcsBaseEditorWidget::tr("Annotate \"%1\""))
+ m_annotateRevisionTextFormat(Tr::tr("Annotate \"%1\""))
{
m_textCursorHandlers.append(new ChangeTextCursorHandler(editorWidget));
m_textCursorHandlers.append(new UrlTextCursorHandler(editorWidget));
@@ -963,7 +964,7 @@ void VcsBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e)
if (ExtensionSystem::PluginManager::getObject()) {
// optional code pasting service
menu->addSeparator();
- connect(menu->addAction(tr("Send to CodePaster...")), &QAction::triggered,
+ connect(menu->addAction(Tr::tr("Send to CodePaster...")), &QAction::triggered,
this, &VcsBaseEditorWidget::slotPaste);
}
menu->addSeparator();
@@ -976,12 +977,12 @@ void VcsBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e)
// directory matches that of the patch (see findDiffFile()). In addition,
// the user has "Open With" and choose the right diff editor so that
// fileNameFromDiffSpecification() works.
- QAction *applyAction = menu->addAction(tr("Apply Chunk..."));
+ QAction *applyAction = menu->addAction(Tr::tr("Apply Chunk..."));
connect(applyAction, &QAction::triggered, this, [this, chunk] {
slotApplyDiffChunk(chunk, PatchAction::Apply);
});
// Revert a chunk from a VCS diff, which might be linked to reloading the diff.
- QAction *revertAction = menu->addAction(tr("Revert Chunk..."));
+ QAction *revertAction = menu->addAction(Tr::tr("Revert Chunk..."));
connect(revertAction, &QAction::triggered, this, [this, chunk] {
slotApplyDiffChunk(chunk, PatchAction::Revert);
});
diff --git a/src/plugins/vcsbase/vcsbaseeditorconfig.cpp b/src/plugins/vcsbase/vcsbaseeditorconfig.cpp
index efbbb14f925..fdf8542ab32 100644
--- a/src/plugins/vcsbase/vcsbaseeditorconfig.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditorconfig.cpp
@@ -3,6 +3,8 @@
#include "vcsbaseeditorconfig.h"
+#include "vcsbasetr.h"
+
#include
#include
@@ -129,7 +131,7 @@ void VcsBaseEditorConfig::setBaseArguments(const QStringList &b)
QAction *VcsBaseEditorConfig::addReloadButton()
{
- auto action = new QAction(Utils::Icons::RELOAD_TOOLBAR.icon(), tr("Reload"), d->m_toolBar);
+ auto action = new QAction(Icons::RELOAD_TOOLBAR.icon(), Tr::tr("Reload"), d->m_toolBar);
connect(action, &QAction::triggered, this, &VcsBaseEditorConfig::argumentsChanged);
addAction(action);
return action;
diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp
index 8ff6a8eb3d9..48af9bf8e08 100644
--- a/src/plugins/vcsbase/vcsbaseplugin.cpp
+++ b/src/plugins/vcsbase/vcsbaseplugin.cpp
@@ -5,6 +5,7 @@
#include "commonvcssettings.h"
#include "vcsbasesubmiteditor.h"
+#include "vcsbasetr.h"
#include "vcsplugin.h"
#include
@@ -590,7 +591,7 @@ bool VcsBasePluginPrivate::enableMenuAction(ActionState as, QAction *menuAction)
QString VcsBasePluginPrivate::commitDisplayName() const
{
- return tr("Commit", "name of \"commit\" action of the VCS.");
+ return Tr::tr("Commit", "name of \"commit\" action of the VCS.");
}
void VcsBasePluginPrivate::commitFromEditor()
@@ -601,7 +602,7 @@ void VcsBasePluginPrivate::commitFromEditor()
bool VcsBasePluginPrivate::promptBeforeCommit()
{
- return DocumentManager::saveAllModifiedDocuments(tr("Save before %1?")
+ return DocumentManager::saveAllModifiedDocuments(Tr::tr("Save before %1?")
.arg(commitDisplayName().toLower()));
}
@@ -611,8 +612,8 @@ void VcsBasePluginPrivate::promptToDeleteCurrentFile()
QTC_ASSERT(state.hasFile(), return);
const bool rc = VcsManager::promptToDelete(this, state.currentFile());
if (!rc)
- QMessageBox::warning(ICore::dialogParent(), tr("Version Control"),
- tr("The file \"%1\" could not be deleted.").
+ QMessageBox::warning(ICore::dialogParent(), Tr::tr("Version Control"),
+ Tr::tr("The file \"%1\" could not be deleted.").
arg(QDir::toNativeSeparators(state.currentFile())),
QMessageBox::Ok);
}
@@ -634,29 +635,29 @@ void VcsBasePluginPrivate::createRepository()
// Prompt for a directory that is not under version control yet
QWidget *mw = ICore::dialogParent();
do {
- directory = FileUtils::getExistingDirectory(nullptr, tr("Choose Repository Directory"), directory);
+ directory = FileUtils::getExistingDirectory(nullptr, Tr::tr("Choose Repository Directory"), directory);
if (directory.isEmpty())
return;
const IVersionControl *managingControl = VcsManager::findVersionControlForDirectory(directory);
if (managingControl == nullptr)
break;
- const QString question = tr("The directory \"%1\" is already managed by a version control system (%2)."
- " Would you like to specify another directory?")
- .arg(directory.toUserOutput(), managingControl->displayName());
+ const QString question = Tr::tr("The directory \"%1\" is already managed by a version control system (%2)."
+ " Would you like to specify another directory?")
+ .arg(directory.toUserOutput(), managingControl->displayName());
- if (!ask(mw, tr("Repository already under version control"), question))
+ if (!ask(mw, Tr::tr("Repository already under version control"), question))
return;
} while (true);
// Create
const bool rc = vcsCreateRepository(directory);
const QString nativeDir = directory.toUserOutput();
if (rc) {
- QMessageBox::information(mw, tr("Repository Created"),
- tr("A version control repository has been created in %1.").
+ QMessageBox::information(mw, Tr::tr("Repository Created"),
+ Tr::tr("A version control repository has been created in %1.").
arg(nativeDir));
} else {
- QMessageBox::warning(mw, tr("Repository Creation Failed"),
- tr("A version control repository could not be created in %1.").
+ QMessageBox::warning(mw, Tr::tr("Repository Creation Failed"),
+ Tr::tr("A version control repository could not be created in %1.").
arg(nativeDir));
}
}
diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
index 5a64289b1da..282609c0f71 100644
--- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
+++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
@@ -10,6 +10,7 @@
#include "submitfieldwidget.h"
#include "submitfilemodel.h"
#include "vcsbaseplugin.h"
+#include "vcsbasetr.h"
#include "vcsoutputwindow.h"
#include "vcsplugin.h"
@@ -150,7 +151,7 @@ void VcsBaseSubmitEditor::setParameters(const VcsBaseSubmitEditorParameters &par
d->m_file.setMimeType(QLatin1String(parameters.mimeType));
setWidget(d->m_widget);
- document()->setPreferredDisplayName(QCoreApplication::translate("VCS", d->m_parameters.displayName));
+ document()->setPreferredDisplayName(QCoreApplication::translate("::VcsBase", d->m_parameters.displayName));
// Message font according to settings
CompletingTextEdit *descriptionEdit = d->m_widget->descriptionEdit();
@@ -184,14 +185,14 @@ void VcsBaseSubmitEditor::setParameters(const VcsBaseSubmitEditorParameters &par
d->m_widget->addDescriptionEditContextMenuAction(sep);
// Run check action
if (!settings.submitMessageCheckScript.value().isEmpty()) {
- auto checkAction = new QAction(tr("Check Message"), this);
+ auto checkAction = new QAction(Tr::tr("Check Message"), this);
connect(checkAction, &QAction::triggered,
this, &VcsBaseSubmitEditor::slotCheckSubmitMessage);
d->m_widget->addDescriptionEditContextMenuAction(checkAction);
}
// Insert nick
if (!settings.nickNameMailMap.value().isEmpty()) {
- auto insertAction = new QAction(tr("Insert Name..."), this);
+ auto insertAction = new QAction(Tr::tr("Insert Name..."), this);
connect(insertAction, &QAction::triggered, this, &VcsBaseSubmitEditor::slotInsertNickName);
d->m_widget->addDescriptionEditContextMenuAction(insertAction);
}
@@ -453,7 +454,7 @@ void VcsBaseSubmitEditor::accept(VcsBasePluginPrivate *plugin)
const bool canCommit = checkSubmitMessage(&errorMessage) && submitWidget->canSubmit(&errorMessage);
if (!canCommit) {
VcsOutputWindow::appendError(
- tr("Cannot %1%2.",
+ Tr::tr("Cannot %1%2.",
"%2 is an optional error message with ': ' prefix. Don't add space in front.")
.arg(plugin->commitDisplayName().toLower(),
errorMessage.isEmpty() ? errorMessage : ": " + errorMessage));
@@ -481,8 +482,8 @@ bool VcsBaseSubmitEditor::promptSubmit(VcsBasePluginPrivate *plugin)
const QString commitName = plugin->commitDisplayName();
return QMessageBox::question(Core::ICore::dialogParent(),
- tr("Close %1 %2 Editor").arg(plugin->displayName(), commitName),
- tr("Closing this editor will abort the %1. Are you sure?")
+ Tr::tr("Close %1 %2 Editor").arg(plugin->displayName(), commitName),
+ Tr::tr("Closing this editor will abort the %1. Are you sure?")
.arg(commitName.toLower())) == QMessageBox::Yes;
}
@@ -515,7 +516,7 @@ void VcsBaseSubmitEditor::slotCheckSubmitMessage()
{
QString errorMessage;
if (!checkSubmitMessage(&errorMessage)) {
- QMessageBox msgBox(QMessageBox::Warning, tr("Submit Message Check Failed"),
+ QMessageBox msgBox(QMessageBox::Warning, Tr::tr("Submit Message Check Failed"),
errorMessage, QMessageBox::Ok, d->m_widget);
msgBox.setMinimumWidth(checkDialogMinimumWidth);
msgBox.exec();
@@ -537,8 +538,8 @@ static QString msgCheckScript(const FilePath &workingDir, const QString &cmd)
{
const QString nativeCmd = QDir::toNativeSeparators(cmd);
return workingDir.isEmpty() ?
- VcsBaseSubmitEditor::tr("Executing %1").arg(nativeCmd) :
- VcsBaseSubmitEditor::tr("Executing [%1] %2").
+ Tr::tr("Executing %1").arg(nativeCmd) :
+ Tr::tr("Executing [%1] %2").
arg(workingDir.toUserOutput(), nativeCmd);
}
diff --git a/src/plugins/vcsbase/vcsoutputformatter.cpp b/src/plugins/vcsbase/vcsoutputformatter.cpp
index ddb71c92c13..512f7790d4f 100644
--- a/src/plugins/vcsbase/vcsoutputformatter.cpp
+++ b/src/plugins/vcsbase/vcsoutputformatter.cpp
@@ -3,6 +3,8 @@
#include "vcsoutputformatter.h"
+#include "vcsbasetr.h"
+
#include
#include
#include
@@ -72,12 +74,11 @@ void VcsOutputLineParser::fillLinkContextMenu(
{
QTC_ASSERT(!href.isEmpty(), return);
if (href.startsWith("http://") || href.startsWith("https://")) {
- QAction *action = menu->addAction(
- tr("&Open \"%1\"").arg(href),
- [href] { QDesktopServices::openUrl(QUrl(href)); });
+ QAction *action = menu->addAction(Tr::tr("&Open \"%1\"").arg(href),
+ [href] { QDesktopServices::openUrl(QUrl(href)); });
menu->setDefaultAction(action);
- menu->addAction(tr("&Copy to clipboard: \"%1\"").arg(href),
- [href] { setClipboardAndSelection(href); });
+ menu->addAction(Tr::tr("&Copy to clipboard: \"%1\"").arg(href),
+ [href] { setClipboardAndSelection(href); });
return;
}
if (Core::IVersionControl *vcs = Core::VcsManager::findVersionControlForDirectory(workingDirectory))
diff --git a/src/plugins/vcsbase/vcsoutputwindow.cpp b/src/plugins/vcsbase/vcsoutputwindow.cpp
index 5916249ac34..245de851346 100644
--- a/src/plugins/vcsbase/vcsoutputwindow.cpp
+++ b/src/plugins/vcsbase/vcsoutputwindow.cpp
@@ -3,6 +3,7 @@
#include "vcsoutputwindow.h"
+#include "vcsbasetr.h"
#include "vcsoutputformatter.h"
#include
@@ -12,14 +13,12 @@
#include
#include
-#include
+#include
#include
#include
#include
#include
-#include
-#include
#include
#include
#include
@@ -162,7 +161,7 @@ void OutputWindowPlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
repo = repo.pathAppended(token);
if (repo.isFile()) {
menu->addSeparator();
- openAction = menu->addAction(VcsOutputWindow::tr("Open \"%1\"").arg(repo.nativePath()));
+ openAction = menu->addAction(Tr::tr("Open \"%1\"").arg(repo.nativePath()));
openAction->setData(repo.absoluteFilePath().toVariant());
}
}
@@ -170,7 +169,7 @@ void OutputWindowPlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
if (href.isEmpty()) {
// Add 'clear'
menu->addSeparator();
- clearAction = menu->addAction(VcsOutputWindow::tr("Clear"));
+ clearAction = menu->addAction(Tr::tr("Clear"));
}
// Run
@@ -330,7 +329,7 @@ QWidget *VcsOutputWindow::outputWidget(QWidget *parent)
QString VcsOutputWindow::displayName() const
{
- return tr("Version Control");
+ return Tr::tr("Version Control");
}
int VcsOutputWindow::priorityInStatusBar() const
@@ -444,8 +443,8 @@ QString VcsOutputWindow::msgExecutionLogEntry(const FilePath &workingDir, const
const QString maskedCmdline = ProcessArgs::quoteArg(command.executable().toUserOutput())
+ ' ' + formatArguments(command.splitArguments());
if (workingDir.isEmpty())
- return tr("Running: %1").arg(maskedCmdline) + '\n';
- return tr("Running in %1: %2").arg(workingDir.toUserOutput(), maskedCmdline) + '\n';
+ return Tr::tr("Running: %1").arg(maskedCmdline) + '\n';
+ return Tr::tr("Running in %1: %2").arg(workingDir.toUserOutput(), maskedCmdline) + '\n';
}
void VcsOutputWindow::appendShellCommandLine(const QString &text)
diff --git a/src/plugins/vcsbase/vcsplugin.cpp b/src/plugins/vcsbase/vcsplugin.cpp
index 48c534c4457..da1740d6912 100644
--- a/src/plugins/vcsbase/vcsplugin.cpp
+++ b/src/plugins/vcsbase/vcsplugin.cpp
@@ -7,6 +7,7 @@
#include "nicknamedialog.h"
#include "vcsbaseconstants.h"
#include "vcsbasesubmiteditor.h"
+#include "vcsbasetr.h"
#include "vcsoutputwindow.h"
#include "wizard/vcscommandpage.h"
#include "wizard/vcsconfigurationpage.h"
@@ -85,7 +86,7 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
MacroExpander *expander = globalMacroExpander();
expander->registerVariable(Constants::VAR_VCS_NAME,
- tr("Name of the version control system in use by the current project."),
+ Tr::tr("Name of the version control system in use by the current project."),
[]() -> QString {
IVersionControl *vc = nullptr;
if (Project *project = ProjectTree::currentProject())
@@ -94,7 +95,7 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
});
expander->registerVariable(Constants::VAR_VCS_TOPIC,
- tr("The current version control topic (branch or tag) identification of the current project."),
+ Tr::tr("The current version control topic (branch or tag) identification of the current project."),
[]() -> QString {
IVersionControl *vc = nullptr;
FilePath topLevel;
@@ -104,7 +105,7 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
});
expander->registerVariable(Constants::VAR_VCS_TOPLEVELPATH,
- tr("The top level path to the repository the current project is in."),
+ Tr::tr("The top level path to the repository the current project is in."),
[]() -> QString {
if (Project *project = ProjectTree::currentProject())
return VcsManager::findTopLevelForDirectory(project->projectDirectory()).toString();
diff --git a/src/plugins/vcsbase/wizard/vcscommandpage.cpp b/src/plugins/vcsbase/wizard/vcscommandpage.cpp
index 52475ba13f9..1fef5540f40 100644
--- a/src/plugins/vcsbase/wizard/vcscommandpage.cpp
+++ b/src/plugins/vcsbase/wizard/vcscommandpage.cpp
@@ -5,6 +5,7 @@
#include "../vcsbaseplugin.h"
#include "../vcscommand.h"
+#include "../vcsbasetr.h"
#include
@@ -127,63 +128,63 @@ bool VcsCommandPageFactory::validateData(Id typeId, const QVariant &data, QStrin
QString em;
if (data.type() != QVariant::Map)
- em = tr("\"data\" is no JSON object in \"VcsCommand\" page.");
+ em = Tr::tr("\"data\" is no JSON object in \"VcsCommand\" page.");
if (em.isEmpty()) {
const QVariantMap tmp = data.toMap();
QString str = tmp.value(QLatin1String(VCSCOMMAND_VCSID)).toString();
if (str.isEmpty()) {
- em = tr("\"%1\" not set in \"data\" section of \"VcsCommand\" page.")
+ em = Tr::tr("\"%1\" not set in \"data\" section of \"VcsCommand\" page.")
.arg(QLatin1String(VCSCOMMAND_VCSID));
}
str = tmp.value(QLatin1String(VCSCOMMAND_REPO)).toString();
if (str.isEmpty()) {
- em = tr("\"%1\" not set in \"data\" section of \"VcsCommand\" page.")
+ em = Tr::tr("\"%1\" not set in \"data\" section of \"VcsCommand\" page.")
.arg(QLatin1String(VCSCOMMAND_REPO));
}
str = tmp.value(QLatin1String(VCSCOMMAND_DIR)).toString();
if (str.isEmpty()) {
- em = tr("\"%1\" not set in \"data\" section of \"VcsCommand\" page.")
+ em = Tr::tr("\"%1\" not set in \"data\" section of \"VcsCommand\" page.")
.arg(QLatin1String(VCSCOMMAND_DIR));;
}
str = tmp.value(QLatin1String(VCSCOMMAND_CHECKOUTNAME)).toString();
if (str.isEmpty()) {
- em = tr("\"%1\" not set in \"data\" section of \"VcsCommand\" page.")
+ em = Tr::tr("\"%1\" not set in \"data\" section of \"VcsCommand\" page.")
.arg(QLatin1String(VCSCOMMAND_CHECKOUTNAME));
}
str = tmp.value(QLatin1String(VCSCOMMAND_RUN_MESSAGE)).toString();
if (str.isEmpty()) {
- em = tr("\"%1\" not set in \"data\" section of \"VcsCommand\" page.")
+ em = Tr::tr("\"%1\" not set in \"data\" section of \"VcsCommand\" page.")
.arg(QLatin1String(VCSCOMMAND_RUN_MESSAGE));
}
const QVariant extra = tmp.value(QLatin1String(VCSCOMMAND_EXTRA_ARGS));
if (!extra.isNull() && extra.type() != QVariant::String && extra.type() != QVariant::List) {
- em = tr("\"%1\" in \"data\" section of \"VcsCommand\" page has unexpected type (unset, String or List).")
+ em = Tr::tr("\"%1\" in \"data\" section of \"VcsCommand\" page has unexpected type (unset, String or List).")
.arg(QLatin1String(VCSCOMMAND_EXTRA_ARGS));
}
const QVariant jobs = tmp.value(QLatin1String(VCSCOMMAND_JOBS));
if (!jobs.isNull() && extra.type() != QVariant::List) {
- em = tr("\"%1\" in \"data\" section of \"VcsCommand\" page has unexpected type (unset or List).")
+ em = Tr::tr("\"%1\" in \"data\" section of \"VcsCommand\" page has unexpected type (unset or List).")
.arg(QLatin1String(VCSCOMMAND_JOBS));
}
const QVariantList jobList = jobs.toList();
for (const QVariant &j : jobList) {
if (j.isNull()) {
- em = tr("Job in \"VcsCommand\" page is empty.");
+ em = Tr::tr("Job in \"VcsCommand\" page is empty.");
break;
}
if (j.type() != QVariant::Map) {
- em = tr("Job in \"VcsCommand\" page is not an object.");
+ em = Tr::tr("Job in \"VcsCommand\" page is not an object.");
break;
}
const QVariantMap &details = j.toMap();
if (details.value(QLatin1String(JOB_COMMAND)).isNull()) {
- em = tr("Job in \"VcsCommand\" page has no \"%1\" set.").arg(QLatin1String(JOB_COMMAND));
+ em = Tr::tr("Job in \"VcsCommand\" page has no \"%1\" set.").arg(QLatin1String(JOB_COMMAND));
break;
}
}
@@ -209,7 +210,7 @@ bool VcsCommandPageFactory::validateData(Id typeId, const QVariant &data, QStrin
*/
VcsCommandPage::VcsCommandPage()
- : m_startedStatus(tr("Command started..."))
+ : m_startedStatus(Tr::tr("Command started..."))
{
resize(264, 200);
auto verticalLayout = new QVBoxLayout(this);
@@ -222,7 +223,7 @@ VcsCommandPage::VcsCommandPage()
m_statusLabel = new QLabel;
verticalLayout->addWidget(m_statusLabel);
- setTitle(tr("Checkout"));
+ setTitle(Tr::tr("Checkout"));
}
VcsCommandPage::~VcsCommandPage()
@@ -263,44 +264,38 @@ void VcsCommandPage::delayedInitialize()
VcsBasePluginPrivate *vc = static_cast(
VcsManager::versionControl(Id::fromString(vcsId)));
if (!vc) {
- qWarning() << QCoreApplication::translate("VcsBase::VcsCommandPage",
- "\"%1\" (%2) not found.")
- .arg(QLatin1String(VCSCOMMAND_VCSID), vcsId);
+ qWarning() << Tr::tr("\"%1\" (%2) not found.")
+ .arg(QLatin1String(VCSCOMMAND_VCSID), vcsId);
return;
}
if (!vc->isConfigured()) {
- qWarning() << QCoreApplication::translate("VcsBase::VcsCommandPage",
- "Version control \"%1\" is not configured.")
- .arg(vcsId);
+ qWarning() << Tr::tr("Version control \"%1\" is not configured.")
+ .arg(vcsId);
return;
}
if (!vc->supportsOperation(IVersionControl::InitialCheckoutOperation)) {
- qWarning() << QCoreApplication::translate("VcsBase::VcsCommandPage",
- "Version control \"%1\" does not support initial checkouts.")
- .arg(vcsId);
+ qWarning() << Tr::tr("Version control \"%1\" does not support initial checkouts.")
+ .arg(vcsId);
return;
}
const QString repo = wiz->expander()->expand(m_repository);
if (repo.isEmpty()) {
- qWarning() << QCoreApplication::translate("VcsBase::VcsCommandPage",
- "\"%1\" is empty when trying to run checkout.")
+ qWarning() << Tr::tr("\"%1\" is empty when trying to run checkout.")
.arg(QLatin1String(VCSCOMMAND_REPO));
return;
}
const QString base = wiz->expander()->expand(m_directory);
if (!QDir(base).exists()) {
- qWarning() << QCoreApplication::translate("VcsBase::VcsCommandPage",
- "\"%1\" (%2) does not exist.")
+ qWarning() << Tr::tr("\"%1\" (%2) does not exist.")
.arg(QLatin1String(VCSCOMMAND_DIR), base);
return;
}
const QString name = wiz->expander()->expand(m_name);
if (name.isEmpty()) {
- qWarning() << QCoreApplication::translate("VcsBase::VcsCommandPage",
- "\"%1\" is empty when trying to run checkout.")
+ qWarning() << Tr::tr("\"%1\" is empty when trying to run checkout.")
.arg(QLatin1String(VCSCOMMAND_CHECKOUTNAME));
return;
}
@@ -352,7 +347,7 @@ void VcsCommandPage::delayedInitialize()
void VcsCommandPage::start(VcsCommand *command)
{
if (!command) {
- m_logPlainTextEdit->setPlainText(tr("No job running, please abort."));
+ m_logPlainTextEdit->setPlainText(Tr::tr("No job running, please abort."));
return;
}
@@ -388,11 +383,11 @@ void VcsCommandPage::finished(bool success)
if (success) {
m_state = Succeeded;
- message = tr("Succeeded.");
+ message = Tr::tr("Succeeded.");
palette.setColor(QPalette::WindowText, creatorTheme()->color(Theme::TextColorNormal).name());
} else {
m_state = Failed;
- message = tr("Failed.");
+ message = Tr::tr("Failed.");
palette.setColor(QPalette::WindowText, creatorTheme()->color(Theme::TextColorError).name());
}
diff --git a/src/plugins/vcsbase/wizard/vcscommandpage.h b/src/plugins/vcsbase/wizard/vcscommandpage.h
index 8fd9953bfa3..c36e3a76c19 100644
--- a/src/plugins/vcsbase/wizard/vcscommandpage.h
+++ b/src/plugins/vcsbase/wizard/vcscommandpage.h
@@ -3,15 +3,11 @@
#pragma once
-#include "../vcsbase_global.h"
-
#include
#include
#include
-#include
-
QT_BEGIN_NAMESPACE
class QPlainTextEdit;
class QLabel;
@@ -27,8 +23,6 @@ namespace Internal {
class VcsCommandPageFactory : public ProjectExplorer::JsonWizardPageFactory
{
- Q_DECLARE_TR_FUNCTIONS(VcsBase::Internal::VcsCommandPage)
-
public:
VcsCommandPageFactory();
diff --git a/src/plugins/vcsbase/wizard/vcsconfigurationpage.cpp b/src/plugins/vcsbase/wizard/vcsconfigurationpage.cpp
index e3bb3b3a0fd..2de42975635 100644
--- a/src/plugins/vcsbase/wizard/vcsconfigurationpage.cpp
+++ b/src/plugins/vcsbase/wizard/vcsconfigurationpage.cpp
@@ -3,15 +3,18 @@
#include "vcsconfigurationpage.h"
-#include "../vcsbaseconstants.h"
+#include "../vcsbasetr.h"
#include
#include
#include
+
+#include
+
+#include
#include
#include
-#include
#include
#include
@@ -55,8 +58,7 @@ bool VcsConfigurationPageFactory::validateData(Id typeId, const QVariant &data,
if (data.isNull() || data.type() != QVariant::Map) {
//: Do not translate "VcsConfiguration", because it is the id of a page.
- *errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard",
- "\"data\" must be a JSON object for \"VcsConfiguration\" pages.");
+ *errorMessage = ProjectExplorer::Tr::tr("\"data\" must be a JSON object for \"VcsConfiguration\" pages.");
return false;
}
@@ -64,8 +66,7 @@ bool VcsConfigurationPageFactory::validateData(Id typeId, const QVariant &data,
const QString vcsId = tmp.value(QLatin1String("vcsId")).toString();
if (vcsId.isEmpty()) {
//: Do not translate "VcsConfiguration", because it is the id of a page.
- *errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard",
- "\"VcsConfiguration\" page requires a \"vcsId\" set.");
+ *errorMessage = ProjectExplorer::Tr::tr("\"VcsConfiguration\" page requires a \"vcsId\" set.");
return false;
}
return true;
@@ -83,7 +84,7 @@ public:
VcsConfigurationPage::VcsConfigurationPage() : d(new Internal::VcsConfigurationPagePrivate)
{
- setTitle(tr("Configuration"));
+ setTitle(Tr::tr("Configuration"));
d->m_versionControl = nullptr;
d->m_configureButton = new QPushButton(ICore::msgShowOptionsDialog(), this);
@@ -126,7 +127,7 @@ void VcsConfigurationPage::initializePage()
auto jw = qobject_cast(wizard());
if (!jw) {
//: Do not translate "VcsConfiguration", because it is the id of a page.
- emit reportError(tr("No version control set on \"VcsConfiguration\" page."));
+ emit reportError(Tr::tr("No version control set on \"VcsConfiguration\" page."));
}
const QString vcsId = jw ? jw->expander()->expand(d->m_versionControlId) : d->m_versionControlId;
@@ -136,8 +137,8 @@ void VcsConfigurationPage::initializePage()
const QString values = Utils::transform(VcsManager::versionControls(),
[](const IVersionControl *vc) { return vc->id().toString(); }).join(", ");
//: Do not translate "VcsConfiguration", because it is the id of a page.
- emit reportError(tr("\"vcsId\" (\"%1\") is invalid for \"VcsConfiguration\" page. "
- "Possible values are: %2.").arg(vcsId, values));
+ emit reportError(Tr::tr("\"vcsId\" (\"%1\") is invalid for \"VcsConfiguration\" page. "
+ "Possible values are: %2.").arg(vcsId, values));
}
}
@@ -146,9 +147,9 @@ void VcsConfigurationPage::initializePage()
d->m_configureButton->setEnabled(d->m_versionControl);
if (d->m_versionControl)
- setSubTitle(tr("Please configure %1 now.").arg(d->m_versionControl->displayName()));
+ setSubTitle(Tr::tr("Please configure %1 now.").arg(d->m_versionControl->displayName()));
else
- setSubTitle(tr("No known version control selected."));
+ setSubTitle(Tr::tr("No known version control selected."));
}
bool VcsConfigurationPage::isComplete() const