File indexing completed on 2024-05-05 04:39:27

0001 /*
0002     SPDX-FileCopyrightText: 2018, 2020 Friedrich W. H. Kossebau <kossebau@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef COMPILEANALYZER_COMPILEANALYZEPROBLEMMODEL_H
0008 #define COMPILEANALYZER_COMPILEANALYZEPROBLEMMODEL_H
0009 
0010 // KDevPlatfrom
0011 #include <shell/problemmodel.h>
0012 // Qt
0013 #include <QUrl>
0014 
0015 namespace KDevelop { class IProject; }
0016 
0017 namespace KDevelop
0018 {
0019 
0020 class CompileAnalyzeProblemModel : public KDevelop::ProblemModel
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     explicit CompileAnalyzeProblemModel(const QString& toolName, QObject* parent);
0026     ~CompileAnalyzeProblemModel() override;
0027 
0028 public: // KDevelop::ProblemModel API
0029     void forceFullUpdate() override;
0030 
0031 public:
0032     void addProblems(const QVector<KDevelop::IProblem::Ptr>& problems);
0033 
0034     void finishAddProblems();
0035 
0036     void reset();
0037     void reset(KDevelop::IProject* project, const QUrl& path, bool allFiles);
0038 
0039     KDevelop::IProject* project() const;
0040 
0041 Q_SIGNALS:
0042     void rerunRequested(const QUrl& path, bool allFiles);
0043 
0044 private:
0045     void setMessage(const QString& message);
0046     bool problemExists(KDevelop::IProblem::Ptr newProblem);
0047 
0048 private:
0049     const QString m_toolName;
0050     KDevelop::IProject* m_project = nullptr;
0051     QUrl m_path;
0052     bool m_allFiles = false;
0053     KDevelop::DocumentRange m_pathLocation;
0054 
0055     QVector<KDevelop::IProblem::Ptr> m_problems;
0056     int m_maxProblemDescriptionLength = 0;
0057 };
0058 
0059 }
0060 
0061 #endif