Chris@43
|
1 #ifndef CHANGESET_H
|
Chris@43
|
2 #define CHANGESET_H
|
Chris@43
|
3
|
Chris@43
|
4 #include <QObject>
|
Chris@43
|
5 #include <QString>
|
Chris@43
|
6 #include <QStringList>
|
Chris@43
|
7 #include <QList>
|
Chris@43
|
8
|
Chris@43
|
9 class Changeset : public QObject
|
Chris@43
|
10 {
|
Chris@43
|
11 Q_OBJECT
|
Chris@43
|
12
|
Chris@43
|
13 Q_PROPERTY(QString id READ id WRITE setId NOTIFY idChanged STORED true);
|
Chris@43
|
14 Q_PROPERTY(QString author READ author WRITE setAuthor NOTIFY authorChanged STORED true);
|
Chris@43
|
15 Q_PROPERTY(QString branch READ branch WRITE setBranch NOTIFY branchChanged STORED true);
|
Chris@44
|
16 Q_PROPERTY(QString tag READ tag WRITE setTag NOTIFY tagChanged STORED true);
|
Chris@43
|
17 Q_PROPERTY(QString date READ date WRITE setDate NOTIFY dateChanged STORED true);
|
Chris@43
|
18 Q_PROPERTY(QString age READ age WRITE setAge NOTIFY ageChanged STORED true);
|
Chris@43
|
19 Q_PROPERTY(QStringList parents READ parents WRITE setParents NOTIFY parentsChanged STORED true);
|
Chris@43
|
20 Q_PROPERTY(QString comment READ comment WRITE setComment NOTIFY commentChanged STORED true);
|
Chris@43
|
21
|
Chris@43
|
22 public:
|
Chris@43
|
23 Changeset() : QObject() { }
|
Chris@43
|
24
|
Chris@43
|
25 QString id() const { return m_id; }
|
Chris@43
|
26 QString author() const { return m_author; }
|
Chris@43
|
27 QString branch() const { return m_branch; }
|
Chris@44
|
28 QString tag() const { return m_tag; }
|
Chris@43
|
29 QString date() const { return m_date; }
|
Chris@43
|
30 QString age() const { return m_age; }
|
Chris@43
|
31 QStringList parents() const { return m_parents; }
|
Chris@43
|
32 QString comment() const { return m_comment; }
|
Chris@43
|
33
|
Chris@43
|
34 int number() const {
|
Chris@43
|
35 return id().split(':')[0].toInt();
|
Chris@43
|
36 }
|
Chris@43
|
37
|
Chris@44
|
38 QString authorName() const {
|
Chris@44
|
39 QString a = author();
|
Chris@44
|
40 return a.replace(QRegExp("\\s*<[^>]*>"), "");
|
Chris@44
|
41 }
|
Chris@44
|
42
|
Chris@43
|
43 signals:
|
Chris@43
|
44 void idChanged(QString id);
|
Chris@43
|
45 void authorChanged(QString author);
|
Chris@43
|
46 void branchChanged(QString branch);
|
Chris@44
|
47 void tagChanged(QString tag);
|
Chris@43
|
48 void dateChanged(QString date);
|
Chris@43
|
49 void ageChanged(QString age);
|
Chris@43
|
50 void parentsChanged(QStringList parents);
|
Chris@43
|
51 void commentChanged(QString comment);
|
Chris@43
|
52
|
Chris@43
|
53 public slots:
|
Chris@43
|
54 void setId(QString id) { m_id = id; emit idChanged(id); }
|
Chris@43
|
55 void setAuthor(QString author) { m_author = author; emit authorChanged(author); }
|
Chris@43
|
56 void setBranch(QString branch) { m_branch = branch; emit branchChanged(branch); }
|
Chris@44
|
57 void setTag(QString tag) { m_tag = tag; emit tagChanged(tag); }
|
Chris@43
|
58 void setDate(QString date) { m_date = date; emit dateChanged(date); }
|
Chris@43
|
59 void setAge(QString age) { m_age = age; emit ageChanged(age); }
|
Chris@43
|
60 void setParents(QStringList parents) { m_parents = parents; emit parentsChanged(parents); }
|
Chris@43
|
61 void setComment(QString comment) { m_comment = comment; emit commentChanged(comment); }
|
Chris@43
|
62
|
Chris@43
|
63 private:
|
Chris@43
|
64 QString m_id;
|
Chris@43
|
65 QString m_author;
|
Chris@43
|
66 QString m_branch;
|
Chris@44
|
67 QString m_tag;
|
Chris@43
|
68 QString m_date;
|
Chris@43
|
69 QString m_age;
|
Chris@43
|
70 QStringList m_parents;
|
Chris@43
|
71 QString m_comment;
|
Chris@43
|
72 };
|
Chris@43
|
73
|
Chris@43
|
74 typedef QList<Changeset *> Changesets;
|
Chris@43
|
75
|
Chris@43
|
76 #endif // CHANGESET_H
|