Mercurial > hg > easyhg
comparison src/changesetscene.h @ 397:61bde1f0ff0a item_appearance_adjustments
Replace DateItems (background items for date shading) with a date range list in the scene and dedicated rendering for it in the graphics view: this way we can ensure the shading spans the full width and the dates are always visible
author | Chris Cannam |
---|---|
date | Wed, 25 May 2011 14:32:32 +0100 |
parents | b9c153e00e84 |
children | 75003687f364 |
comparison
equal
deleted
inserted
replaced
396:1e73b5911631 | 397:61bde1f0ff0a |
---|---|
17 | 17 |
18 #ifndef CHANGESETSCENE_H | 18 #ifndef CHANGESETSCENE_H |
19 #define CHANGESETSCENE_H | 19 #define CHANGESETSCENE_H |
20 | 20 |
21 #include <QGraphicsScene> | 21 #include <QGraphicsScene> |
22 #include <QMap> | |
22 | 23 |
23 class ChangesetItem; | 24 class ChangesetItem; |
24 class Changeset; | 25 class Changeset; |
25 class UncommittedItem; | 26 class UncommittedItem; |
26 class DateItem; | |
27 | 27 |
28 class ChangesetScene : public QGraphicsScene | 28 class ChangesetScene : public QGraphicsScene |
29 { | 29 { |
30 Q_OBJECT | 30 Q_OBJECT |
31 | 31 |
32 public: | 32 public: |
33 ChangesetScene(); | 33 ChangesetScene(); |
34 | 34 |
35 void addChangesetItem(ChangesetItem *item); | 35 void addChangesetItem(ChangesetItem *item); |
36 void addUncommittedItem(UncommittedItem *item); | 36 void addUncommittedItem(UncommittedItem *item); |
37 void addDateItem(DateItem *item); | 37 |
38 void addDateRange(QString label, int minrow, int nrows, bool even); | |
39 | |
40 struct DateRange { | |
41 QString label; | |
42 int minrow; | |
43 int nrows; | |
44 bool even; | |
45 }; | |
46 | |
47 typedef QMap<int, DateRange> DateRanges; // key is minrow | |
48 DateRanges getDateRanges() const { return m_dateRanges; } | |
49 | |
50 void itemAddCompleted(); // recalculate scene rect | |
38 | 51 |
39 ChangesetItem *getItemById(QString id); // Slow: traversal required | 52 ChangesetItem *getItemById(QString id); // Slow: traversal required |
40 | 53 |
41 signals: | 54 signals: |
42 void commit(); | 55 void commit(); |
56 void tag(QString id); | 69 void tag(QString id); |
57 | 70 |
58 private slots: | 71 private slots: |
59 void changesetDetailShown(); | 72 void changesetDetailShown(); |
60 void changesetDetailHidden(); | 73 void changesetDetailHidden(); |
61 void dateItemClicked(); | 74 |
75 protected: | |
76 void drawBackground(QPainter *, const QRectF &); | |
62 | 77 |
63 private: | 78 private: |
64 ChangesetItem *m_detailShown; | 79 ChangesetItem *m_detailShown; |
80 DateRanges m_dateRanges; | |
65 }; | 81 }; |
66 | 82 |
67 #endif | 83 #endif |