diff src/changesetitem.cpp @ 390:ef31a55c86b6 item_appearance_adjustments

Add little yellow star to current item
author Chris Cannam
date Tue, 24 May 2011 17:21:31 +0100
parents ce6a70970808
children 1a811e7721f1
line wrap: on
line diff
--- a/src/changesetitem.cpp	Tue May 24 16:54:24 2011 +0100
+++ b/src/changesetitem.cpp	Tue May 24 17:21:31 2011 +0100
@@ -33,6 +33,8 @@
 #include <QApplication>
 #include <QClipboard>
 
+QImage *ChangesetItem::m_star = 0;
+
 ChangesetItem::ChangesetItem(Changeset *cs) :
     m_changeset(cs), m_detail(0),
     m_showBranch(false), m_column(0), m_row(0), m_wide(false),
@@ -43,6 +45,8 @@
     m_font.setBold(false);
     m_font.setItalic(false);
     setCursor(Qt::ArrowCursor);
+
+    if (!m_star) m_star = new QImage(":images/star.png");
 }
 
 QString
@@ -385,6 +389,14 @@
     paint->setBrush(Qt::NoBrush);
     paint->drawRoundedRect(r, 7, 7);
 
+    if (m_current && showProperLines) {
+        paint->setRenderHint(QPainter::SmoothPixmapTransform, true);
+        int starSize = fh * 1.5;
+        paint->drawImage(QRectF(x0 + width - starSize,
+                                -fh, starSize, starSize),
+                         *m_star);
+    }
+
     if (m_showBranch) {
 	// write branch name
         paint->save();
@@ -444,6 +456,22 @@
     int x0 = -size/2 + 25;
 
     paint->setBrush(Qt::white);
+
+    if (showProperLines) {
+
+        if (m_current) {
+            paint->drawEllipse(QRectF(x0 - 4, fh - 4, size + 8, size + 8));
+        }
+
+        if (m_new) {
+            paint->save();
+            paint->setPen(Qt::yellow);
+            paint->setBrush(Qt::NoBrush);
+            paint->drawEllipse(QRectF(x0 - 2, fh - 2, size + 4, size + 4));
+            paint->restore();
+        }
+    }
+
     paint->drawEllipse(QRectF(x0, fh, size, size));
 
     if (m_showBranch) {
@@ -461,6 +489,14 @@
         paint->restore();
     }
 
+    if (m_current && showProperLines) {
+        paint->setRenderHint(QPainter::SmoothPixmapTransform, true);
+        int starSize = fh * 1.5;
+        paint->drawImage(QRectF(x0 + size - starSize/2,
+                                0, starSize, starSize),
+                         *m_star);
+    }
+
     paint->restore();
 }