annotate changeset.h @ 86:89f793fbedda

* More on "Open" logic; fix to StatParser, and start introducing it
author Chris Cannam
date Mon, 22 Nov 2010 20:17:14 +0000
parents f583e44d9d31
children 729438d70af8
rev   line source
Chris@57 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@57 2
Chris@57 3 /*
Chris@57 4 EasyMercurial
Chris@57 5
Chris@57 6 Based on HgExplorer by Jari Korhonen
Chris@57 7 Copyright (c) 2010 Jari Korhonen
Chris@57 8 Copyright (c) 2010 Chris Cannam
Chris@57 9 Copyright (c) 2010 Queen Mary, University of London
Chris@57 10
Chris@57 11 This program is free software; you can redistribute it and/or
Chris@57 12 modify it under the terms of the GNU General Public License as
Chris@57 13 published by the Free Software Foundation; either version 2 of the
Chris@57 14 License, or (at your option) any later version. See the file
Chris@57 15 COPYING included with this distribution for more information.
Chris@57 16 */
Chris@57 17
Chris@43 18 #ifndef CHANGESET_H
Chris@43 19 #define CHANGESET_H
Chris@43 20
Chris@43 21 #include <QObject>
Chris@43 22 #include <QString>
Chris@43 23 #include <QStringList>
Chris@43 24 #include <QList>
Chris@43 25
Chris@43 26 class Changeset : public QObject
Chris@43 27 {
Chris@43 28 Q_OBJECT
Chris@43 29
Chris@43 30 Q_PROPERTY(QString id READ id WRITE setId NOTIFY idChanged STORED true);
Chris@43 31 Q_PROPERTY(QString author READ author WRITE setAuthor NOTIFY authorChanged STORED true);
Chris@43 32 Q_PROPERTY(QString branch READ branch WRITE setBranch NOTIFY branchChanged STORED true);
Chris@44 33 Q_PROPERTY(QString tag READ tag WRITE setTag NOTIFY tagChanged STORED true);
Chris@52 34 Q_PROPERTY(QString datetime READ datetime WRITE setDatetime NOTIFY datetimeChanged STORED true);
Chris@52 35 Q_PROPERTY(qulonglong timestamp READ timestamp WRITE setTimestamp NOTIFY timestampChanged STORED true);
Chris@43 36 Q_PROPERTY(QString age READ age WRITE setAge NOTIFY ageChanged STORED true);
Chris@43 37 Q_PROPERTY(QStringList parents READ parents WRITE setParents NOTIFY parentsChanged STORED true);
Chris@47 38 Q_PROPERTY(QStringList children READ children WRITE setChildren NOTIFY childrenChanged STORED true);
Chris@43 39 Q_PROPERTY(QString comment READ comment WRITE setComment NOTIFY commentChanged STORED true);
Chris@43 40
Chris@43 41 public:
Chris@43 42 Changeset() : QObject() { }
Chris@43 43
Chris@43 44 QString id() const { return m_id; }
Chris@43 45 QString author() const { return m_author; }
Chris@43 46 QString branch() const { return m_branch; }
Chris@44 47 QString tag() const { return m_tag; }
Chris@51 48 QString datetime() const { return m_datetime; }
Chris@52 49 qulonglong timestamp() const { return m_timestamp; }
Chris@43 50 QString age() const { return m_age; }
Chris@43 51 QStringList parents() const { return m_parents; }
Chris@47 52 QStringList children() const { return m_children; }
Chris@43 53 QString comment() const { return m_comment; }
Chris@43 54
Chris@43 55 int number() const {
Chris@43 56 return id().split(':')[0].toInt();
Chris@43 57 }
Chris@43 58
Chris@44 59 QString authorName() const {
Chris@44 60 QString a = author();
Chris@44 61 return a.replace(QRegExp("\\s*<[^>]*>"), "");
Chris@44 62 }
Chris@44 63
Chris@51 64 QString date() const {
Chris@51 65 return datetime().split(' ')[0];
Chris@51 66 }
Chris@51 67
Chris@43 68 signals:
Chris@43 69 void idChanged(QString id);
Chris@43 70 void authorChanged(QString author);
Chris@43 71 void branchChanged(QString branch);
Chris@44 72 void tagChanged(QString tag);
Chris@51 73 void datetimeChanged(QString datetime);
Chris@52 74 void timestampChanged(qulonglong timestamp);
Chris@43 75 void ageChanged(QString age);
Chris@43 76 void parentsChanged(QStringList parents);
Chris@47 77 void childrenChanged(QStringList children);
Chris@43 78 void commentChanged(QString comment);
Chris@43 79
Chris@43 80 public slots:
Chris@43 81 void setId(QString id) { m_id = id; emit idChanged(id); }
Chris@43 82 void setAuthor(QString author) { m_author = author; emit authorChanged(author); }
Chris@43 83 void setBranch(QString branch) { m_branch = branch; emit branchChanged(branch); }
Chris@44 84 void setTag(QString tag) { m_tag = tag; emit tagChanged(tag); }
Chris@52 85 void setDatetime(QString datetime) { m_datetime = datetime; emit datetimeChanged(datetime); }
Chris@52 86 void setTimestamp(qulonglong timestamp) { m_timestamp = timestamp; emit timestampChanged(timestamp); }
Chris@43 87 void setAge(QString age) { m_age = age; emit ageChanged(age); }
Chris@43 88 void setParents(QStringList parents) { m_parents = parents; emit parentsChanged(parents); }
Chris@47 89 void setChildren(QStringList children) { m_children = children; emit childrenChanged(m_children); }
Chris@47 90 void addChild(QString child) { m_children.push_back(child); emit childrenChanged(m_children); }
Chris@43 91 void setComment(QString comment) { m_comment = comment; emit commentChanged(comment); }
Chris@43 92
Chris@43 93 private:
Chris@43 94 QString m_id;
Chris@43 95 QString m_author;
Chris@43 96 QString m_branch;
Chris@44 97 QString m_tag;
Chris@51 98 QString m_datetime;
Chris@52 99 qulonglong m_timestamp;
Chris@43 100 QString m_age;
Chris@43 101 QStringList m_parents;
Chris@47 102 QStringList m_children;
Chris@43 103 QString m_comment;
Chris@43 104 };
Chris@43 105
Chris@43 106 typedef QList<Changeset *> Changesets;
Chris@43 107
Chris@43 108 #endif // CHANGESET_H