diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.h b/src/plugins/cmakeprojectmanager/cmakebuildstep.h
index f44474cdaac..b827b533650 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildstep.h
+++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.h
@@ -11,8 +11,7 @@ class CommandLine;
class StringAspect;
} // Utils
-namespace CMakeProjectManager {
-namespace Internal {
+namespace CMakeProjectManager::Internal {
class CMakeBuildStep;
@@ -123,5 +122,4 @@ public:
CMakeBuildStepFactory();
};
-} // namespace Internal
-} // namespace CMakeProjectManager
+} // CMakeProjectManager::Internal
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
index 43e354dbf09..5157f87b6ea 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
@@ -11,6 +11,7 @@
#include "cmakeproject.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectnodes.h"
+#include "cmakeprojectmanagertr.h"
#include "cmakeprojectplugin.h"
#include "cmakespecificsettings.h"
#include "projecttreehelper.h"
@@ -59,8 +60,7 @@
using namespace ProjectExplorer;
using namespace Utils;
-namespace CMakeProjectManager {
-namespace Internal {
+namespace CMakeProjectManager::Internal {
static void copySourcePathsToClipboard(const FilePaths &srcPaths, const ProjectNode *node)
{
@@ -92,8 +92,8 @@ static void noAutoAdditionNotify(const FilePaths &filePaths, const ProjectNode *
bool checkValue{false};
QDialogButtonBox::StandardButton reply = CheckableMessageBox::question(
Core::ICore::dialogParent(),
- QMessageBox::tr("Copy to Clipboard?"),
- QMessageBox::tr("Files are not automatically added to the "
+ Tr::tr("Copy to Clipboard?"),
+ Tr::tr("Files are not automatically added to the "
"CMakeLists.txt file of the CMake project."
"\nCopy the path to the source files to the clipboard?"),
"Remember My Choice",
@@ -359,7 +359,7 @@ void CMakeBuildSystem::setParametersAndRequestParse(const BuildDirParameters &pa
if (!tool || !tool->isValid()) {
TaskHub::addTask(
BuildSystemTask(Task::Error,
- tr("The kit needs to define a CMake tool to parse this project.")));
+ Tr::tr("The kit needs to define a CMake tool to parse this project.")));
return;
}
if (!tool->hasFileApi()) {
@@ -391,8 +391,8 @@ bool CMakeBuildSystem::mustApplyConfigurationChangesArguments(const BuildDirPara
return false;
int answer = QMessageBox::question(Core::ICore::dialogParent(),
- tr("Apply configuration changes?"),
- "" + tr("Run CMake with configuration changes?")
+ Tr::tr("Apply configuration changes?"),
+ "
" + Tr::tr("Run CMake with configuration changes?")
+ "
"
+ parameters.configurationChangesArguments.join("\n")
+ "
",
@@ -498,7 +498,7 @@ void CMakeBuildSystem::combineScanAndParse(bool restoredFromBackup)
if (restoredFromBackup)
project()->addIssue(
CMakeProject::IssueType::Warning,
- tr("CMake configuration failed"
+ Tr::tr("CMake configuration failed"
"The backup of the previous configuration has been restored.
"
"Issues and \"Projects > Build\" settings "
"show more information about the failure.
addIssue(
CMakeProject::IssueType::Warning,
- tr("Failed to load project"
+ Tr::tr("Failed to load project"
"Issues and \"Projects > Build\" settings "
"show more information about the failure.
displayName()),
"CMake.Scan.Tree");
}
@@ -853,13 +853,13 @@ void CMakeBuildSystem::ensureBuildDirectory(const BuildDirParameters ¶meters
const FilePath bdir = parameters.buildDirectory;
if (!buildConfiguration()->createBuildDirectory()) {
- handleParsingFailed(tr("Failed to create build directory \"%1\".").arg(bdir.toUserOutput()));
+ handleParsingFailed(Tr::tr("Failed to create build directory \"%1\".").arg(bdir.toUserOutput()));
return;
}
const CMakeTool *tool = parameters.cmakeTool();
if (!tool) {
- handleParsingFailed(tr("No CMake tool set up in kit."));
+ handleParsingFailed(Tr::tr("No CMake tool set up in kit."));
return;
}
@@ -867,7 +867,7 @@ void CMakeBuildSystem::ensureBuildDirectory(const BuildDirParameters ¶meters
if (!tool->cmakeExecutable().ensureReachable(bdir)) {
// Make sure that the build directory is available on the device.
handleParsingFailed(
- tr("The remote CMake executable cannot write to the local build directory."));
+ Tr::tr("The remote CMake executable cannot write to the local build directory."));
}
}
}
@@ -1337,5 +1337,4 @@ MakeInstallCommand CMakeBuildSystem::makeInstallCommand(const FilePath &installR
return cmd;
}
-} // namespace Internal
-} // namespace CMakeProjectManager
+} // CMakeProjectManager::Internal
diff --git a/src/plugins/cmakeprojectmanager/cmakeconfigitem.cpp b/src/plugins/cmakeprojectmanager/cmakeconfigitem.cpp
index 28dadbcd999..f3865a81f6e 100644
--- a/src/plugins/cmakeprojectmanager/cmakeconfigitem.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeconfigitem.cpp
@@ -3,6 +3,8 @@
#include "cmakeconfigitem.h"
+#include "cmakeprojectmanagertr.h"
+
#include
#include
@@ -337,8 +339,7 @@ CMakeConfig CMakeConfig::fromFile(const Utils::FilePath &cacheFile, QString *err
QFile cache(cacheFile.toString());
if (!cache.open(QIODevice::ReadOnly | QIODevice::Text)) {
if (errorMessage)
- *errorMessage = QCoreApplication::translate("CMakeProjectManager::CMakeConfigItem", "Failed to open %1 for reading.")
- .arg(cacheFile.toUserOutput());
+ *errorMessage = Tr::tr("Failed to open %1 for reading.").arg(cacheFile.toUserOutput());
return CMakeConfig();
}
diff --git a/src/plugins/cmakeprojectmanager/cmakeconfigitem.h b/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
index afec217cd1a..c5e771b1a3e 100644
--- a/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
+++ b/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
@@ -5,7 +5,6 @@
#include "cmake_global.h"
-
#include
#include
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
index 53dc1f30c60..e7463c40eae 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
@@ -21,13 +21,18 @@
using namespace Core;
using namespace TextEditor;
-namespace CMakeProjectManager {
-namespace Internal {
+namespace CMakeProjectManager::Internal {
//
// CMakeEditor
//
+class CMakeEditor : public TextEditor::BaseTextEditor
+{
+public:
+ void contextHelp(const HelpCallback &callback) const final;
+};
+
void CMakeEditor::contextHelp(const HelpCallback &callback) const
{
int pos = position();
@@ -239,5 +244,4 @@ CMakeEditorFactory::CMakeEditorFactory()
contextMenu->addAction(ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION));
}
-} // namespace Internal
-} // namespace CMakeProjectManager
+} // CMakeProjectManager::Internal
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.h b/src/plugins/cmakeprojectmanager/cmakeeditor.h
index fba93488b57..57e2e606877 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditor.h
+++ b/src/plugins/cmakeprojectmanager/cmakeeditor.h
@@ -5,20 +5,7 @@
#include
-namespace CMakeProjectManager {
-namespace Internal {
-
-class CMakeEditorWidget;
-
-class CMakeEditor : public TextEditor::BaseTextEditor
-{
- Q_OBJECT
-
-public:
- void contextHelp(const HelpCallback &callback) const override;
-
- friend class CMakeEditorWidget;
-};
+namespace CMakeProjectManager::Internal {
class CMakeEditorFactory : public TextEditor::TextEditorFactory
{
@@ -26,5 +13,4 @@ public:
CMakeEditorFactory();
};
-} // namespace Internal
-} // namespace CMakeProjectManager
+} // CMakeProjectManager::Internal
diff --git a/src/plugins/cmakeprojectmanager/cmakefilecompletionassist.cpp b/src/plugins/cmakeprojectmanager/cmakefilecompletionassist.cpp
index 44ee335b8e8..a06aae70d38 100644
--- a/src/plugins/cmakeprojectmanager/cmakefilecompletionassist.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakefilecompletionassist.cpp
@@ -14,18 +14,18 @@
#include
-using namespace CMakeProjectManager::Internal;
using namespace TextEditor;
using namespace ProjectExplorer;
-// -------------------------------
-// CMakeFileCompletionAssistProvider
-// -------------------------------
+namespace CMakeProjectManager::Internal {
-IAssistProcessor *CMakeFileCompletionAssistProvider::createProcessor(const AssistInterface *) const
+class CMakeFileCompletionAssist : public TextEditor::KeywordsCompletionAssistProcessor
{
- return new CMakeFileCompletionAssist;
-}
+public:
+ CMakeFileCompletionAssist();
+
+ TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface) final;
+};
CMakeFileCompletionAssist::CMakeFileCompletionAssist() :
KeywordsCompletionAssistProcessor(Keywords())
@@ -50,3 +50,10 @@ IAssistProposal *CMakeFileCompletionAssist::perform(const AssistInterface *inter
setKeywords(kw);
return KeywordsCompletionAssistProcessor::perform(interface);
}
+
+IAssistProcessor *CMakeFileCompletionAssistProvider::createProcessor(const AssistInterface *) const
+{
+ return new CMakeFileCompletionAssist;
+}
+
+} // CMakeProjectManager::Internal
diff --git a/src/plugins/cmakeprojectmanager/cmakefilecompletionassist.h b/src/plugins/cmakeprojectmanager/cmakefilecompletionassist.h
index 9ca0af0c756..026b29acd18 100644
--- a/src/plugins/cmakeprojectmanager/cmakefilecompletionassist.h
+++ b/src/plugins/cmakeprojectmanager/cmakefilecompletionassist.h
@@ -5,25 +5,12 @@
#include
-namespace CMakeProjectManager {
-namespace Internal {
-
-class CMakeFileCompletionAssist : public TextEditor::KeywordsCompletionAssistProcessor
-{
-public:
- CMakeFileCompletionAssist();
-
- // IAssistProcessor interface
- TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface) override;
-};
+namespace CMakeProjectManager::Internal {
class CMakeFileCompletionAssistProvider : public TextEditor::CompletionAssistProvider
{
- Q_OBJECT
-
public:
- TextEditor::IAssistProcessor *createProcessor(const TextEditor::AssistInterface *) const override;
+ TextEditor::IAssistProcessor *createProcessor(const TextEditor::AssistInterface *) const final;
};
-} // Internal
-} // CMakeProjectManager
+} // CMakeProjectManager::Internal
diff --git a/src/plugins/cmakeprojectmanager/cmakeindenter.cpp b/src/plugins/cmakeprojectmanager/cmakeindenter.cpp
index 49eff068f13..a9a2aeaaafb 100644
--- a/src/plugins/cmakeprojectmanager/cmakeindenter.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeindenter.cpp
@@ -3,8 +3,7 @@
#include "cmakeindenter.h"
-namespace CMakeProjectManager {
-namespace Internal {
+namespace CMakeProjectManager::Internal {
CMakeIndenter::CMakeIndenter(QTextDocument *doc)
: TextEditor::TextIndenter(doc)
@@ -111,7 +110,4 @@ int CMakeIndenter::indentFor(const QTextBlock &block,
return qMax(0, indentation);
}
-} // namespace Internal
-} // namespace CMakeProjectManager
-
-
+} // CMakeProjectManager::Internal
diff --git a/src/plugins/cmakeprojectmanager/cmakeindenter.h b/src/plugins/cmakeprojectmanager/cmakeindenter.h
index ce30b220d6f..ad85f8a26cc 100644
--- a/src/plugins/cmakeprojectmanager/cmakeindenter.h
+++ b/src/plugins/cmakeprojectmanager/cmakeindenter.h
@@ -7,8 +7,7 @@
#include
-namespace CMakeProjectManager {
-namespace Internal {
+namespace CMakeProjectManager::Internal {
class CMAKE_EXPORT CMakeIndenter : public TextEditor::TextIndenter
{
@@ -21,5 +20,4 @@ public:
int cursorPositionInEditor = -1) override;
};
-} // namespace Internal
-} // namespace CMakeProjectManager
+} // CMakeProjectManager::Internal
diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp
index 1fa255809e2..22e963a1be4 100644
--- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp
@@ -1,10 +1,11 @@
// Copyright (C) 2016 Canonical Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
-#include "cmakeconfigitem.h"
#include "cmakekitinformation.h"
+#include "cmakeconfigitem.h"
#include "cmakeprojectconstants.h"
+#include "cmakeprojectmanagertr.h"
#include "cmakeprojectplugin.h"
#include "cmakespecificsettings.h"
#include "cmaketool.h"
@@ -50,9 +51,6 @@ using namespace ProjectExplorer;
using namespace Utils;
namespace CMakeProjectManager {
-// --------------------------------------------------------------------
-// CMakeKitAspect:
-// --------------------------------------------------------------------
static bool isIos(const Kit *k)
{
@@ -69,7 +67,6 @@ static Id defaultCMakeToolId()
class CMakeKitAspectWidget final : public KitAspectWidget
{
- Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeKitAspect)
public:
CMakeKitAspectWidget(Kit *kit, const KitAspect *ki) : KitAspectWidget(kit, ki),
m_comboBox(createSubWidget()),
@@ -137,7 +134,7 @@ private:
m_comboBox->removeItem(pos);
if (m_comboBox->count() == 0) {
- m_comboBox->addItem(tr(""), Id().toSetting());
+ m_comboBox->addItem(Tr::tr(""), Id().toSetting());
m_comboBox->setEnabled(false);
} else {
m_comboBox->setEnabled(true);
@@ -199,8 +196,8 @@ CMakeKitAspect::CMakeKitAspect()
{
setObjectName(QLatin1String("CMakeKitAspect"));
setId(Constants::TOOL_ID);
- setDisplayName(tr("CMake Tool"));
- setDescription(tr("The CMake Tool to use when building a project with CMake.
"
+ setDisplayName(Tr::tr("CMake Tool"));
+ setDescription(Tr::tr("The CMake Tool to use when building a project with CMake.
"
"This setting is ignored when using other build systems."));
setPriority(20000);
@@ -278,7 +275,7 @@ void CMakeKitAspect::fix(Kit *k)
KitAspect::ItemList CMakeKitAspect::toUserOutput(const Kit *k) const
{
const CMakeTool *const tool = cmakeTool(k);
- return {{tr("CMake"), tool ? tool->displayName() : tr("Unconfigured")}};
+ return {{Tr::tr("CMake"), tool ? tool->displayName() : Tr::tr("Unconfigured")}};
}
KitAspectWidget *CMakeKitAspect::createConfigWidget(Kit *k) const
@@ -290,7 +287,7 @@ KitAspectWidget *CMakeKitAspect::createConfigWidget(Kit *k) const
void CMakeKitAspect::addToMacroExpander(Kit *k, MacroExpander *expander) const
{
QTC_ASSERT(k, return);
- expander->registerFileVariables("CMake:Executable", tr("Path to the cmake executable"),
+ expander->registerFileVariables("CMake:Executable", Tr::tr("Path to the cmake executable"),
[k] {
CMakeTool *tool = CMakeKitAspect::cmakeTool(k);
return tool ? tool->cmakeExecutable() : FilePath();
@@ -306,7 +303,7 @@ QSet CMakeKitAspect::availableFeatures(const Kit *k) const
QString CMakeKitAspect::msgUnsupportedVersion(const QByteArray &versionString)
{
- return tr("CMake version %1 is unsupported. Update to "
+ return Tr::tr("CMake version %1 is unsupported. Update to "
"version 3.14 (with file-api) or later.")
.arg(QString::fromUtf8(versionString));
}
@@ -324,8 +321,6 @@ const char TOOLSET_KEY[] = "Toolset";
class CMakeGeneratorKitAspectWidget final : public KitAspectWidget
{
- Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeGeneratorKitAspect)
-
public:
CMakeGeneratorKitAspectWidget(Kit *kit, const KitAspect *ki)
: KitAspectWidget(kit, ki),
@@ -338,7 +333,7 @@ public:
});
m_label->setToolTip(ki->description());
- m_changeButton->setText(tr("Change..."));
+ m_changeButton->setText(Tr::tr("Change..."));
refresh();
connect(m_changeButton, &QPushButton::clicked,
this, &CMakeGeneratorKitAspectWidget::changeGenerator);
@@ -380,9 +375,9 @@ private:
messageLabel << generator;
if (!platform.isEmpty())
- messageLabel << ", " << tr("Platform") << ": " << platform;
+ messageLabel << ", " << Tr::tr("Platform") << ": " << platform;
if (!toolset.isEmpty())
- messageLabel << ", " << tr("Toolset") << ": " << toolset;
+ messageLabel << ", " << Tr::tr("Toolset") << ": " << toolset;
m_label->setText(messageLabel.join(""));
}
@@ -396,7 +391,7 @@ private:
flags |= Qt::MSWindowsFixedSizeDialogHint;
changeDialog->setWindowFlags(flags);
- changeDialog->setWindowTitle(tr("CMake Generator"));
+ changeDialog->setWindowTitle(Tr::tr("CMake Generator"));
auto layout = new QGridLayout(changeDialog);
layout->setSizeConstraint(QLayout::SetFixedSize);
@@ -414,19 +409,19 @@ private:
layout->addWidget(cmakeLabel, row, 1);
++row;
- layout->addWidget(new QLabel(tr("Generator:")), row, 0);
+ layout->addWidget(new QLabel(Tr::tr("Generator:")), row, 0);
layout->addWidget(generatorCombo, row, 1);
++row;
- layout->addWidget(new QLabel(tr("Extra generator:")), row, 0);
+ layout->addWidget(new QLabel(Tr::tr("Extra generator:")), row, 0);
layout->addWidget(extraGeneratorCombo, row, 1);
++row;
- layout->addWidget(new QLabel(tr("Platform:")), row, 0);
+ layout->addWidget(new QLabel(Tr::tr("Platform:")), row, 0);
layout->addWidget(platformEdit, row, 1);
++row;
- layout->addWidget(new QLabel(tr("Toolset:")), row, 0);
+ layout->addWidget(new QLabel(Tr::tr("Toolset:")), row, 0);
layout->addWidget(toolsetEdit, row, 1);
++row;
@@ -452,7 +447,7 @@ private:
generatorCombo->setCurrentText(name);
extraGeneratorCombo->clear();
- extraGeneratorCombo->addItem(tr(""), QString());
+ extraGeneratorCombo->addItem(Tr::tr(""), QString());
for (const QString &eg : qAsConst(it->extraGenerators))
extraGeneratorCombo->addItem(eg, eg);
extraGeneratorCombo->setEnabled(extraGeneratorCombo->count() > 1);
@@ -550,8 +545,8 @@ CMakeGeneratorKitAspect::CMakeGeneratorKitAspect()
{
setObjectName(QLatin1String("CMakeGeneratorKitAspect"));
setId(GENERATOR_ID);
- setDisplayName(tr("CMake generator"));
- setDescription(tr("CMake generator defines how a project is built when using CMake.
"
+ setDisplayName(Tr::tr("CMake generator"));
+ setDescription(Tr::tr("CMake generator defines how a project is built when using CMake.
"
"This setting is ignored when using other build systems."));
setPriority(19000);
}
@@ -755,7 +750,7 @@ Tasks CMakeGeneratorKitAspect::validate(const Kit *k) const
};
if (!tool->isValid()) {
- addWarning(tr("CMake Tool is unconfigured, CMake generator will be ignored."));
+ addWarning(Tr::tr("CMake Tool is unconfigured, CMake generator will be ignored."));
} else {
const GeneratorInfo info = generatorInfo(k);
QList known = tool->supportedGenerators();
@@ -763,15 +758,15 @@ Tasks CMakeGeneratorKitAspect::validate(const Kit *k) const
return g.matches(info.generator, info.extraGenerator);
});
if (it == known.constEnd()) {
- addWarning(tr("CMake Tool does not support the configured generator."));
+ addWarning(Tr::tr("CMake Tool does not support the configured generator."));
} else {
if (!it->supportsPlatform && !info.platform.isEmpty())
- addWarning(tr("Platform is not supported by the selected CMake generator."));
+ addWarning(Tr::tr("Platform is not supported by the selected CMake generator."));
if (!it->supportsToolset && !info.toolset.isEmpty())
- addWarning(tr("Toolset is not supported by the selected CMake generator."));
+ addWarning(Tr::tr("Toolset is not supported by the selected CMake generator."));
}
if (!tool->hasFileApi()) {
- addWarning(tr("The selected CMake binary does not support file-api. "
+ addWarning(Tr::tr("The selected CMake binary does not support file-api. "
"%1 will not be able to parse CMake projects.")
.arg(Core::Constants::IDE_DISPLAY_NAME));
}
@@ -838,15 +833,15 @@ KitAspect::ItemList CMakeGeneratorKitAspect::toUserOutput(const Kit *k) const
const GeneratorInfo info = generatorInfo(k);
QString message;
if (info.generator.isEmpty()) {
- message = tr("