diff options
author | hjk <[email protected]> | 2022-09-29 17:59:47 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2022-09-30 08:18:24 +0000 |
commit | dda16c3abc2ee4492b9a1ac583d9d92da003a9bf (patch) | |
tree | f79b0288b5e292071fd7ebfb689992e8d4a9d07c /src/plugins/cvs | |
parent | 08a7dbd046a1b883fd44e78d58b8b797f6681db8 (diff) |
Cvs: Move to Tr::tr
Change-Id: Iba6cfa75745ec2644c1a3dd20949971d16f6dba7
Reviewed-by: Alessandro Portale <[email protected]>
Diffstat (limited to 'src/plugins/cvs')
-rw-r--r-- | src/plugins/cvs/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/plugins/cvs/annotationhighlighter.cpp | 18 | ||||
-rw-r--r-- | src/plugins/cvs/annotationhighlighter.h | 25 | ||||
-rw-r--r-- | src/plugins/cvs/cvs.qbs | 2 | ||||
-rw-r--r-- | src/plugins/cvs/cvseditor.cpp | 31 | ||||
-rw-r--r-- | src/plugins/cvs/cvseditor.h | 6 | ||||
-rw-r--r-- | src/plugins/cvs/cvsplugin.cpp | 108 | ||||
-rw-r--r-- | src/plugins/cvs/cvsplugin.h | 6 | ||||
-rw-r--r-- | src/plugins/cvs/cvssettings.cpp | 24 | ||||
-rw-r--r-- | src/plugins/cvs/cvssettings.h | 8 | ||||
-rw-r--r-- | src/plugins/cvs/cvssubmiteditor.cpp | 13 | ||||
-rw-r--r-- | src/plugins/cvs/cvssubmiteditor.h | 10 | ||||
-rw-r--r-- | src/plugins/cvs/cvstr.h | 4 | ||||
-rw-r--r-- | src/plugins/cvs/cvsutils.cpp | 6 | ||||
-rw-r--r-- | src/plugins/cvs/cvsutils.h | 6 |
15 files changed, 114 insertions, 154 deletions
diff --git a/src/plugins/cvs/CMakeLists.txt b/src/plugins/cvs/CMakeLists.txt index 47c91f8a720..1cc14dfc166 100644 --- a/src/plugins/cvs/CMakeLists.txt +++ b/src/plugins/cvs/CMakeLists.txt @@ -2,7 +2,6 @@ add_qtc_plugin(CVS PLUGIN_CLASS CvsPlugin PLUGIN_DEPENDS Core TextEditor VcsBase SOURCES - annotationhighlighter.cpp annotationhighlighter.h cvseditor.cpp cvseditor.h cvsplugin.cpp cvsplugin.h cvssettings.cpp cvssettings.h diff --git a/src/plugins/cvs/annotationhighlighter.cpp b/src/plugins/cvs/annotationhighlighter.cpp deleted file mode 100644 index 9efca576838..00000000000 --- a/src/plugins/cvs/annotationhighlighter.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 - -#include "annotationhighlighter.h" - -using namespace Cvs; -using namespace Cvs::Internal; - -CvsAnnotationHighlighter::CvsAnnotationHighlighter(const ChangeNumbers &changeNumbers, - QTextDocument *document) : - VcsBase::BaseAnnotationHighlighter(changeNumbers, document) -{ } - -QString CvsAnnotationHighlighter::changeNumber(const QString &block) const -{ - const int pos = block.indexOf(QLatin1Char(' ')); - return pos > 1 ? block.left(pos) : QString(); -} diff --git a/src/plugins/cvs/annotationhighlighter.h b/src/plugins/cvs/annotationhighlighter.h deleted file mode 100644 index 2e7e85f1a79..00000000000 --- a/src/plugins/cvs/annotationhighlighter.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 - -#pragma once - -#include <vcsbase/baseannotationhighlighter.h> - -namespace Cvs { -namespace Internal { - -// Annotation highlighter for cvs triggering on 'changenumber ' -class CvsAnnotationHighlighter : public VcsBase::BaseAnnotationHighlighter -{ - Q_OBJECT - -public: - explicit CvsAnnotationHighlighter(const ChangeNumbers &changeNumbers, - QTextDocument *document = nullptr); - -private: - QString changeNumber(const QString &block) const override; -}; - -} // namespace Internal -} // namespace Cvs diff --git a/src/plugins/cvs/cvs.qbs b/src/plugins/cvs/cvs.qbs index cbc1dbaa0f2..53fae819f28 100644 --- a/src/plugins/cvs/cvs.qbs +++ b/src/plugins/cvs/cvs.qbs @@ -11,8 +11,6 @@ QtcPlugin { Depends { name: "VcsBase" } files: [ - "annotationhighlighter.cpp", - "annotationhighlighter.h", "cvseditor.cpp", "cvseditor.h", "cvsplugin.cpp", diff --git a/src/plugins/cvs/cvseditor.cpp b/src/plugins/cvs/cvseditor.cpp index e8f77d6ab6e..147c3345e54 100644 --- a/src/plugins/cvs/cvseditor.cpp +++ b/src/plugins/cvs/cvseditor.cpp @@ -2,24 +2,42 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 #include "cvseditor.h" -#include "cvsutils.h" -#include "annotationhighlighter.h" +#include "cvstr.h" +#include "cvsutils.h" #include <utils/qtcassert.h> + +#include <vcsbase/baseannotationhighlighter.h> #include <vcsbase/diffandloghighlighter.h> #include <QDebug> #include <QTextCursor> #include <QTextBlock> -namespace Cvs { -namespace Internal { +namespace Cvs::Internal { // Match a CVS revision ("1.1.1.1") #define CVS_REVISION_PATTERN "[\\d\\.]+" #define CVS_REVISION_AT_START_PATTERN "^(" CVS_REVISION_PATTERN ") " +// Annotation highlighter for cvs triggering on 'changenumber ' +class CvsAnnotationHighlighter : public VcsBase::BaseAnnotationHighlighter +{ +public: + explicit CvsAnnotationHighlighter(const ChangeNumbers &changeNumbers, + QTextDocument *document = nullptr) : + VcsBase::BaseAnnotationHighlighter(changeNumbers, document) + { } + +private: + QString changeNumber(const QString &block) const override + { + const int pos = block.indexOf(QLatin1Char(' ')); + return pos > 1 ? block.left(pos) : QString(); + } +}; + CvsEditorWidget::CvsEditorWidget() : m_revisionAnnotationPattern(CVS_REVISION_AT_START_PATTERN), m_revisionLogPattern("^revision *(" CVS_REVISION_PATTERN ")$") @@ -36,7 +54,7 @@ CvsEditorWidget::CvsEditorWidget() : */ setDiffFilePattern("^[-+]{3} ([^\\t]+)"); setLogEntryPattern("^revision (.+)$"); - setAnnotateRevisionTextFormat(tr("Annotate revision \"%1\"")); + setAnnotateRevisionTextFormat(Tr::tr("Annotate revision \"%1\"")); setAnnotationEntryPattern("^(" CVS_REVISION_PATTERN ") "); } @@ -87,5 +105,4 @@ QStringList CvsEditorWidget::annotationPreviousVersions(const QString &revision) return QStringList(previousRevision(revision)); } -} -} +} // Cvs::Internal diff --git a/src/plugins/cvs/cvseditor.h b/src/plugins/cvs/cvseditor.h index f68fcd68a9d..44c7f209444 100644 --- a/src/plugins/cvs/cvseditor.h +++ b/src/plugins/cvs/cvseditor.h @@ -7,8 +7,7 @@ #include <QRegularExpression> -namespace Cvs { -namespace Internal { +namespace Cvs::Internal { class CvsEditorWidget : public VcsBase::VcsBaseEditorWidget { @@ -28,5 +27,4 @@ private: QString m_diffBaseDir; }; -} // namespace Internal -} // namespace Cvs +} // Cvs::Internal diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 3f25126b0d7..6318f5eb5a6 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -2,10 +2,12 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 #include "cvsplugin.h" + #include "cvseditor.h" +#include "cvssettings.h" #include "cvssubmiteditor.h" +#include "cvstr.h" #include "cvsutils.h" -#include "cvssettings.h" #include <vcsbase/basevcseditorfactory.h> #include <vcsbase/basevcssubmiteditorfactory.h> @@ -58,8 +60,7 @@ using namespace VcsBase; using namespace Utils; using namespace std::placeholders; -namespace Cvs { -namespace Internal { +namespace Cvs::Internal { const char CVS_CONTEXT[] = "CVS Context"; const char CMD_ID_CVS_MENU[] = "CVS.Menu"; @@ -151,9 +152,9 @@ public: VcsBaseEditorConfig(toolBar), m_settings(settings) { - mapSetting(addToggleButton("-w", CvsPlugin::tr("Ignore Whitespace")), + mapSetting(addToggleButton("-w", Tr::tr("Ignore Whitespace")), &settings.diffIgnoreWhiteSpace); - mapSetting(addToggleButton("-B", CvsPlugin::tr("Ignore Blank Lines")), + mapSetting(addToggleButton("-B", Tr::tr("Ignore Blank Lines")), &settings.diffIgnoreBlankLines); } @@ -202,8 +203,6 @@ public: class CvsPluginPrivate final : public VcsBasePluginPrivate { - Q_DECLARE_TR_FUNCTIONS(Cvs::Internal::CvsPlugin) - public: CvsPluginPrivate(); ~CvsPluginPrivate() final; @@ -447,7 +446,7 @@ void CvsPluginPrivate::vcsAnnotate(const FilePath &filePath, int line) QString CvsPluginPrivate::vcsOpenText() const { - return tr("&Edit"); + return Tr::tr("&Edit"); } VcsCommand *CvsPluginPrivate::createInitialCheckoutCommand(const QString &url, @@ -461,7 +460,7 @@ VcsCommand *CvsPluginPrivate::createInitialCheckoutCommand(const QString &url, args << QLatin1String("checkout") << url << extraArgs; auto command = VcsBaseClient::createVcsCommand(baseDirectory, Environment::systemEnvironment()); - command->setDisplayName(tr("CVS Checkout")); + command->setDisplayName(Tr::tr("CVS Checkout")); command->addJob({m_settings.binaryPath.filePath(), m_settings.addOptions(args)}, -1); return command; } @@ -519,28 +518,28 @@ CvsPluginPrivate::CvsPluginPrivate() const QString prefix = QLatin1String("cvs"); m_commandLocator = new CommandLocator("CVS", prefix, prefix, this); - m_commandLocator->setDescription(tr("Triggers a CVS version control operation.")); + m_commandLocator->setDescription(Tr::tr("Triggers a CVS version control operation.")); // Register actions ActionContainer *toolsContainer = ActionManager::actionContainer(M_TOOLS); ActionContainer *cvsMenu = ActionManager::createMenu(Id(CMD_ID_CVS_MENU)); - cvsMenu->menu()->setTitle(tr("&CVS")); + cvsMenu->menu()->setTitle(Tr::tr("&CVS")); toolsContainer->addMenu(cvsMenu); m_menuAction = cvsMenu->menu()->menuAction(); Command *command; - m_diffCurrentAction = new ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this); + m_diffCurrentAction = new ParameterAction(Tr::tr("Diff Current File"), Tr::tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_diffCurrentAction, CMD_ID_DIFF_CURRENT, context); command->setAttribute(Command::CA_UpdateText); - command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+C,Meta+D") : tr("Alt+C,Alt+D"))); + command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Meta+C,Meta+D") : Tr::tr("Alt+C,Alt+D"))); connect(m_diffCurrentAction, &QAction::triggered, this, &CvsPluginPrivate::diffCurrentFile); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_filelogCurrentAction = new ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), ParameterAction::EnabledWithParameter, this); + m_filelogCurrentAction = new ParameterAction(Tr::tr("Filelog Current File"), Tr::tr("Filelog \"%1\""), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, context); command->setAttribute(Command::CA_UpdateText); @@ -548,7 +547,7 @@ CvsPluginPrivate::CvsPluginPrivate() cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_annotateCurrentAction = new ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this); + m_annotateCurrentAction = new ParameterAction(Tr::tr("Annotate Current File"), Tr::tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, context); command->setAttribute(Command::CA_UpdateText); @@ -558,25 +557,25 @@ CvsPluginPrivate::CvsPluginPrivate() cvsMenu->addSeparator(context); - m_addAction = new ParameterAction(tr("Add"), tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this); + m_addAction = new ParameterAction(Tr::tr("Add"), Tr::tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_addAction, CMD_ID_ADD, context); command->setAttribute(Command::CA_UpdateText); - command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+C,Meta+A") : tr("Alt+C,Alt+A"))); + command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Meta+C,Meta+A") : Tr::tr("Alt+C,Alt+A"))); connect(m_addAction, &QAction::triggered, this, &CvsPluginPrivate::addCurrentFile); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_commitCurrentAction = new ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), ParameterAction::EnabledWithParameter, this); + m_commitCurrentAction = new ParameterAction(Tr::tr("Commit Current File"), Tr::tr("Commit \"%1\""), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_commitCurrentAction, CMD_ID_COMMIT_CURRENT, context); command->setAttribute(Command::CA_UpdateText); - command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+C,Meta+C") : tr("Alt+C,Alt+C"))); + command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Meta+C,Meta+C") : Tr::tr("Alt+C,Alt+C"))); connect(m_commitCurrentAction, &QAction::triggered, this, &CvsPluginPrivate::startCommitCurrentFile); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_deleteAction = new ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this); + m_deleteAction = new ParameterAction(Tr::tr("Delete..."), Tr::tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE, context); command->setAttribute(Command::CA_UpdateText); @@ -584,7 +583,7 @@ CvsPluginPrivate::CvsPluginPrivate() cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_revertAction = new ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), ParameterAction::EnabledWithParameter, this); + m_revertAction = new ParameterAction(Tr::tr("Revert..."), Tr::tr("Revert \"%1\"..."), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_revertAction, CMD_ID_REVERT, context); command->setAttribute(Command::CA_UpdateText); @@ -594,21 +593,21 @@ CvsPluginPrivate::CvsPluginPrivate() cvsMenu->addSeparator(context); - m_editCurrentAction = new ParameterAction(tr("Edit"), tr("Edit \"%1\""), ParameterAction::EnabledWithParameter, this); + m_editCurrentAction = new ParameterAction(Tr::tr("Edit"), Tr::tr("Edit \"%1\""), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_editCurrentAction, CMD_ID_EDIT_FILE, context); command->setAttribute(Command::CA_UpdateText); connect(m_editCurrentAction, &QAction::triggered, this, &CvsPluginPrivate::editCurrentFile); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_uneditCurrentAction = new ParameterAction(tr("Unedit"), tr("Unedit \"%1\""), ParameterAction::EnabledWithParameter, this); + m_uneditCurrentAction = new ParameterAction(Tr::tr("Unedit"), Tr::tr("Unedit \"%1\""), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_uneditCurrentAction, CMD_ID_UNEDIT_FILE, context); command->setAttribute(Command::CA_UpdateText); connect(m_uneditCurrentAction, &QAction::triggered, this, &CvsPluginPrivate::uneditCurrentFile); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_uneditRepositoryAction = new QAction(tr("Unedit Repository"), this); + m_uneditRepositoryAction = new QAction(Tr::tr("Unedit Repository"), this); command = ActionManager::registerAction(m_uneditRepositoryAction, CMD_ID_UNEDIT_REPOSITORY, context); connect(m_uneditRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::uneditCurrentRepository); cvsMenu->addAction(command); @@ -616,7 +615,7 @@ CvsPluginPrivate::CvsPluginPrivate() cvsMenu->addSeparator(context); - m_diffProjectAction = new ParameterAction(tr("Diff Project"), tr("Diff Project \"%1\""), ParameterAction::EnabledWithParameter, this); + m_diffProjectAction = new ParameterAction(Tr::tr("Diff Project"), Tr::tr("Diff Project \"%1\""), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, context); command->setAttribute(Command::CA_UpdateText); @@ -624,7 +623,7 @@ CvsPluginPrivate::CvsPluginPrivate() cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_statusProjectAction = new ParameterAction(tr("Project Status"), tr("Status of Project \"%1\""), ParameterAction::EnabledWithParameter, this); + m_statusProjectAction = new ParameterAction(Tr::tr("Project Status"), Tr::tr("Status of Project \"%1\""), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_statusProjectAction, CMD_ID_STATUS, context); command->setAttribute(Command::CA_UpdateText); @@ -632,21 +631,21 @@ CvsPluginPrivate::CvsPluginPrivate() cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_logProjectAction = new ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), ParameterAction::EnabledWithParameter, this); + m_logProjectAction = new ParameterAction(Tr::tr("Log Project"), Tr::tr("Log Project \"%1\""), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, context); command->setAttribute(Command::CA_UpdateText); connect(m_logProjectAction, &QAction::triggered, this, &CvsPluginPrivate::logProject); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_updateProjectAction = new ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), ParameterAction::EnabledWithParameter, this); + m_updateProjectAction = new ParameterAction(Tr::tr("Update Project"), Tr::tr("Update Project \"%1\""), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE, context); command->setAttribute(Command::CA_UpdateText); connect(m_updateProjectAction, &QAction::triggered, this, &CvsPluginPrivate::updateProject); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_commitProjectAction = new ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), ParameterAction::EnabledWithParameter, this); + m_commitProjectAction = new ParameterAction(Tr::tr("Commit Project"), Tr::tr("Commit Project \"%1\""), ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_commitProjectAction, CMD_ID_PROJECTCOMMIT, context); command->setAttribute(Command::CA_UpdateText); connect(m_commitProjectAction, &QAction::triggered, this, &CvsPluginPrivate::commitProject); @@ -655,14 +654,14 @@ CvsPluginPrivate::CvsPluginPrivate() cvsMenu->addSeparator(context); - m_updateDirectoryAction = new ParameterAction(tr("Update Directory"), tr("Update Directory \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); + m_updateDirectoryAction = new ParameterAction(Tr::tr("Update Directory"), Tr::tr("Update Directory \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_updateDirectoryAction, CMD_ID_UPDATE_DIRECTORY, context); command->setAttribute(Command::CA_UpdateText); connect(m_updateDirectoryAction, &QAction::triggered, this, &CvsPluginPrivate::updateDirectory); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_commitDirectoryAction = new ParameterAction(tr("Commit Directory"), tr("Commit Directory \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); + m_commitDirectoryAction = new ParameterAction(Tr::tr("Commit Directory"), Tr::tr("Commit Directory \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ActionManager::registerAction(m_commitDirectoryAction, CMD_ID_COMMIT_DIRECTORY, context); command->setAttribute(Command::CA_UpdateText); @@ -672,38 +671,38 @@ CvsPluginPrivate::CvsPluginPrivate() cvsMenu->addSeparator(context); - m_diffRepositoryAction = new QAction(tr("Diff Repository"), this); + m_diffRepositoryAction = new QAction(Tr::tr("Diff Repository"), this); command = ActionManager::registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, context); connect(m_diffRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::diffRepository); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_statusRepositoryAction = new QAction(tr("Repository Status"), this); + m_statusRepositoryAction = new QAction(Tr::tr("Repository Status"), this); command = ActionManager::registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, context); connect(m_statusRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::statusRepository); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_logRepositoryAction = new QAction(tr("Repository Log"), this); + m_logRepositoryAction = new QAction(Tr::tr("Repository Log"), this); command = ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, context); connect(m_logRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::logRepository); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_updateRepositoryAction = new QAction(tr("Update Repository"), this); + m_updateRepositoryAction = new QAction(Tr::tr("Update Repository"), this); command = ActionManager::registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, context); connect(m_updateRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::updateRepository); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_commitAllAction = new QAction(tr("Commit All Files"), this); + m_commitAllAction = new QAction(Tr::tr("Commit All Files"), this); command = ActionManager::registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL, context); connect(m_commitAllAction, &QAction::triggered, this, &CvsPluginPrivate::startCommitAll); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this); + m_revertRepositoryAction = new QAction(Tr::tr("Revert Repository..."), this); command = ActionManager::registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL, context); connect(m_revertRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::revertAll); @@ -843,8 +842,8 @@ void CvsPluginPrivate::revertAll() { const VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); - const QString title = tr("Revert Repository"); - if (!messageBoxQuestion(title, tr("Revert all pending changes to the repository?"))) + const QString title = Tr::tr("Revert Repository"); + if (!messageBoxQuestion(title, Tr::tr("Revert all pending changes to the repository?"))) return; QStringList args; args << QLatin1String("update") << QLatin1String("-C") << state.topLevel().toString(); @@ -854,7 +853,7 @@ void CvsPluginPrivate::revertAll() emit repositoryChanged(state.topLevel()); else Core::AsynchronousMessageBox::warning(title, - tr("Revert failed: %1").arg(revertResponse.message)); + Tr::tr("Revert failed: %1").arg(revertResponse.message)); } void CvsPluginPrivate::revertCurrentFile() @@ -877,7 +876,7 @@ void CvsPluginPrivate::revertCurrentFile() } if (!messageBoxQuestion(QLatin1String("CVS Revert"), - tr("The file has been changed. Do you want to revert it?"))) + Tr::tr("The file has been changed. Do you want to revert it?"))) return; FileChangeBlocker fcb(FilePath::fromString(state.currentFile())); @@ -942,7 +941,7 @@ void CvsPluginPrivate::startCommit(const FilePath &workingDir, const QString &fi if (raiseSubmitEditor()) return; if (isCommitEditorOpen()) { - VcsOutputWindow::appendWarning(tr("Another commit is currently being executed.")); + VcsOutputWindow::appendWarning(Tr::tr("Another commit is currently being executed.")); return; } @@ -965,7 +964,7 @@ void CvsPluginPrivate::startCommit(const FilePath &workingDir, const QString &fi } } if (statusOutput.empty()) { - VcsOutputWindow::appendWarning(tr("There are no modified files.")); + VcsOutputWindow::appendWarning(Tr::tr("There are no modified files.")); return; } m_commitRepository = workingDir; @@ -1143,9 +1142,9 @@ bool CvsPluginPrivate::unedit(const FilePath &topLevel, const QStringList &files return false; if (modified) { const QString question = files.isEmpty() ? - tr("Would you like to discard your changes to the repository \"%1\"?").arg(topLevel.toUserOutput()) : - tr("Would you like to discard your changes to the file \"%1\"?").arg(files.front()); - if (!messageBoxQuestion(tr("Unedit"), question)) + Tr::tr("Would you like to discard your changes to the repository \"%1\"?").arg(topLevel.toUserOutput()) : + Tr::tr("Would you like to discard your changes to the file \"%1\"?").arg(files.front()); + if (!messageBoxQuestion(Tr::tr("Unedit"), question)) return false; } @@ -1211,7 +1210,7 @@ void CvsPluginPrivate::projectStatus() { const VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasProject(), return); - status(state.currentProjectTopLevel(), state.relativeCurrentProject(), tr("Project status")); + status(state.currentProjectTopLevel(), state.relativeCurrentProject(), Tr::tr("Project status")); } void CvsPluginPrivate::commitProject() @@ -1232,7 +1231,7 @@ void CvsPluginPrivate::statusRepository() { const VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); - status(state.topLevel(), QString(), tr("Repository status")); + status(state.topLevel(), QString(), Tr::tr("Repository status")); } void CvsPluginPrivate::updateRepository() @@ -1248,7 +1247,7 @@ bool CvsPluginPrivate::describe(const QString &file, const QString &changeNr, QS FilePath toplevel; const bool manages = managesDirectory(FilePath::fromString(QFileInfo(file).absolutePath()), &toplevel); if (!manages || toplevel.isEmpty()) { - *errorMessage = tr("Cannot find repository for \"%1\".") + *errorMessage = Tr::tr("Cannot find repository for \"%1\".") .arg(QDir::toNativeSeparators(file)); return false; } @@ -1267,7 +1266,7 @@ bool CvsPluginPrivate::describe(const FilePath &toplevel, const QString &file, c // if desired. // Number must be > 1 if (isFirstRevision(changeNr)) { - *errorMessage = tr("The initial revision %1 cannot be described.").arg(changeNr); + *errorMessage = Tr::tr("The initial revision %1 cannot be described.").arg(changeNr); return false; } // Run log to obtain commit id and details @@ -1280,7 +1279,7 @@ bool CvsPluginPrivate::describe(const FilePath &toplevel, const QString &file, c } const QList<CvsLogEntry> fileLog = parseLogEntries(logResponse.stdOut); if (fileLog.empty() || fileLog.front().revisions.empty()) { - *errorMessage = tr("Parsing of the log output failed."); + *errorMessage = Tr::tr("Parsing of the log output failed."); return false; } if (m_settings.describeByCommitId.value()) { @@ -1302,7 +1301,7 @@ bool CvsPluginPrivate::describe(const FilePath &toplevel, const QString &file, c // Describe all files found, pass on dir to obtain correct absolute paths. const QList<CvsLogEntry> repoEntries = parseLogEntries(repoLogResponse.stdOut, QString(), commitId); if (repoEntries.empty()) { - *errorMessage = tr("Could not find commits of id \"%1\" on %2.").arg(commitId, dateS); + *errorMessage = Tr::tr("Could not find commits of id \"%1\" on %2.").arg(commitId, dateS); return false; } return describe(toplevel, repoEntries, errorMessage); @@ -1399,7 +1398,7 @@ CvsResponse CvsPluginPrivate::runCvs(const FilePath &workingDirectory, CvsResponse response; if (executable.isEmpty()) { response.result = CvsResponse::OtherError; - response.message =tr("No CVS executable specified."); + response.message = Tr::tr("No CVS executable specified."); return response; } @@ -1559,5 +1558,4 @@ void CvsPlugin::testLogResolving() } #endif -} // namespace Internal -} // namespace Cvs +} // namespace Cvs::Internal diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h index 8145454ae4a..127393046eb 100644 --- a/src/plugins/cvs/cvsplugin.h +++ b/src/plugins/cvs/cvsplugin.h @@ -5,8 +5,7 @@ #include <extensionsystem/iplugin.h> -namespace Cvs { -namespace Internal { +namespace Cvs::Internal { class CvsPlugin final : public ExtensionSystem::IPlugin { @@ -26,5 +25,4 @@ private slots: #endif }; -} // namespace Cvs -} // namespace Internal +} // namespace Cvs::Internal diff --git a/src/plugins/cvs/cvssettings.cpp b/src/plugins/cvs/cvssettings.cpp index 9983bd0986e..f87204face3 100644 --- a/src/plugins/cvs/cvssettings.cpp +++ b/src/plugins/cvs/cvssettings.cpp @@ -3,6 +3,8 @@ #include "cvssettings.h" +#include "cvstr.h" + #include <coreplugin/icore.h> #include <utils/hostosinfo.h> @@ -13,8 +15,7 @@ using namespace Utils; -namespace Cvs { -namespace Internal { +namespace Cvs::Internal { // CvsSettings @@ -27,13 +28,13 @@ CvsSettings::CvsSettings() binaryPath.setDisplayStyle(StringAspect::PathChooserDisplay); binaryPath.setExpectedKind(PathChooser::ExistingCommand); binaryPath.setHistoryCompleter(QLatin1String("Cvs.Command.History")); - binaryPath.setDisplayName(tr("CVS Command")); - binaryPath.setLabelText(tr("CVS command:")); + binaryPath.setDisplayName(Tr::tr("CVS Command")); + binaryPath.setLabelText(Tr::tr("CVS command:")); registerAspect(&cvsRoot); cvsRoot.setDisplayStyle(StringAspect::LineEditDisplay); cvsRoot.setSettingsKey("Root"); - cvsRoot.setLabelText(tr("CVS root:")); + cvsRoot.setLabelText(Tr::tr("CVS root:")); registerAspect(&diffOptions); diffOptions.setDisplayStyle(StringAspect::LineEditDisplay); @@ -44,8 +45,8 @@ CvsSettings::CvsSettings() registerAspect(&describeByCommitId); describeByCommitId.setSettingsKey("DescribeByCommitId"); describeByCommitId.setDefaultValue(true); - describeByCommitId.setLabelText(tr("Describe all files matching commit id")); - describeByCommitId.setToolTip(tr("When checked, all files touched by a commit will be " + describeByCommitId.setLabelText(Tr::tr("Describe all files matching commit id")); + describeByCommitId.setToolTip(Tr::tr("When checked, all files touched by a commit will be " "displayed when clicking on a revision number in the annotation view " "(retrieved via commit ID). Otherwise, only the respective file will be displayed.")); @@ -72,7 +73,7 @@ QStringList CvsSettings::addOptions(const QStringList &args) const CvsSettingsPage::CvsSettingsPage(CvsSettings *settings) { setId(VcsBase::Constants::VCS_ID_CVS); - setDisplayName(CvsSettings::tr("CVS")); + setDisplayName(Tr::tr("CVS")); setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY); setSettings(settings); @@ -82,14 +83,14 @@ CvsSettingsPage::CvsSettingsPage(CvsSettings *settings) Column { Group { - title(CvsSettings::tr("Configuration")), + title(Tr::tr("Configuration")), Form { s.binaryPath, s.cvsRoot } }, Group { - title(CvsSettings::tr("Miscellaneous")), + title(Tr::tr("Miscellaneous")), Column { Form { s.timeout, @@ -104,5 +105,4 @@ CvsSettingsPage::CvsSettingsPage(CvsSettings *settings) }); } -} // Internal -} // Cvs +} // Cvs::Internal diff --git a/src/plugins/cvs/cvssettings.h b/src/plugins/cvs/cvssettings.h index b3a061c3239..5d0495a2a67 100644 --- a/src/plugins/cvs/cvssettings.h +++ b/src/plugins/cvs/cvssettings.h @@ -7,13 +7,10 @@ #include <vcsbase/vcsbaseclientsettings.h> -namespace Cvs { -namespace Internal { +namespace Cvs::Internal { class CvsSettings : public VcsBase::VcsBaseSettings { - Q_DECLARE_TR_FUNCTIONS(Cvs::Internal::SettingsPage) - public: Utils::StringAspect cvsRoot; Utils::StringAspect diffOptions; @@ -32,5 +29,4 @@ public: explicit CvsSettingsPage(CvsSettings *settings); }; -} // namespace Internal -} // namespace Cvs +} // Cvs::Internal diff --git a/src/plugins/cvs/cvssubmiteditor.cpp b/src/plugins/cvs/cvssubmiteditor.cpp index e9052b70a22..a80e17ce643 100644 --- a/src/plugins/cvs/cvssubmiteditor.cpp +++ b/src/plugins/cvs/cvssubmiteditor.cpp @@ -3,17 +3,20 @@ #include "cvssubmiteditor.h" +#include "cvstr.h" + #include <vcsbase/submiteditorwidget.h> #include <vcsbase/submitfilemodel.h> -using namespace Cvs::Internal; using namespace VcsBase; +namespace Cvs::Internal { + CvsSubmitEditor::CvsSubmitEditor() : VcsBase::VcsBaseSubmitEditor(new SubmitEditorWidget), - m_msgAdded(tr("Added")), - m_msgRemoved(tr("Removed")), - m_msgModified(tr("Modified")) + m_msgAdded(Tr::tr("Added")), + m_msgRemoved(Tr::tr("Removed")), + m_msgModified(Tr::tr("Modified")) { } QString CvsSubmitEditor::stateName(State st) const @@ -39,3 +42,5 @@ void CvsSubmitEditor::setStateList(const StateFilePairs &statusOutput) model->addFile(it->second, stateName(it->first)); setFileModel(model); } + +} // Cvs::Internal diff --git a/src/plugins/cvs/cvssubmiteditor.h b/src/plugins/cvs/cvssubmiteditor.h index eb9a93c62f5..bbfa9dce17c 100644 --- a/src/plugins/cvs/cvssubmiteditor.h +++ b/src/plugins/cvs/cvssubmiteditor.h @@ -3,13 +3,12 @@ #pragma once +#include <vcsbase/vcsbasesubmiteditor.h> + #include <QPair> #include <QStringList> -#include <vcsbase/vcsbasesubmiteditor.h> - -namespace Cvs { -namespace Internal { +namespace Cvs::Internal { class CvsSubmitEditor : public VcsBase::VcsBaseSubmitEditor { @@ -33,5 +32,4 @@ private: const QString m_msgModified; }; -} // namespace Internal -} // namespace Cvs +} // Cvs::Internal diff --git a/src/plugins/cvs/cvstr.h b/src/plugins/cvs/cvstr.h index b987c5305b4..162f1d479aa 100644 --- a/src/plugins/cvs/cvstr.h +++ b/src/plugins/cvs/cvstr.h @@ -5,11 +5,11 @@ #include <QCoreApplication> -namespace CVS { +namespace Cvs { struct Tr { Q_DECLARE_TR_FUNCTIONS(CVS) }; -} // namespace CVS +} // Cvs diff --git a/src/plugins/cvs/cvsutils.cpp b/src/plugins/cvs/cvsutils.cpp index 8c96f43f040..252e0f5c393 100644 --- a/src/plugins/cvs/cvsutils.cpp +++ b/src/plugins/cvs/cvsutils.cpp @@ -8,8 +8,7 @@ #include <QRegularExpression> #include <QStringList> -namespace Cvs { -namespace Internal { +namespace Cvs::Internal { CvsRevision::CvsRevision(const QString &rev) : revision(rev) { } @@ -210,5 +209,4 @@ bool isFirstRevision(const QString &r) return r.endsWith(QLatin1String(".1")); } -} // namespace Internal -} // namespace Cvs +} // Cvs::Internal diff --git a/src/plugins/cvs/cvsutils.h b/src/plugins/cvs/cvsutils.h index b6bf341bf9e..7ab357a019e 100644 --- a/src/plugins/cvs/cvsutils.h +++ b/src/plugins/cvs/cvsutils.h @@ -8,8 +8,7 @@ #include <QString> #include <QList> -namespace Cvs { -namespace Internal { +namespace Cvs::Internal { // Utilities to parse output of a CVS log. @@ -54,5 +53,4 @@ QString previousRevision(const QString &rev); // Revision number utilities: Is it "[1.2...].1"? bool isFirstRevision(const QString &r); -} // namespace Internal -} // namespace Cvs +} // Cvs::Internal |