File indexing completed on 2024-05-05 04:40:14

0001 /*
0002     SPDX-FileCopyrightText: 2006 Adam Treat <treat@kde.org>
0003     SPDX-FileCopyrightText: 2006-2007 Hamish Rodda <rodda@kde.org>
0004     SPDX-FileCopyrightText: 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef KDEVPLATFORM_PLUGIN_PROBLEMREPORTERPLUGIN_H
0010 #define KDEVPLATFORM_PLUGIN_PROBLEMREPORTERPLUGIN_H
0011 
0012 #include <interfaces/iplugin.h>
0013 #include <QVariant>
0014 
0015 #include <serialization/indexedstring.h>
0016 #include <language/duchain/topducontext.h>
0017 
0018 class QUrl;
0019 
0020 namespace KDevelop
0021 {
0022 class IDocument;
0023 }
0024 
0025 class ProblemReporterModel;
0026 
0027 class ProblemReporterPlugin : public KDevelop::IPlugin
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     explicit ProblemReporterPlugin(QObject* parent, const QVariantList& = QVariantList());
0033     ~ProblemReporterPlugin() override;
0034 
0035     KDevelop::ContextMenuExtension contextMenuExtension(KDevelop::Context* context, QWidget* parent) override;
0036 
0037     // KDevelop::Plugin methods
0038     void unload() override;
0039 
0040     ProblemReporterModel* model() const;
0041 
0042 private Q_SLOTS:
0043     void updateReady(const KDevelop::IndexedString& url, const KDevelop::ReferencedTopDUContext&);
0044     void updateHighlight(const KDevelop::IndexedString& url);
0045     void documentClosed(KDevelop::IDocument*);
0046     void textDocumentCreated(KDevelop::IDocument* document);
0047     void documentUrlChanged(KDevelop::IDocument* document, const QUrl& previousUrl);
0048     void documentActivated(KDevelop::IDocument* document);
0049     void showModel(const QString& id);
0050 
0051 private:
0052     void updateOpenedDocumentsHighlight();
0053     class ProblemReporterFactory* m_factory;
0054     ProblemReporterModel* m_model;
0055 
0056     class ProblemVisualizer;
0057     QHash<KDevelop::IndexedString, ProblemVisualizer*> m_visualizers;
0058     QSet<KDevelop::IndexedString> m_reHighlightNeeded;
0059 };
0060 
0061 #endif // KDEVPLATFORM_PLUGIN_PROBLEMREPORTERPLUGIN_H