Chris@119
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@119
|
2
|
Chris@119
|
3 /*
|
Chris@119
|
4 EasyMercurial
|
Chris@119
|
5
|
Chris@119
|
6 Based on HgExplorer by Jari Korhonen
|
Chris@119
|
7 Copyright (c) 2010 Jari Korhonen
|
Chris@244
|
8 Copyright (c) 2011 Chris Cannam
|
Chris@244
|
9 Copyright (c) 2011 Queen Mary, University of London
|
Chris@119
|
10
|
Chris@119
|
11 This program is free software; you can redistribute it and/or
|
Chris@119
|
12 modify it under the terms of the GNU General Public License as
|
Chris@119
|
13 published by the Free Software Foundation; either version 2 of the
|
Chris@119
|
14 License, or (at your option) any later version. See the file
|
Chris@119
|
15 COPYING included with this distribution for more information.
|
Chris@119
|
16 */
|
Chris@119
|
17
|
Chris@119
|
18 #ifndef CHANGESETSCENE_H
|
Chris@119
|
19 #define CHANGESETSCENE_H
|
Chris@119
|
20
|
Chris@119
|
21 #include <QGraphicsScene>
|
Chris@397
|
22 #include <QMap>
|
Chris@119
|
23
|
Chris@119
|
24 class ChangesetItem;
|
Chris@289
|
25 class Changeset;
|
Chris@141
|
26 class UncommittedItem;
|
Chris@119
|
27
|
Chris@119
|
28 class ChangesetScene : public QGraphicsScene
|
Chris@119
|
29 {
|
Chris@119
|
30 Q_OBJECT
|
Chris@119
|
31
|
Chris@119
|
32 public:
|
Chris@119
|
33 ChangesetScene();
|
Chris@119
|
34
|
Chris@141
|
35 void addChangesetItem(ChangesetItem *item);
|
Chris@141
|
36 void addUncommittedItem(UncommittedItem *item);
|
Chris@397
|
37
|
Chris@397
|
38 void addDateRange(QString label, int minrow, int nrows, bool even);
|
Chris@397
|
39
|
Chris@397
|
40 struct DateRange {
|
Chris@397
|
41 QString label;
|
Chris@397
|
42 int minrow;
|
Chris@397
|
43 int nrows;
|
Chris@397
|
44 bool even;
|
Chris@397
|
45 };
|
Chris@397
|
46
|
Chris@397
|
47 typedef QMap<int, DateRange> DateRanges; // key is minrow
|
Chris@397
|
48 DateRanges getDateRanges() const { return m_dateRanges; }
|
Chris@397
|
49
|
Chris@397
|
50 void itemAddCompleted(); // recalculate scene rect
|
Chris@141
|
51
|
Chris@281
|
52 ChangesetItem *getItemById(QString id); // Slow: traversal required
|
Chris@281
|
53
|
Chris@141
|
54 signals:
|
Chris@141
|
55 void commit();
|
Chris@141
|
56 void revert();
|
Chris@141
|
57 void diffWorkingFolder();
|
Chris@168
|
58 void showSummary();
|
Chris@153
|
59 void showWork();
|
Chris@311
|
60 void newBranch();
|
Chris@311
|
61 void noBranch();
|
Chris@141
|
62
|
Chris@141
|
63 void updateTo(QString id);
|
Chris@148
|
64 void diffToParent(QString id, QString parent);
|
Chris@289
|
65 void showSummary(Changeset *);
|
Chris@141
|
66 void diffToCurrent(QString id);
|
Chris@141
|
67 void mergeFrom(QString id);
|
Chris@278
|
68 void newBranch(QString id);
|
Chris@514
|
69 void closeBranch(QString id);
|
Chris@141
|
70 void tag(QString id);
|
Chris@141
|
71
|
Chris@168
|
72 private slots:
|
Chris@119
|
73 void changesetDetailShown();
|
Chris@168
|
74 void changesetDetailHidden();
|
Chris@402
|
75 void recalculateSceneRect();
|
Chris@397
|
76
|
Chris@397
|
77 protected:
|
Chris@397
|
78 void drawBackground(QPainter *, const QRectF &);
|
Chris@119
|
79
|
Chris@119
|
80 private:
|
Chris@119
|
81 ChangesetItem *m_detailShown;
|
Chris@397
|
82 DateRanges m_dateRanges;
|
Chris@119
|
83 };
|
Chris@119
|
84
|
Chris@119
|
85 #endif
|