changeset 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 496f2042155a
children 1a811e7721f1
files easyhg.qrc images/star.png src/changesetitem.cpp src/changesetitem.h src/connectionitem.cpp
diffstat 5 files changed, 41 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/easyhg.qrc	Tue May 24 16:54:24 2011 +0100
+++ b/easyhg.qrc	Tue May 24 17:21:31 2011 +0100
@@ -22,6 +22,7 @@
         <file>images/hdd_unmount.png</file>
         <file>images/hdd_unmount-64.png</file>
         <file>images/fileopen.png</file>
+        <file>images/star.png</file>
         <file>images/easyhg-icon.png</file>
 	<file>easyhg.py</file>
 	<file>easyhg_en.qm</file>
Binary file images/star.png has changed
--- 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();
 }
 
--- a/src/changesetitem.h	Tue May 24 16:54:24 2011 +0100
+++ b/src/changesetitem.h	Tue May 24 17:21:31 2011 +0100
@@ -25,6 +25,7 @@
 class ChangesetDetailItem;
 
 class QAction;
+class QImage;
 
 class ChangesetItem : public QGraphicsObject
 {
@@ -101,6 +102,8 @@
     QMap<QAction *, QString> m_parentDiffActions;
     QMap<QAction *, QString> m_summaryActions;
 
+    static QImage *m_star;
+
     bool isMerge() const;
     virtual void paintNormal(QPainter *);
     virtual void paintMerge(QPainter *);
--- a/src/connectionitem.cpp	Tue May 24 16:54:24 2011 +0100
+++ b/src/connectionitem.cpp	Tue May 24 17:21:31 2011 +0100
@@ -42,7 +42,7 @@
 
     return QRectF(xscale * c_col + size/2 - 2,
 		  yscale * c_row + size - 22,
-		  xscale * p_col - xscale * c_col + 4,
+		  xscale * p_col - xscale * c_col + 6,
 		  yscale * p_row - yscale * c_row - size + 44)
 	.normalized();
 }