diff 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
line wrap: on
line diff
--- a/src/changesetscene.h	Tue May 24 18:00:12 2011 +0100
+++ b/src/changesetscene.h	Wed May 25 14:32:32 2011 +0100
@@ -19,11 +19,11 @@
 #define CHANGESETSCENE_H
 
 #include <QGraphicsScene>
+#include <QMap>
 
 class ChangesetItem;
 class Changeset;
 class UncommittedItem;
-class DateItem;
 
 class ChangesetScene : public QGraphicsScene
 {
@@ -34,7 +34,20 @@
 
     void addChangesetItem(ChangesetItem *item);
     void addUncommittedItem(UncommittedItem *item);
-    void addDateItem(DateItem *item);
+
+    void addDateRange(QString label, int minrow, int nrows, bool even);
+
+    struct DateRange {
+        QString label;
+        int minrow;
+        int nrows;
+        bool even;
+    };
+
+    typedef QMap<int, DateRange> DateRanges; // key is minrow
+    DateRanges getDateRanges() const { return m_dateRanges; }
+
+    void itemAddCompleted(); // recalculate scene rect
 
     ChangesetItem *getItemById(QString id); // Slow: traversal required
 
@@ -58,10 +71,13 @@
 private slots:
     void changesetDetailShown();
     void changesetDetailHidden();
-    void dateItemClicked();
+
+protected:
+    void drawBackground(QPainter *, const QRectF &);
 
 private:
     ChangesetItem *m_detailShown;
+    DateRanges m_dateRanges;
 };
 
 #endif