File indexing completed on 2024-05-05 16:46:08
0001 /* 0002 SPDX-FileCopyrightText: 2007 Hamish Rodda <rodda@kde.org> 0003 SPDX-FileCopyrightText: 2015 Laszlo Kis-Adam <laszlo.kis-adam@kdemail.net> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef PROBLEMREPORTERMODEL_H 0009 #define PROBLEMREPORTERMODEL_H 0010 0011 #include <shell/problemmodel.h> 0012 0013 namespace KDevelop 0014 { 0015 class IndexedString; 0016 class TopDUContext; 0017 } 0018 0019 class WatchedDocumentSet; 0020 class QTimer; 0021 0022 /** 0023 * @brief ProblemModel subclass that retrieves the problems from DUChain. 0024 * 0025 * Provides a ProblemModel interface so these problems can be shown in the Problems tool view. 0026 */ 0027 class ProblemReporterModel : public KDevelop::ProblemModel 0028 { 0029 Q_OBJECT 0030 public: 0031 explicit ProblemReporterModel(QObject* parent); 0032 ~ProblemReporterModel() override; 0033 0034 /** 0035 * Get merged list of problems for all @ref urls. 0036 */ 0037 QVector<KDevelop::IProblem::Ptr> problems(const QSet<KDevelop::IndexedString>& urls) const; 0038 0039 public Q_SLOTS: 0040 /** 0041 * List of problems for @ref url has been updated 0042 */ 0043 void problemsUpdated(const KDevelop::IndexedString& url); 0044 0045 void forceFullUpdate() override; 0046 0047 protected Q_SLOTS: 0048 /// Triggered when the problemstore's problems have changed 0049 void onProblemsChanged() override; 0050 0051 private Q_SLOTS: 0052 void timerExpired(); 0053 void setCurrentDocument(KDevelop::IDocument* doc) override; 0054 0055 private: 0056 void rebuildProblemList(); 0057 0058 QTimer* m_minTimer; 0059 QTimer* m_maxTimer; 0060 const static int MinTimeout; 0061 const static int MaxTimeout; 0062 }; 0063 0064 #endif