File indexing completed on 2024-05-05 16:45:14
0001 /* 0002 SPDX-FileCopyrightText: 2013 Christoph Thielecke <crissi99@gmx.de> 0003 SPDX-FileCopyrightText: 2016-2017 Anton Anikin <anton.anikin@htower.ru> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef CPPCHECK_PLUGIN_H 0009 #define CPPCHECK_PLUGIN_H 0010 0011 #include "job.h" 0012 0013 #include <interfaces/iplugin.h> 0014 #include <QScopedPointer> 0015 0016 class KJob; 0017 0018 namespace KDevelop 0019 { 0020 class IProject; 0021 } 0022 0023 namespace cppcheck 0024 { 0025 0026 class ProblemModel; 0027 0028 class Plugin : public KDevelop::IPlugin 0029 { 0030 Q_OBJECT 0031 0032 public: 0033 explicit Plugin(QObject* parent, const QVariantList& = QVariantList()); 0034 0035 ~Plugin() override; 0036 0037 KDevelop::ContextMenuExtension contextMenuExtension(KDevelop::Context* context, QWidget* parent) override; 0038 0039 int configPages() const override { return 1; } 0040 KDevelop::ConfigPage* configPage(int number, QWidget* parent) override; 0041 0042 int perProjectConfigPages() const override { return 1; } 0043 KDevelop::ConfigPage* perProjectConfigPage(int number, const KDevelop::ProjectConfigOptions& options, QWidget* parent) override; 0044 0045 void runCppcheck(KDevelop::IProject* project, const QString& path); 0046 bool isRunning(); 0047 0048 private: 0049 void killCppcheck(); 0050 0051 void raiseProblemsView(); 0052 void raiseOutputView(); 0053 0054 void updateActions(); 0055 void projectClosed(KDevelop::IProject* project); 0056 0057 void runCppcheck(bool checkProject); 0058 0059 void result(KJob* job); 0060 0061 Job* m_job; 0062 0063 KDevelop::IProject* m_currentProject; 0064 0065 QAction* m_menuActionFile; 0066 QAction* m_menuActionProject; 0067 QAction* m_contextActionFile; 0068 QAction* m_contextActionProject; 0069 QAction* m_contextActionProjectItem; 0070 0071 QScopedPointer<ProblemModel> m_model; 0072 }; 0073 0074 } 0075 0076 #endif