gitcommit.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef GITCOMMIT_H
  2. #define GITCOMMIT_H
  3. #include <gitbaseoid.h>
  4. #include <gittag.h>
  5. #include <QDateTime>
  6. #include <QString>
  7. #include <QList>
  8. #include <git2/types.h>
  9. class GitDiff;
  10. class GitCommit : public GitBaseOid<git_commit>
  11. {
  12. Q_OBJECT
  13. Q_PROPERTY(QString author READ author WRITE setAuthor NOTIFY commitChanged)
  14. Q_PROPERTY(QString email READ email WRITE setEmail NOTIFY commitChanged)
  15. Q_PROPERTY(QDateTime time READ time WRITE setTime NOTIFY commitChanged)
  16. Q_PROPERTY(QString message READ message WRITE setMessage NOTIFY commitChanged)
  17. Q_PROPERTY(QString summary READ summary WRITE setSummary NOTIFY commitChanged)
  18. Q_PROPERTY(QString sha1 READ sha1 NOTIFY commitChanged)
  19. Q_PROPERTY(QString shortSha1 READ shortSha1 NOTIFY commitChanged)
  20. Q_PROPERTY(bool isMerge READ isMerge NOTIFY commitChanged)
  21. Q_PROPERTY(GitDiff* diff READ diff NOTIFY commitChanged)
  22. public:
  23. GitCommit(git_commit* raw, GitRepository* parent);
  24. ~GitCommit();
  25. static GitCommit* fromOid(const GitOid& oid);
  26. QString author() const;
  27. QDateTime time() const;
  28. QString message() const;
  29. QString email() const;
  30. QString sha1() const;
  31. QString shortSha1() const;
  32. bool isMerge() const;
  33. QString summary() const;
  34. GitDiff* diff();
  35. public slots:
  36. void setAuthor(QString author);
  37. void setTime(QDateTime time);
  38. void setMessage(QString message);
  39. void setEmail(QString email);
  40. void setSummary(QString summary);
  41. signals:
  42. void commitChanged();
  43. void bodyChanged(QString body);
  44. private:
  45. GitCommit();
  46. QString m_author;
  47. QDateTime m_time;
  48. QString m_message;
  49. QString m_email;
  50. QPointer<GitDiff> m_diff;
  51. QString m_summary;
  52. };
  53. #endif // GITCOMMIT_H