File indexing completed on 2024-05-12 04:38:54

0001 /*
0002     SPDX-FileCopyrightText: 2007 Andreas Pakulat <apaku@gmx.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_VCSANNOTATIONMODEL_H
0008 #define KDEVPLATFORM_VCSANNOTATIONMODEL_H
0009 
0010 #include <vcs/vcsexport.h>
0011 #include "../vcsrevision.h"
0012 
0013 #include <KTextEditor/AnnotationInterface>
0014 
0015 #include <QColor>
0016 
0017 class QUrl;
0018 template<typename T> class QList;
0019 
0020 namespace KDevelop
0021 {
0022 
0023 class VcsJob;
0024 class VcsAnnotationLine;
0025 class VcsAnnotationModelPrivate;
0026 
0027 class KDEVPLATFORMVCS_EXPORT VcsAnnotationModel : public KTextEditor::AnnotationModel
0028 {
0029 Q_OBJECT
0030 public:
0031     VcsAnnotationModel( VcsJob* job, const QUrl&, QObject*,
0032                         const QColor& foreground = QColor(Qt::black), const QColor& background = QColor(Qt::white) );
0033     ~VcsAnnotationModel() override;
0034 
0035     VcsRevision revisionForLine(int line) const;
0036 
0037     QVariant data( int line, Qt::ItemDataRole role = Qt::DisplayRole ) const override;
0038 
0039     // given "role" argument is of type Qt::ItemDataRole and not int, we cannot use custom roles
0040     // to access custom data, so providing a custom API instead
0041     VcsAnnotationLine annotationLine(int line) const;
0042 
0043 private:
0044     const QScopedPointer<class VcsAnnotationModelPrivate> d_ptr;
0045     Q_DECLARE_PRIVATE(VcsAnnotationModel)
0046     friend class VcsAnnotationModelPrivate;
0047 };
0048 
0049 }
0050 
0051 #endif