File indexing completed on 2024-04-28 12:23:24

0001 /* This file is part of KDevelop
0002    Copyright 2002 Harald Fernengel <harry@kdevelop.org>
0003    Copyright 2007 Hamish Rodda <rodda@kde.org>
0004    Copyright 2016-2017 Anton Anikin <anton@anikin.xyz>
0005 
0006    This program is free software; you can redistribute it and/or
0007    modify it under the terms of the GNU General Public
0008    License as published by the Free Software Foundation; either
0009    version 2 of the License, or (at your option) any later version.
0010 
0011    This program is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0014    General Public License for more details.
0015 
0016    You should have received a copy of the GNU General Public License
0017    along with this program; see the file COPYING.  If not, write to
0018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019    Boston, MA 02110-1301, USA.
0020 */
0021 
0022 #pragma once
0023 
0024 #include <interfaces/iplugin.h>
0025 
0026 #include <QMultiHash>
0027 
0028 class KJob;
0029 
0030 namespace KDevelop
0031 {
0032 
0033 class ProblemModel;
0034 class ILauncher;
0035 
0036 }
0037 
0038 namespace Valgrind
0039 {
0040 
0041 class Job;
0042 class Tool;
0043 class LaunchMode;
0044 class ProblemModel;
0045 class ToolViewFactory;
0046 
0047 class Plugin : public KDevelop::IPlugin
0048 {
0049     Q_OBJECT
0050 
0051 public:
0052     explicit Plugin(QObject* parent, const QVariantList& = QVariantList());
0053     ~Plugin() override;
0054 
0055     static Plugin* self();
0056 
0057     void unload() override;
0058 
0059     int configPages() const override;
0060     KDevelop::ConfigPage* configPage(int number, QWidget* parent) override;
0061 
0062     LaunchMode* launchMode() const;
0063     ProblemModel* problemModel() const;
0064 
0065     void executeDefaultLaunch(const QString& launcherId);
0066 
0067     void jobReadyToStart(Job* job);
0068     void jobReadyToFinish(Job* job, bool ok);
0069     void jobFinished(KJob* job);
0070 
0071     bool isRunning();
0072 
0073 Q_SIGNALS:
0074     void addView(QWidget* view, const QString& name);
0075 
0076 private:
0077     void setupExecutePlugin(KDevelop::IPlugin* plugin, bool load);
0078 
0079     ToolViewFactory* m_toolViewFactory;
0080 
0081     QScopedPointer<LaunchMode> m_launchMode;
0082     QMultiHash<KDevelop::IPlugin*, KDevelop::ILauncher*> m_launchers;
0083 
0084     QScopedPointer<ProblemModel> m_problemModel;
0085     bool m_isRunning;
0086 
0087     QList<Tool*> m_tools;
0088 
0089     static Plugin* m_self;
0090 };
0091 
0092 }