aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppcheck/cppcheckplugin.cpp
diff options
context:
space:
mode:
authorhjk <[email protected]>2024-01-12 17:48:01 +0100
committerhjk <[email protected]>2024-01-12 17:00:50 +0000
commitbc14d32a8cf8e5c2dddfd02fa6e8bf1227bbf877 (patch)
tree75fcf97f76691799ce2a9be20d86fda2f67d1902 /src/plugins/cppcheck/cppcheckplugin.cpp
parenta3bad897af32d7e0069d8b82a74cec89fa427844 (diff)
CppCheck: Hide plugin class definition in .cpp
Change-Id: I960ec6e0e4d63cf0edf7af55d191ba666f44739b Reviewed-by: Jarek Kobus <[email protected]>
Diffstat (limited to 'src/plugins/cppcheck/cppcheckplugin.cpp')
-rw-r--r--src/plugins/cppcheck/cppcheckplugin.cpp62
1 files changed, 34 insertions, 28 deletions
diff --git a/src/plugins/cppcheck/cppcheckplugin.cpp b/src/plugins/cppcheck/cppcheckplugin.cpp
index 56e8bb1d1fe..496d9af6cd7 100644
--- a/src/plugins/cppcheck/cppcheckplugin.cpp
+++ b/src/plugins/cppcheck/cppcheckplugin.cpp
@@ -1,8 +1,6 @@
// Copyright (C) 2018 Sergey Morozov
// 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 "cppchecksettings.h"
@@ -13,6 +11,14 @@
#include "cppcheckdiagnosticsmodel.h"
#include "cppcheckmanualrundialog.h"
+#include <coreplugin/actionmanager/actioncontainer.h>
+#include <coreplugin/actionmanager/actionmanager.h>
+
+#include <debugger/analyzer/analyzerconstants.h>
+#include <debugger/debuggermainwindow.h>
+
+#include <extensionsystem/iplugin.h>
+
#include <projectexplorer/kitaspects.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
@@ -20,12 +26,6 @@
#include <projectexplorer/projectmanager.h>
#include <projectexplorer/target.h>
-#include <coreplugin/actionmanager/actioncontainer.h>
-#include <coreplugin/actionmanager/actionmanager.h>
-
-#include <debugger/analyzer/analyzerconstants.h>
-#include <debugger/debuggermainwindow.h>
-
#include <utils/layoutbuilder.h>
#include <utils/qtcassert.h>
#include <utils/utilsicons.h>
@@ -139,30 +139,36 @@ void CppcheckPluginPrivate::updateManualRunAction()
manualRunAction->setEnabled(canRun);
}
-CppcheckPlugin::CppcheckPlugin() = default;
-
-CppcheckPlugin::~CppcheckPlugin() = default;
-
-void CppcheckPlugin::initialize()
+class CppcheckPlugin final : public ExtensionSystem::IPlugin
{
- d.reset(new CppcheckPluginPrivate);
-
- using namespace Core;
- ActionContainer *menu = ActionManager::actionContainer(Debugger::Constants::M_DEBUG_ANALYZER);
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Cppcheck.json")
+ void initialize() final
{
- 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,
- d.get(), &CppcheckPluginPrivate::startManualRun);
- d->manualRunAction = action;
+ d.reset(new CppcheckPluginPrivate);
+
+ using namespace Core;
+ ActionContainer *menu = ActionManager::actionContainer(Debugger::Constants::M_DEBUG_ANALYZER);
+
+ {
+ 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,
+ d.get(), &CppcheckPluginPrivate::startManualRun);
+ d->manualRunAction = action;
+ }
+
+ using ProjectExplorer::ProjectExplorerPlugin;
+ connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::runActionsUpdated,
+ d.get(), &CppcheckPluginPrivate::updateManualRunAction);
+ d->updateManualRunAction();
}
- using ProjectExplorer::ProjectExplorerPlugin;
- connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::runActionsUpdated,
- d.get(), &CppcheckPluginPrivate::updateManualRunAction);
- d->updateManualRunAction();
-}
+ std::unique_ptr<CppcheckPluginPrivate> d;
+};
} // Cppcheck::Internal
+
+#include "cppcheckplugin.moc"