diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts
index 46778d36538..2b559725b72 100644
--- a/share/qtcreator/translations/qtcreator_de.ts
+++ b/share/qtcreator/translations/qtcreator_de.ts
@@ -43156,14 +43156,11 @@ Was soll %1 tun?
- Cppcheck::Internal::CppcheckOptionsPage
+ Cppcheck
Cppcheck
Cppcheck
-
-
- Cppcheck::Internal::CppcheckTool
Cppcheck started: "%1".
Cppcheck gestartet: "%1".
@@ -43357,7 +43354,7 @@ Was soll %1 tun?
- CppcheckOptionsPage
+ Cppcheck
Warnings
Warnungen
@@ -46119,14 +46116,11 @@ Doppelklicken Sie einen Eintrag um ihn zu ändern.
- Cppcheck::Internal::DiagnosticsModel
+ Cppcheck
Diagnostic
Diagnose
-
-
- Cppcheck::Internal::ManualRunDialog
Cppcheck Run Configuration
@@ -46135,13 +46129,6 @@ Doppelklicken Sie einen Eintrag um ihn zu ändern.
Analyze
Analysieren
-
-
- Cppcheck::Internal::CppcheckPlugin
-
- Cppcheck
- Cppcheck
-
Go to previous diagnostic.
Gehe zum vorherigen Eintrag.
@@ -53131,7 +53118,7 @@ in "%2" aus.
- Cppcheck::Internal::DiagnosticView
+ Cppcheck
Cppcheck Diagnostics
diff --git a/share/qtcreator/translations/qtcreator_hr.ts b/share/qtcreator/translations/qtcreator_hr.ts
index afbd4338121..4ff65b24e28 100644
--- a/share/qtcreator/translations/qtcreator_hr.ts
+++ b/share/qtcreator/translations/qtcreator_hr.ts
@@ -20134,7 +20134,7 @@ u kontrolu verzija (%2)
- CppcheckOptionsPage
+ Cppcheck
Warnings
Upozorenja
@@ -20215,23 +20215,14 @@ u kontrolu verzija (%2)
Ignored file patterns:
Zanemari mustre datoteke:
-
-
- Cppcheck::Internal::CppcheckOptionsPage
Cppcheck
Cppcheck
-
-
- Cppcheck::Internal::CppcheckRunner
Cppcheck failed to start: "%1".
Cppcheck se nije uspio pokrenuti: "%1".
-
-
- Cppcheck::Internal::CppcheckTool
Cppcheck started: "%1".
Cppcheck je pokrenut: "%1".
diff --git a/share/qtcreator/translations/qtcreator_ja.ts b/share/qtcreator/translations/qtcreator_ja.ts
index 90fd6cf1c7a..a57e43e6695 100644
--- a/share/qtcreator/translations/qtcreator_ja.ts
+++ b/share/qtcreator/translations/qtcreator_ja.ts
@@ -48204,14 +48204,11 @@ Continue?
- Cppcheck::Internal::DiagnosticsModel
+ Cppcheck
Diagnostic
診断
-
-
- CppcheckOptionsPage
Warnings
警告
@@ -48228,9 +48225,6 @@ Continue?
Ignored file patterns:
無視するファイルパターン:
-
-
- Cppcheck::Internal::CppcheckPlugin
Clear
クリア
diff --git a/share/qtcreator/translations/qtcreator_ru.ts b/share/qtcreator/translations/qtcreator_ru.ts
index 4f79054c489..8cf77522647 100644
--- a/share/qtcreator/translations/qtcreator_ru.ts
+++ b/share/qtcreator/translations/qtcreator_ru.ts
@@ -12897,14 +12897,7 @@ Flags: %3
- Cppcheck::Internal::CppcheckOptionsPage
-
- Cppcheck
- Cppcheck
-
-
-
- Cppcheck::Internal::CppcheckPlugin
+ Cppcheck
Cppcheck
Cppcheck
@@ -12925,16 +12918,10 @@ Flags: %3
Cppcheck...
Cppcheck...
-
-
- Cppcheck::Internal::CppcheckRunner
Cppcheck failed to start: "%1".
Не удалось запустить Cppcheck: «%1».
-
-
- Cppcheck::Internal::CppcheckTool
Cppcheck started: "%1".
Cppcheck запустился: «%1».
@@ -12943,23 +12930,14 @@ Flags: %3
Cppcheck finished.
Cppcheck завершился.
-
-
- Cppcheck::Internal::DiagnosticView
Cppcheck Diagnostics
Проблемы Cppcheck
-
-
- Cppcheck::Internal::DiagnosticsModel
Diagnostic
Проблема
-
-
- Cppcheck::Internal::ManualRunDialog
Cppcheck Run Configuration
Конфигурация запуска Cppcheck
@@ -12968,9 +12946,6 @@ Flags: %3
Analyze
Анализировать
-
-
- CppcheckOptionsPage
Warnings
Предупреждения
diff --git a/share/qtcreator/translations/qtcreator_zh_CN.ts b/share/qtcreator/translations/qtcreator_zh_CN.ts
index 4e762e83311..66eb38cb672 100644
--- a/share/qtcreator/translations/qtcreator_zh_CN.ts
+++ b/share/qtcreator/translations/qtcreator_zh_CN.ts
@@ -14006,14 +14006,7 @@ e.g. name = "m_test_foo_":
- Cppcheck::Internal::CppcheckOptionsPage
-
- Cppcheck
-
-
-
-
- Cppcheck::Internal::CppcheckPlugin
+ Cppcheck
Cppcheck
@@ -14034,9 +14027,6 @@ e.g. name = "m_test_foo_":
Cppcheck...
-
-
- Cppcheck::Internal::CppcheckTool
Cppcheck started: "%1".
@@ -14045,23 +14035,14 @@ e.g. name = "m_test_foo_":
Cppcheck finished.
-
-
- Cppcheck::Internal::DiagnosticView
Cppcheck Diagnostics
-
-
- Cppcheck::Internal::DiagnosticsModel
Diagnostic
-
-
- Cppcheck::Internal::ManualRunDialog
Cppcheck Run Configuration
@@ -14070,9 +14051,6 @@ e.g. name = "m_test_foo_":
Analyze
分析
-
-
- CppcheckOptionsPage
Warnings
diff --git a/src/plugins/cppcheck/cppcheckconstants.h b/src/plugins/cppcheck/cppcheckconstants.h
index e4bf9b04b69..6efbb2f6158 100644
--- a/src/plugins/cppcheck/cppcheckconstants.h
+++ b/src/plugins/cppcheck/cppcheckconstants.h
@@ -3,8 +3,7 @@
#pragma once
-namespace Cppcheck {
-namespace Constants {
+namespace Cppcheck::Constants {
const char TEXTMARK_CATEGORY_ID[] = "Cppcheck";
@@ -33,5 +32,4 @@ const char MANUAL_CHECK_PROGRESS_ID[] = "Cppcheck.ManualCheckingTask";
const char MANUAL_RUN_ACTION[] = "Cppcheck.ManualRun";
const char PERSPECTIVE_ID[] = "Cppcheck.Perspective";
-} // namespace Constants
-} // namespace Cppcheck
+} // Cppcheck::Constants
diff --git a/src/plugins/cppcheck/cppcheckdiagnostic.cpp b/src/plugins/cppcheck/cppcheckdiagnostic.cpp
index 9d3128673c7..d16c7b06e29 100644
--- a/src/plugins/cppcheck/cppcheckdiagnostic.cpp
+++ b/src/plugins/cppcheck/cppcheckdiagnostic.cpp
@@ -3,8 +3,7 @@
#include "cppcheckdiagnostic.h"
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
bool Diagnostic::operator==(const Diagnostic &r) const
{
@@ -16,5 +15,5 @@ size_t qHash(const Diagnostic &diagnostic)
{
return qHash(diagnostic.message) ^ qHash(diagnostic.fileName) ^ diagnostic.lineNumber;
}
-} // namespace Internal
+
} // namespace Cppcheck
diff --git a/src/plugins/cppcheck/cppcheckdiagnostic.h b/src/plugins/cppcheck/cppcheckdiagnostic.h
index e5db7aa7472..5450429e8eb 100644
--- a/src/plugins/cppcheck/cppcheckdiagnostic.h
+++ b/src/plugins/cppcheck/cppcheckdiagnostic.h
@@ -3,10 +3,9 @@
#pragma once
-#include
+#include
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
class Diagnostic final
{
@@ -29,5 +28,4 @@ public:
size_t qHash(const Diagnostic &diagnostic);
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppcheckdiagnosticmanager.h b/src/plugins/cppcheck/cppcheckdiagnosticmanager.h
index 7d456ef563e..699393f9efb 100644
--- a/src/plugins/cppcheck/cppcheckdiagnosticmanager.h
+++ b/src/plugins/cppcheck/cppcheckdiagnosticmanager.h
@@ -3,8 +3,7 @@
#pragma once
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
class Diagnostic;
@@ -15,5 +14,4 @@ public:
virtual void add(const Diagnostic &diagnostic) = 0;
};
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppcheckdiagnosticsmodel.cpp b/src/plugins/cppcheck/cppcheckdiagnosticsmodel.cpp
index c85bea45a83..a2f87b8cd8b 100644
--- a/src/plugins/cppcheck/cppcheckdiagnosticsmodel.cpp
+++ b/src/plugins/cppcheck/cppcheckdiagnosticsmodel.cpp
@@ -3,16 +3,17 @@
#include "cppcheckdiagnosticsmodel.h"
+#include "cppchecktr.h"
+
#include
#include
#include
-namespace Cppcheck {
-namespace Internal {
-
using namespace Debugger;
+namespace Cppcheck::Internal {
+
FilePathItem::FilePathItem(const QString &filePath)
: m_filePath(filePath)
{}
@@ -83,7 +84,7 @@ QVariant DiagnosticItem::data(int column, int role) const
DiagnosticsModel::DiagnosticsModel(QObject *parent)
: BaseModel(parent)
{
- setHeader({tr("Diagnostic")});
+ setHeader({Tr::tr("Diagnostic")});
}
void DiagnosticsModel::clear()
@@ -116,5 +117,4 @@ void DiagnosticsModel::add(const Diagnostic &diagnostic)
filePathItem->appendChild(new DiagnosticItem(diagnostic));
}
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppcheckdiagnosticsmodel.h b/src/plugins/cppcheck/cppcheckdiagnosticsmodel.h
index faf2a1c81c6..efa3a838941 100644
--- a/src/plugins/cppcheck/cppcheckdiagnosticsmodel.h
+++ b/src/plugins/cppcheck/cppcheckdiagnosticsmodel.h
@@ -10,8 +10,7 @@
#include
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
class DiagnosticsModel;
@@ -55,5 +54,4 @@ private:
QSet m_diagnostics;
};
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppcheckdiagnosticview.cpp b/src/plugins/cppcheck/cppcheckdiagnosticview.cpp
index f20332e79d4..2976fffbb10 100644
--- a/src/plugins/cppcheck/cppcheckdiagnosticview.cpp
+++ b/src/plugins/cppcheck/cppcheckdiagnosticview.cpp
@@ -3,15 +3,16 @@
#include "cppcheckdiagnosticview.h"
+#include "cppchecktr.h"
+
#include
#include
-namespace Cppcheck {
-namespace Internal {
-
using namespace Debugger;
+namespace Cppcheck::Internal {
+
DiagnosticView::DiagnosticView(QWidget *parent)
: DetailedErrorView(parent)
{
@@ -21,7 +22,7 @@ DiagnosticView::DiagnosticView(QWidget *parent)
setAutoScroll(false);
sortByColumn(DiagnosticColumn, Qt::AscendingOrder);
setObjectName("CppcheckIssuesView");
- setWindowTitle(tr("Cppcheck Diagnostics"));
+ setWindowTitle(Tr::tr("Cppcheck Diagnostics"));
setHeaderHidden(true);
}
@@ -90,7 +91,4 @@ void DiagnosticView::mouseDoubleClickEvent(QMouseEvent *event)
DetailedErrorView::mouseDoubleClickEvent(event);
}
-} // namespace Internal
-} // namespace Cppcheck
-
-//#include "clangtoolsdiagnosticview.moc"
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppcheckdiagnosticview.h b/src/plugins/cppcheck/cppcheckdiagnosticview.h
index b31a5232082..bff7a69dc9f 100644
--- a/src/plugins/cppcheck/cppcheckdiagnosticview.h
+++ b/src/plugins/cppcheck/cppcheckdiagnosticview.h
@@ -5,12 +5,10 @@
#include
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
class DiagnosticView : public Debugger::DetailedErrorView
{
- Q_OBJECT
public:
explicit DiagnosticView(QWidget *parent = nullptr);
~DiagnosticView() override;
@@ -23,5 +21,4 @@ private:
void mouseDoubleClickEvent(QMouseEvent *event) override;
};
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppcheckmanualrundialog.cpp b/src/plugins/cppcheck/cppcheckmanualrundialog.cpp
index 0847e94f149..1f53e6835bd 100644
--- a/src/plugins/cppcheck/cppcheckmanualrundialog.cpp
+++ b/src/plugins/cppcheck/cppcheckmanualrundialog.cpp
@@ -2,7 +2,9 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "cppcheckmanualrundialog.h"
+
#include "cppcheckoptions.h"
+#include "cppchecktr.h"
#include
@@ -14,8 +16,7 @@
#include
#include
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
ManualRunDialog::ManualRunDialog(const CppcheckOptions &options,
const ProjectExplorer::Project *project)
@@ -25,7 +26,7 @@ ManualRunDialog::ManualRunDialog(const CppcheckOptions &options,
{
QTC_ASSERT(project, return );
- setWindowTitle(tr("Cppcheck Run Configuration"));
+ setWindowTitle(Tr::tr("Cppcheck Run Configuration"));
auto view = new QTreeView;
view->setHeaderHidden(true);
@@ -45,7 +46,7 @@ ManualRunDialog::ManualRunDialog(const CppcheckOptions &options,
connect(buttons, &QDialogButtonBox::rejected,
this, &QDialog::reject);
- auto analyzeButton = new QPushButton(tr("Analyze"));
+ auto analyzeButton = new QPushButton(Tr::tr("Analyze"));
buttons->addButton(analyzeButton, QDialogButtonBox::AcceptRole);
analyzeButton->setEnabled(m_model->hasCheckedFiles());
connect(m_model, &QAbstractItemModel::dataChanged,
@@ -82,5 +83,4 @@ QSize ManualRunDialog::sizeHint() const
return {original.width() * 2, original.height()};
}
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppcheckmanualrundialog.h b/src/plugins/cppcheck/cppcheckmanualrundialog.h
index 19019a65276..8ffadcc48a2 100644
--- a/src/plugins/cppcheck/cppcheckmanualrundialog.h
+++ b/src/plugins/cppcheck/cppcheckmanualrundialog.h
@@ -8,22 +8,20 @@
namespace Utils {
class FilePath;
using FilePaths = QList;
-} // namespace Utils
+} // Utils
namespace ProjectExplorer {
class Project;
class SelectableFilesFromDirModel;
-} // namespace ProjectExplorer
+} // ProjectExplorer
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
class OptionsWidget;
class CppcheckOptions;
class ManualRunDialog : public QDialog
{
- Q_OBJECT
public:
ManualRunDialog(const CppcheckOptions &options,
const ProjectExplorer::Project *project);
@@ -37,5 +35,4 @@ private:
ProjectExplorer::SelectableFilesFromDirModel *m_model;
};
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppcheckoptions.cpp b/src/plugins/cppcheck/cppcheckoptions.cpp
index c9304d4f8e4..e78f2d59fe9 100644
--- a/src/plugins/cppcheck/cppcheckoptions.cpp
+++ b/src/plugins/cppcheck/cppcheckoptions.cpp
@@ -1,9 +1,11 @@
// Copyright (C) 2018 Sergey Morozov
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include "cppcheckconstants.h"
#include "cppcheckoptions.h"
+
+#include "cppcheckconstants.h"
#include "cppchecktool.h"
+#include "cppchecktr.h"
#include "cppchecktrigger.h"
#include
@@ -22,26 +24,25 @@
using namespace Utils;
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
OptionsWidget::OptionsWidget(QWidget *parent)
: QWidget(parent),
m_binary(new Utils::PathChooser(this)),
m_customArguments(new QLineEdit(this)),
m_ignorePatterns(new QLineEdit(this)),
- m_warning(new QCheckBox(tr("Warnings"), this)),
- m_style(new QCheckBox(tr("Style"), this)),
- m_performance(new QCheckBox(tr("Performance"), this)),
- m_portability(new QCheckBox(tr("Portability"), this)),
- m_information(new QCheckBox(tr("Information"), this)),
- m_unusedFunction(new QCheckBox(tr("Unused functions"), this)),
- m_missingInclude(new QCheckBox(tr("Missing includes"), this)),
- m_inconclusive(new QCheckBox(tr("Inconclusive errors"), this)),
- m_forceDefines(new QCheckBox(tr("Check all define combinations"), this)),
- m_showOutput(new QCheckBox(tr("Show raw output"), this)),
- m_addIncludePaths(new QCheckBox(tr("Add include paths"), this)),
- m_guessArguments(new QCheckBox(tr("Calculate additional arguments"), this))
+ m_warning(new QCheckBox(Tr::tr("Warnings"), this)),
+ m_style(new QCheckBox(Tr::tr("Style"), this)),
+ m_performance(new QCheckBox(Tr::tr("Performance"), this)),
+ m_portability(new QCheckBox(Tr::tr("Portability"), this)),
+ m_information(new QCheckBox(Tr::tr("Information"), this)),
+ m_unusedFunction(new QCheckBox(Tr::tr("Unused functions"), this)),
+ m_missingInclude(new QCheckBox(Tr::tr("Missing includes"), this)),
+ m_inconclusive(new QCheckBox(Tr::tr("Inconclusive errors"), this)),
+ m_forceDefines(new QCheckBox(Tr::tr("Check all define combinations"), this)),
+ m_showOutput(new QCheckBox(Tr::tr("Show raw output"), this)),
+ m_addIncludePaths(new QCheckBox(Tr::tr("Add include paths"), this)),
+ m_guessArguments(new QCheckBox(Tr::tr("Calculate additional arguments"), this))
{
m_binary->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_binary->setCommandVersionArguments({"--version"});
@@ -49,18 +50,18 @@ OptionsWidget::OptionsWidget(QWidget *parent)
auto variableChooser = new Utils::VariableChooser(this);
variableChooser->addSupportedWidget (m_customArguments);
- m_unusedFunction->setToolTip(tr("Disables multithreaded check."));
- m_ignorePatterns->setToolTip(tr("Comma-separated wildcards of full file paths. "
- "Files still can be checked if others include them."));
- m_addIncludePaths->setToolTip(tr("Can find missing includes but makes "
- "checking slower. Use only when needed."));
- m_guessArguments->setToolTip(tr("Like C++ standard and language."));
+ m_unusedFunction->setToolTip(Tr::tr("Disables multithreaded check."));
+ m_ignorePatterns->setToolTip(Tr::tr("Comma-separated wildcards of full file paths. "
+ "Files still can be checked if others include them."));
+ m_addIncludePaths->setToolTip(Tr::tr("Can find missing includes but makes "
+ "checking slower. Use only when needed."));
+ m_guessArguments->setToolTip(Tr::tr("Like C++ standard and language."));
auto layout = new QFormLayout(this);
- layout->addRow(tr("Binary:"), m_binary);
+ layout->addRow(Tr::tr("Binary:"), m_binary);
auto checks = new Utils::FlowLayout;
- layout->addRow(tr("Checks:"), checks);
+ layout->addRow(Tr::tr("Checks:"), checks);
checks->addWidget(m_warning);
checks->addWidget(m_style);
checks->addWidget(m_performance);
@@ -69,8 +70,8 @@ OptionsWidget::OptionsWidget(QWidget *parent)
checks->addWidget(m_unusedFunction);
checks->addWidget(m_missingInclude);
- layout->addRow(tr("Custom arguments:"), m_customArguments);
- layout->addRow(tr("Ignored file patterns:"), m_ignorePatterns);
+ layout->addRow(Tr::tr("Custom arguments:"), m_customArguments);
+ layout->addRow(Tr::tr("Ignored file patterns:"), m_ignorePatterns);
auto flags = new Utils::FlowLayout;
layout->addRow(flags);
flags->addWidget(m_inconclusive);
@@ -123,7 +124,7 @@ CppcheckOptionsPage::CppcheckOptionsPage(CppcheckTool &tool, CppcheckTrigger &tr
m_trigger(trigger)
{
setId(Constants::OPTIONS_PAGE_ID);
- setDisplayName(tr("Cppcheck"));
+ setDisplayName(Tr::tr("Cppcheck"));
setCategory("T.Analyzer");
setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer"));
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
@@ -225,5 +226,4 @@ void CppcheckOptionsPage::load(CppcheckOptions &options) const
s->endGroup();
}
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppcheckoptions.h b/src/plugins/cppcheck/cppcheckoptions.h
index 8523660cca1..7c23d69f605 100644
--- a/src/plugins/cppcheck/cppcheckoptions.h
+++ b/src/plugins/cppcheck/cppcheckoptions.h
@@ -17,8 +17,7 @@ QT_END_NAMESPACE
namespace Utils { class PathChooser; }
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
class CppcheckTool;
class CppcheckTrigger;
@@ -48,7 +47,6 @@ public:
class OptionsWidget final : public QWidget
{
- Q_DECLARE_TR_FUNCTIONS(CppcheckOptionsPage)
public:
explicit OptionsWidget(QWidget *parent = nullptr);
void load(const CppcheckOptions &options);
@@ -74,7 +72,6 @@ private:
class CppcheckOptionsPage final : public Core::IOptionsPage
{
- Q_OBJECT
public:
explicit CppcheckOptionsPage(CppcheckTool &tool, CppcheckTrigger &trigger);
@@ -91,5 +88,4 @@ private:
QPointer m_widget;
};
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppcheckplugin.cpp b/src/plugins/cppcheck/cppcheckplugin.cpp
index 76c88b8116d..33afa6c43de 100644
--- a/src/plugins/cppcheck/cppcheckplugin.cpp
+++ b/src/plugins/cppcheck/cppcheckplugin.cpp
@@ -2,10 +2,12 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "cppcheckplugin.h"
+
#include "cppcheckconstants.h"
#include "cppcheckdiagnosticview.h"
#include "cppchecktextmarkmanager.h"
#include "cppchecktool.h"
+#include "cppchecktr.h"
#include "cppchecktrigger.h"
#include "cppcheckdiagnosticsmodel.h"
#include "cppcheckmanualrundialog.h"
@@ -26,32 +28,28 @@
#include
#include
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
class CppcheckPluginPrivate final : public QObject
{
public:
explicit CppcheckPluginPrivate();
+
CppcheckTextMarkManager marks;
- CppcheckTool tool;
- CppcheckTrigger trigger;
- CppcheckOptionsPage options;
+ CppcheckTool tool{marks, Constants::CHECK_PROGRESS_ID};
+ CppcheckTrigger trigger{marks, tool};
+ CppcheckOptionsPage options{tool, trigger};
DiagnosticsModel manualRunModel;
- CppcheckTool manualRunTool;
- Utils::Perspective perspective{Constants::PERSPECTIVE_ID,
- ::Cppcheck::Internal::CppcheckPlugin::tr("Cppcheck")};
+ CppcheckTool manualRunTool{manualRunModel, Constants::MANUAL_CHECK_PROGRESS_ID};
+ Utils::Perspective perspective{Constants::PERSPECTIVE_ID, ::Cppcheck::Tr::tr("Cppcheck")};
+
QAction *manualRunAction;
void startManualRun();
void updateManualRunAction();
};
-CppcheckPluginPrivate::CppcheckPluginPrivate() :
- tool(marks, Constants::CHECK_PROGRESS_ID),
- trigger(marks, tool),
- options(tool, trigger),
- manualRunTool(manualRunModel, Constants::MANUAL_CHECK_PROGRESS_ID)
+CppcheckPluginPrivate::CppcheckPluginPrivate()
{
manualRunTool.updateOptions(tool.options());
@@ -64,7 +62,7 @@ CppcheckPluginPrivate::CppcheckPluginPrivate() :
auto action = new QAction(this);
action->setEnabled(false);
action->setIcon(Utils::Icons::PREV_TOOLBAR.icon());
- action->setToolTip(CppcheckPlugin::tr("Go to previous diagnostic."));
+ action->setToolTip(Tr::tr("Go to previous diagnostic."));
connect(action, &QAction::triggered,
manualRunView, &Debugger::DetailedErrorView::goBack);
connect (&manualRunModel, &DiagnosticsModel::hasDataChanged,
@@ -77,7 +75,7 @@ CppcheckPluginPrivate::CppcheckPluginPrivate() :
auto action = new QAction(this);
action->setEnabled(false);
action->setIcon(Utils::Icons::NEXT_TOOLBAR.icon());
- action->setToolTip(CppcheckPlugin::tr("Go to next diagnostic."));
+ action->setToolTip(Tr::tr("Go to next diagnostic."));
connect(action, &QAction::triggered,
manualRunView, &Debugger::DetailedErrorView::goNext);
connect (&manualRunModel, &DiagnosticsModel::hasDataChanged,
@@ -90,7 +88,7 @@ CppcheckPluginPrivate::CppcheckPluginPrivate() :
auto action = new QAction(this);
action->setEnabled(false);
action->setIcon(Utils::Icons::CLEAN_TOOLBAR.icon());
- action->setToolTip(CppcheckPlugin::tr("Clear"));
+ action->setToolTip(Tr::tr("Clear"));
connect(action, &QAction::triggered,
&manualRunModel, &DiagnosticsModel::clear);
connect (&manualRunModel, &DiagnosticsModel::hasDataChanged,
@@ -146,7 +144,7 @@ bool CppcheckPlugin::initialize(const QStringList &arguments, QString *errorStri
ActionContainer *menu = ActionManager::actionContainer(Debugger::Constants::M_DEBUG_ANALYZER);
{
- auto action = new QAction(tr("Cppcheck..."), this);
+ auto action = new QAction(Tr::tr("Cppcheck..."), this);
menu->addAction(ActionManager::registerAction(action, Constants::MANUAL_RUN_ACTION),
Debugger::Constants::G_ANALYZER_TOOLS);
connect(action, &QAction::triggered,
@@ -162,5 +160,4 @@ bool CppcheckPlugin::initialize(const QStringList &arguments, QString *errorStri
return true;
}
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppcheckplugin.h b/src/plugins/cppcheck/cppcheckplugin.h
index 2c2e5d4d521..697aea60304 100644
--- a/src/plugins/cppcheck/cppcheckplugin.h
+++ b/src/plugins/cppcheck/cppcheckplugin.h
@@ -7,8 +7,7 @@
#include
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
class CppcheckPluginPrivate;
@@ -27,5 +26,4 @@ private:
std::unique_ptr d;
};
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck
diff --git a/src/plugins/cppcheck/cppcheckrunner.cpp b/src/plugins/cppcheck/cppcheckrunner.cpp
index 7c427e4cea3..85227736b99 100644
--- a/src/plugins/cppcheck/cppcheckrunner.cpp
+++ b/src/plugins/cppcheck/cppcheckrunner.cpp
@@ -11,8 +11,7 @@
using namespace Utils;
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
CppcheckRunner::CppcheckRunner(CppcheckTool &tool) : m_tool(tool)
{
@@ -149,5 +148,4 @@ void CppcheckRunner::handleDone()
checkQueued();
}
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppcheckrunner.h b/src/plugins/cppcheck/cppcheckrunner.h
index 1c3905095d2..23689b2b05b 100644
--- a/src/plugins/cppcheck/cppcheckrunner.h
+++ b/src/plugins/cppcheck/cppcheckrunner.h
@@ -9,15 +9,12 @@
#include
#include
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
class CppcheckTool;
class CppcheckRunner final : public QObject
{
- Q_OBJECT
-
public:
explicit CppcheckRunner(CppcheckTool &tool);
~CppcheckRunner() override;
@@ -47,5 +44,4 @@ private:
int m_maxArgumentsLength = 32767;
};
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppchecktextmark.cpp b/src/plugins/cppcheck/cppchecktextmark.cpp
index 9f71c51df2f..cd6749b5cc2 100644
--- a/src/plugins/cppcheck/cppchecktextmark.cpp
+++ b/src/plugins/cppcheck/cppchecktextmark.cpp
@@ -11,41 +11,41 @@
#include
#include
-namespace Cppcheck {
-namespace Internal {
+using namespace TextEditor;
+using namespace Utils;
+
+namespace Cppcheck::Internal {
struct Visual
{
- Visual(Utils::Theme::Color color, TextEditor::TextMark::Priority priority,
+ Visual(Utils::Theme::Color color, TextMark::Priority priority,
const QIcon &icon)
: color(color),
priority(priority),
icon(icon)
{}
Utils::Theme::Color color;
- TextEditor::TextMark::Priority priority;
+ TextMark::Priority priority;
QIcon icon;
};
static Visual getVisual(Diagnostic::Severity type)
{
- using Color = Utils::Theme::Color;
- using Priority = TextEditor::TextMark::Priority;
+ using Color = Theme::Color;
+ using Priority = TextMark::Priority;
static const QMap visuals{
{Diagnostic::Severity::Error, {Color::IconsErrorColor, Priority::HighPriority,
- Utils::Icons::CRITICAL.icon()}},
+ Icons::CRITICAL.icon()}},
{Diagnostic::Severity::Warning, {Color::IconsWarningColor, Priority::NormalPriority,
- Utils::Icons::WARNING.icon()}},
+ Icons::WARNING.icon()}},
};
- return visuals.value(type, {Color::IconsInfoColor, Priority::LowPriority,
- Utils::Icons::INFO.icon()});
+ return visuals.value(type, {Color::IconsInfoColor, Priority::LowPriority, Icons::INFO.icon()});
}
CppcheckTextMark::CppcheckTextMark (const Diagnostic &diagnostic)
- : TextEditor::TextMark (diagnostic.fileName, diagnostic.lineNumber,
- Utils::Id(Constants::TEXTMARK_CATEGORY_ID)),
+ : TextMark(diagnostic.fileName, diagnostic.lineNumber, Id(Constants::TEXTMARK_CATEGORY_ID)),
m_severity(diagnostic.severity),
m_checkId(diagnostic.checkId),
m_message(diagnostic.message)
@@ -60,7 +60,7 @@ CppcheckTextMark::CppcheckTextMark (const Diagnostic &diagnostic)
setActionsProvider([diagnostic] {
// Copy to clipboard action
QAction *action = new QAction;
- action->setIcon(QIcon::fromTheme("edit-copy", Utils::Icons::COPY.icon()));
+ action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon()));
action->setToolTip(TextMark::tr("Copy to Clipboard"));
QObject::connect(action, &QAction::triggered, [diagnostic]() {
const QString text = QString("%1:%2: %3")
@@ -87,5 +87,4 @@ QString CppcheckTextMark::toolTipText(const QString &severityText) const
"").arg(m_checkId, severityText, m_message);
}
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppchecktextmark.h b/src/plugins/cppcheck/cppchecktextmark.h
index 05246b68d41..9ef6f49d51b 100644
--- a/src/plugins/cppcheck/cppchecktextmark.h
+++ b/src/plugins/cppcheck/cppchecktextmark.h
@@ -7,8 +7,7 @@
#include
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
class CppcheckTextMark final : public TextEditor::TextMark
{
@@ -29,5 +28,4 @@ private:
QString m_message;
};
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppchecktextmarkmanager.cpp b/src/plugins/cppcheck/cppchecktextmarkmanager.cpp
index 614b5f0fe68..04bfc82eb45 100644
--- a/src/plugins/cppcheck/cppchecktextmarkmanager.cpp
+++ b/src/plugins/cppcheck/cppchecktextmarkmanager.cpp
@@ -1,14 +1,14 @@
// Copyright (C) 2018 Sergey Morozov
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+#include "cppchecktextmarkmanager.h"
+
#include "cppcheckdiagnostic.h"
#include "cppchecktextmark.h"
-#include "cppchecktextmarkmanager.h"
#include
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
CppcheckTextMarkManager::CppcheckTextMarkManager() = default;
@@ -36,5 +36,4 @@ void CppcheckTextMarkManager::clearFiles(const Utils::FilePaths &files)
}
}
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppchecktextmarkmanager.h b/src/plugins/cppcheck/cppchecktextmarkmanager.h
index 33ddf7e89cb..108427d4940 100644
--- a/src/plugins/cppcheck/cppchecktextmarkmanager.h
+++ b/src/plugins/cppcheck/cppchecktextmarkmanager.h
@@ -9,8 +9,7 @@
#include
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
class Diagnostic;
class CppcheckTextMark;
@@ -29,5 +28,4 @@ private:
std::unordered_map> m_marks;
};
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppchecktool.cpp b/src/plugins/cppcheck/cppchecktool.cpp
index 252fbb30e1d..0fb628b7ad5 100644
--- a/src/plugins/cppcheck/cppchecktool.cpp
+++ b/src/plugins/cppcheck/cppchecktool.cpp
@@ -1,11 +1,13 @@
// Copyright (C) 2018 Sergey Morozov
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+#include "cppchecktool.h"
+
#include "cppcheckdiagnostic.h"
#include "cppcheckoptions.h"
#include "cppcheckrunner.h"
#include "cppchecktextmarkmanager.h"
-#include "cppchecktool.h"
+#include "cppchecktr.h"
#include
#include
@@ -20,8 +22,7 @@
#include
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
CppcheckTool::CppcheckTool(CppcheckDiagnosticManager &manager,
const Utils::Id &progressId) :
@@ -226,13 +227,13 @@ void CppcheckTool::stop(const Utils::FilePaths &files)
void CppcheckTool::startParsing()
{
if (m_options.showOutput) {
- const QString message = tr("Cppcheck started: \"%1\".").arg(m_runner->currentCommand());
+ const QString message = Tr::tr("Cppcheck started: \"%1\".").arg(m_runner->currentCommand());
Core::MessageManager::writeSilently(message);
}
m_progress = std::make_unique>();
const Core::FutureProgress *progress = Core::ProgressManager::addTask(
- m_progress->future(), QObject::tr("Cppcheck"), m_progressId);
+ m_progress->future(), Tr::tr("Cppcheck"), m_progressId);
QObject::connect(progress, &Core::FutureProgress::canceled,
this, [this]{stop({});});
m_progress->setProgressRange(0, 100);
@@ -301,11 +302,10 @@ void CppcheckTool::parseErrorLine(const QString &line)
void CppcheckTool::finishParsing()
{
if (m_options.showOutput)
- Core::MessageManager::writeSilently(tr("Cppcheck finished."));
+ Core::MessageManager::writeSilently(Tr::tr("Cppcheck finished."));
QTC_ASSERT(m_progress, return);
m_progress->reportFinished();
}
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppchecktool.h b/src/plugins/cppcheck/cppchecktool.h
index e773103926c..ccb8e19d0fe 100644
--- a/src/plugins/cppcheck/cppchecktool.h
+++ b/src/plugins/cppcheck/cppchecktool.h
@@ -14,18 +14,13 @@
namespace Utils {
class FilePath;
using FilePaths = QList;
-}
+} // Utils
-namespace CppEditor {
-class ProjectPart;
-}
+namespace CppEditor { class ProjectPart; }
-namespace ProjectExplorer {
-class Project;
-}
+namespace ProjectExplorer { class Project; }
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
class CppcheckRunner;
class CppcheckDiagnosticManager;
@@ -68,5 +63,4 @@ private:
Utils::Id m_progressId;
};
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppchecktrigger.cpp b/src/plugins/cppcheck/cppchecktrigger.cpp
index d8fd116d643..93f15522dbc 100644
--- a/src/plugins/cppcheck/cppchecktrigger.cpp
+++ b/src/plugins/cppcheck/cppchecktrigger.cpp
@@ -15,19 +15,20 @@
#include
#include
-namespace Cppcheck {
-namespace Internal {
+using namespace Core;
+using namespace ProjectExplorer;
+using namespace Utils;
+
+namespace Cppcheck::Internal {
CppcheckTrigger::CppcheckTrigger(CppcheckTextMarkManager &marks, CppcheckTool &tool) :
m_marks(marks),
m_tool(tool)
{
- using EditorManager = Core::EditorManager;
- using SessionManager = ProjectExplorer::SessionManager;
using CppModelManager = CppEditor::CppModelManager;
connect(EditorManager::instance(), &EditorManager::editorOpened,
- this, [this](Core::IEditor *editor) {checkEditors({editor});});
+ this, [this](IEditor *editor) {checkEditors({editor});});
connect(EditorManager::instance(), &EditorManager::editorsClosed,
this, &CppcheckTrigger::removeEditors);
connect(EditorManager::instance(), &EditorManager::aboutToSave,
@@ -48,7 +49,7 @@ void CppcheckTrigger::recheck()
checkEditors();
}
-void CppcheckTrigger::checkEditors(const QList &editors)
+void CppcheckTrigger::checkEditors(const QList &editors)
{
if (!m_currentProject)
return;
@@ -59,15 +60,15 @@ void CppcheckTrigger::checkEditors(const QList &editors)
if (!info)
return;
- const QList editorList = !editors.isEmpty()
- ? editors : Core::DocumentModel::editorsForOpenedDocuments();
+ const QList editorList = !editors.isEmpty()
+ ? editors : DocumentModel::editorsForOpenedDocuments();
- Utils::FilePaths toCheck;
- for (const Core::IEditor *editor : editorList) {
+ FilePaths toCheck;
+ for (const IEditor *editor : editorList) {
QTC_ASSERT(editor, continue);
- Core::IDocument *document = editor->document();
+ IDocument *document = editor->document();
QTC_ASSERT(document, continue);
- const Utils::FilePath &path = document->filePath();
+ const FilePath &path = document->filePath();
if (path.isEmpty())
continue;
@@ -81,9 +82,9 @@ void CppcheckTrigger::checkEditors(const QList &editors)
if (!info->sourceFiles().contains(pathString))
continue;
- connect(document, &Core::IDocument::aboutToReload,
+ connect(document, &IDocument::aboutToReload,
this, [this, document]{checkChangedDocument(document);});
- connect(document, &Core::IDocument::contentsChanged,
+ connect(document, &IDocument::contentsChanged,
this, [this, document] {
if (!document->isModified())
checkChangedDocument(document);
@@ -99,20 +100,20 @@ void CppcheckTrigger::checkEditors(const QList &editors)
}
}
-void CppcheckTrigger::removeEditors(const QList &editors)
+void CppcheckTrigger::removeEditors(const QList &editors)
{
if (!m_currentProject)
return;
- const QList editorList = !editors.isEmpty()
- ? editors : Core::DocumentModel::editorsForOpenedDocuments();
+ const QList editorList = !editors.isEmpty()
+ ? editors : DocumentModel::editorsForOpenedDocuments();
- Utils::FilePaths toRemove;
- for (const Core::IEditor *editor : editorList) {
+ FilePaths toRemove;
+ for (const IEditor *editor : editorList) {
QTC_ASSERT(editor, return);
- const Core::IDocument *document = editor->document();
+ const IDocument *document = editor->document();
QTC_ASSERT(document, return);
- const Utils::FilePath &path = document->filePath();
+ const FilePath &path = document->filePath();
if (path.isEmpty())
return;
@@ -128,14 +129,14 @@ void CppcheckTrigger::removeEditors(const QList &editors)
remove(toRemove);
}
-void CppcheckTrigger::checkChangedDocument(Core::IDocument *document)
+void CppcheckTrigger::checkChangedDocument(IDocument *document)
{
QTC_ASSERT(document, return);
if (!m_currentProject)
return;
- const Utils::FilePath &path = document->filePath();
+ const FilePath &path = document->filePath();
QTC_ASSERT(!path.isEmpty(), return);
if (!m_checkedFiles.contains(path))
return;
@@ -144,16 +145,16 @@ void CppcheckTrigger::checkChangedDocument(Core::IDocument *document)
check({path});
}
-void CppcheckTrigger::changeCurrentProject(ProjectExplorer::Project *project)
+void CppcheckTrigger::changeCurrentProject(Project *project)
{
m_currentProject = project;
m_checkedFiles.clear();
remove({});
m_tool.setProject(project);
- checkEditors(Core::DocumentModel::editorsForOpenedDocuments());
+ checkEditors(DocumentModel::editorsForOpenedDocuments());
}
-void CppcheckTrigger::updateProjectFiles(ProjectExplorer::Project *project)
+void CppcheckTrigger::updateProjectFiles(Project *project)
{
if (project != m_currentProject)
return;
@@ -161,19 +162,18 @@ void CppcheckTrigger::updateProjectFiles(ProjectExplorer::Project *project)
m_checkedFiles.clear();
remove({});
m_tool.setProject(project);
- checkEditors(Core::DocumentModel::editorsForOpenedDocuments());
+ checkEditors(DocumentModel::editorsForOpenedDocuments());
}
-void CppcheckTrigger::check(const Utils::FilePaths &files)
+void CppcheckTrigger::check(const FilePaths &files)
{
m_tool.check(files);
}
-void CppcheckTrigger::remove(const Utils::FilePaths &files)
+void CppcheckTrigger::remove(const FilePaths &files)
{
m_marks.clearFiles(files);
m_tool.stop(files);
}
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal
diff --git a/src/plugins/cppcheck/cppchecktrigger.h b/src/plugins/cppcheck/cppchecktrigger.h
index a5b1267b6d3..5c8c83e33c0 100644
--- a/src/plugins/cppcheck/cppchecktrigger.h
+++ b/src/plugins/cppcheck/cppchecktrigger.h
@@ -20,16 +20,13 @@ class IDocument;
class IEditor;
}
-namespace Cppcheck {
-namespace Internal {
+namespace Cppcheck::Internal {
class CppcheckTextMarkManager;
class CppcheckTool;
class CppcheckTrigger final : public QObject
{
- Q_OBJECT
-
public:
explicit CppcheckTrigger(CppcheckTextMarkManager &marks, CppcheckTool &tool);
~CppcheckTrigger() override;
@@ -51,5 +48,4 @@ private:
QHash m_checkedFiles;
};
-} // namespace Internal
-} // namespace Cppcheck
+} // Cppcheck::Internal