File indexing completed on 2021-12-21 13:15:49

0001 /* This file is part of KDevelop
0002 
0003    Copyright 2016 Anton Anikin <anton.anikin@htower.ru>
0004 
0005    This program is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 
0010    This program is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0013    General Public License for more details.
0014 
0015    You should have received a copy of the GNU General Public License
0016    along with this program; see the file COPYING.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018    Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #ifndef VERAPP_PLUGIN_H
0022 #define VERAPP_PLUGIN_H
0023 
0024 #include "job.h"
0025 
0026 #include <interfaces/iplugin.h>
0027 
0028 class KJob;
0029 class QMenu;
0030 
0031 namespace KDevelop
0032 {
0033     class IProject;
0034 }
0035 
0036 namespace verapp
0037 {
0038 
0039 class ProblemModel;
0040 
0041 class Plugin : public KDevelop::IPlugin
0042 {
0043     Q_OBJECT
0044 
0045 public:
0046     Plugin(QObject* parent, const QVariantList& = QVariantList());
0047 
0048     ~Plugin() override;
0049 
0050     int configPages() const override { return 1; }
0051     KDevelop::ConfigPage* configPage(int number, QWidget* parent) override;
0052 
0053     int perProjectConfigPages() const override { return 1; }
0054     KDevelop::ConfigPage* perProjectConfigPage(int number, const KDevelop::ProjectConfigOptions& options, QWidget* parent) override;
0055 
0056     KDevelop::ContextMenuExtension contextMenuExtension(KDevelop::Context* context, QWidget* parent) override;
0057 
0058     void runVerapp(KDevelop::IProject* project, const QString& path);
0059     bool isRunning();
0060 
0061 private:
0062     void killVerapp();
0063 
0064     void raiseProblemsView();
0065     void raiseOutputView();
0066 
0067     void updateActions();
0068     void projectClosed(KDevelop::IProject* project);
0069 
0070     void runVerapp(bool checkProject);
0071 
0072     void result(KJob* job);
0073 
0074     Job* m_job;
0075 
0076     KDevelop::IProject* m_project;
0077 
0078     QAction* m_menuActionFile;
0079     QAction* m_menuActionProject;
0080     QAction* m_contextActionFile;
0081     QAction* m_contextActionProject;
0082     QAction* m_contextActionProjectItem;
0083 
0084     QScopedPointer<ProblemModel> m_model;
0085 };
0086 
0087 }
0088 
0089 #endif