From 0a0dd9ea31d03fcc57f51de724c32e8ca3fe3d3f Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 9 Jan 2023 18:08:30 +0100 Subject: CppCheck: Tr::tr and code cosmetics Change-Id: I5e6583984f7dc94e998df3c20840f2ba2e801ab8 Reviewed-by: Alessandro Portale --- src/plugins/cppcheck/cppcheckplugin.cpp | 35 +++++++++++++++------------------ 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'src/plugins/cppcheck/cppcheckplugin.cpp') diff --git a/src/plugins/cppcheck/cppcheckplugin.cpp b/src/plugins/cppcheck/cppcheckplugin.cpp index 76c88b8116..33afa6c43d 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 -- cgit v1.2.1