commitgraph.h 885 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef COMMITGRAPH_H
  2. #define COMMITGRAPH_H
  3. #include <QObject>
  4. #include <gitoid.h>
  5. #include <QString>
  6. #include <QHash>
  7. #include <QObjectList>
  8. class GitCommit;
  9. class GraphPoint;
  10. class GitBranch;
  11. class CommitGraph : public QObject
  12. {
  13. Q_OBJECT
  14. Q_PROPERTY(QList<QObject*> points READ points CONSTANT)
  15. public:
  16. CommitGraph();
  17. void addHead(GitBranch* branch);
  18. void addHead(const GitOid& oid);
  19. QList<QObject*> points() const {
  20. return m_sortedPoints;
  21. }
  22. //TODO: move this functionality to more proper place;
  23. Q_INVOKABLE QString commitData(GraphPoint* point) const;
  24. //TODO: move this functionality to more proper place;
  25. private:
  26. void findParents(GitCommit *commit);
  27. void addCommits(QList<GitOid> &reversList);
  28. QString m_color;
  29. QHash<GitOid, GraphPoint*> m_points;
  30. QObjectList m_sortedPoints;
  31. };
  32. #endif // COMMITGRAPH_H