-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitmanager.h
65 lines (53 loc) · 1.55 KB
/
gitmanager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef GITMANAGER_H
#define GITMANAGER_H
#include <QObject>
#include <QScopedPointer>
#include <QString>
struct git_repository;
class CommitDao;
class CommitModel;
class GitManager : public QObject
{
Q_OBJECT
Q_PROPERTY(CommitModel *commitModel READ commitModel CONSTANT FINAL)
Q_PROPERTY(QString repositoryPath READ repositoryPath WRITE setRepositoryPath NOTIFY repositoryPathChanged FINAL)
Q_PROPERTY(Status status READ status NOTIFY statusChanged FINAL)
Q_PROPERTY(QString branch READ branch NOTIFY branchChanged FINAL)
Q_PROPERTY(int errorCode READ errorCode NOTIFY initialized FINAL)
Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY initialized FINAL)
public:
enum Status {
Uninitialized,
Dirty,
Clean
};
Q_ENUMS(Status)
GitManager(QObject *parent = 0);
~GitManager();
CommitModel *commitModel();
QString repositoryPath() const;
void setRepositoryPath(const QString &repositoryPath);
QString branch() const;
Status status() const;
int errorCode() const;
QString errorMessage() const;
signals:
void repositoryPathChanged();
void statusChanged();
void branchChanged();
void initialized();
private slots:
void reset();
private:
void setBranch();
void setStatus();
git_repository *m_repository;
QString m_repositoryPath;
Status m_status;
QString m_branch;
int m_errorCode;
QString m_errorMessage;
QScopedPointer<CommitDao> m_commitDao;
QScopedPointer<CommitModel> m_commitModel;
};
#endif // GITMANAGER_H