forked from qt-creator/qt-creator
CppCheck: Hide plugin class definition in .cpp
Change-Id: I960ec6e0e4d63cf0edf7af55d191ba666f44739b Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -8,7 +8,7 @@ add_qtc_plugin(Cppcheck
|
|||||||
cppcheckdiagnosticsmodel.cpp cppcheckdiagnosticsmodel.h
|
cppcheckdiagnosticsmodel.cpp cppcheckdiagnosticsmodel.h
|
||||||
cppcheckdiagnosticview.cpp cppcheckdiagnosticview.h
|
cppcheckdiagnosticview.cpp cppcheckdiagnosticview.h
|
||||||
cppcheckmanualrundialog.cpp cppcheckmanualrundialog.h
|
cppcheckmanualrundialog.cpp cppcheckmanualrundialog.h
|
||||||
cppcheckplugin.cpp cppcheckplugin.h
|
cppcheckplugin.cpp
|
||||||
cppcheckrunner.cpp cppcheckrunner.h
|
cppcheckrunner.cpp cppcheckrunner.h
|
||||||
cppchecksettings.cpp cppchecksettings.h
|
cppchecksettings.cpp cppchecksettings.h
|
||||||
cppchecktextmark.cpp cppchecktextmark.h
|
cppchecktextmark.cpp cppchecktextmark.h
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ QtcPlugin {
|
|||||||
"cppcheckmanualrundialog.cpp",
|
"cppcheckmanualrundialog.cpp",
|
||||||
"cppcheckmanualrundialog.h",
|
"cppcheckmanualrundialog.h",
|
||||||
"cppcheckplugin.cpp",
|
"cppcheckplugin.cpp",
|
||||||
"cppcheckplugin.h",
|
|
||||||
"cppcheckrunner.cpp",
|
"cppcheckrunner.cpp",
|
||||||
"cppcheckrunner.h",
|
"cppcheckrunner.h",
|
||||||
"cppchecksettings.cpp",
|
"cppchecksettings.cpp",
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
// Copyright (C) 2018 Sergey Morozov
|
// Copyright (C) 2018 Sergey Morozov
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "cppcheckplugin.h"
|
|
||||||
|
|
||||||
#include "cppcheckconstants.h"
|
#include "cppcheckconstants.h"
|
||||||
#include "cppcheckdiagnosticview.h"
|
#include "cppcheckdiagnosticview.h"
|
||||||
#include "cppchecksettings.h"
|
#include "cppchecksettings.h"
|
||||||
@@ -13,6 +11,14 @@
|
|||||||
#include "cppcheckdiagnosticsmodel.h"
|
#include "cppcheckdiagnosticsmodel.h"
|
||||||
#include "cppcheckmanualrundialog.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/kitaspects.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
@@ -20,12 +26,6 @@
|
|||||||
#include <projectexplorer/projectmanager.h>
|
#include <projectexplorer/projectmanager.h>
|
||||||
#include <projectexplorer/target.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/layoutbuilder.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/utilsicons.h>
|
#include <utils/utilsicons.h>
|
||||||
@@ -139,30 +139,36 @@ void CppcheckPluginPrivate::updateManualRunAction()
|
|||||||
manualRunAction->setEnabled(canRun);
|
manualRunAction->setEnabled(canRun);
|
||||||
}
|
}
|
||||||
|
|
||||||
CppcheckPlugin::CppcheckPlugin() = default;
|
class CppcheckPlugin final : public ExtensionSystem::IPlugin
|
||||||
|
|
||||||
CppcheckPlugin::~CppcheckPlugin() = default;
|
|
||||||
|
|
||||||
void CppcheckPlugin::initialize()
|
|
||||||
{
|
{
|
||||||
d.reset(new CppcheckPluginPrivate);
|
Q_OBJECT
|
||||||
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Cppcheck.json")
|
||||||
using namespace Core;
|
|
||||||
ActionContainer *menu = ActionManager::actionContainer(Debugger::Constants::M_DEBUG_ANALYZER);
|
|
||||||
|
|
||||||
|
void initialize() final
|
||||||
{
|
{
|
||||||
auto action = new QAction(Tr::tr("Cppcheck..."), this);
|
d.reset(new CppcheckPluginPrivate);
|
||||||
menu->addAction(ActionManager::registerAction(action, Constants::MANUAL_RUN_ACTION),
|
|
||||||
Debugger::Constants::G_ANALYZER_TOOLS);
|
using namespace Core;
|
||||||
connect(action, &QAction::triggered,
|
ActionContainer *menu = ActionManager::actionContainer(Debugger::Constants::M_DEBUG_ANALYZER);
|
||||||
d.get(), &CppcheckPluginPrivate::startManualRun);
|
|
||||||
d->manualRunAction = action;
|
{
|
||||||
|
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;
|
std::unique_ptr<CppcheckPluginPrivate> d;
|
||||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::runActionsUpdated,
|
};
|
||||||
d.get(), &CppcheckPluginPrivate::updateManualRunAction);
|
|
||||||
d->updateManualRunAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // Cppcheck::Internal
|
} // Cppcheck::Internal
|
||||||
|
|
||||||
|
#include "cppcheckplugin.moc"
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
// Copyright (C) 2018 Sergey Morozov
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <extensionsystem/iplugin.h>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace Cppcheck::Internal {
|
|
||||||
|
|
||||||
class CppcheckPluginPrivate;
|
|
||||||
|
|
||||||
class CppcheckPlugin final : public ExtensionSystem::IPlugin
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Cppcheck.json")
|
|
||||||
|
|
||||||
public:
|
|
||||||
CppcheckPlugin();
|
|
||||||
~CppcheckPlugin() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void initialize() final;
|
|
||||||
|
|
||||||
std::unique_ptr<CppcheckPluginPrivate> d;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // Cppcheck
|
|
||||||
Reference in New Issue
Block a user