diff src/changesetitem.cpp @ 521:b5a342a71218

Bookmarks display now... OK
author Chris Cannam
date Thu, 10 Nov 2011 17:19:06 +0000
parents a17c06f773cd
children a1d210c767ab
line wrap: on
line diff
--- a/src/changesetitem.cpp	Wed Nov 09 13:04:00 2011 +0000
+++ b/src/changesetitem.cpp	Thu Nov 10 17:19:06 2011 +0000
@@ -338,6 +338,40 @@
     int height = (lineCount + 1) * fh + 2;
     QRectF r(x0, 0, width - 3, height);
 
+    QColor textColour = Qt::black;
+    textColour.setAlpha(alpha);
+
+    if (m_showBranch && showText) {
+	// write branch name
+        paint->save();
+	f.setBold(true);
+	paint->setFont(f);
+	paint->setPen(QPen(branchColour));
+	QString branch = m_changeset->branch();
+        if (branch == "") branch = "default";
+	int wid = width - 3;
+	branch = TextAbbrev::abbreviate(branch, QFontMetrics(f), wid);
+	paint->drawText(x0, -fh + fm.ascent() - 4, branch);
+	f.setBold(false);
+        paint->restore();
+    }
+
+    QStringList bookmarks = m_changeset->bookmarks();
+    if (!bookmarks.empty() && showText) {
+        QString bmText = bookmarks.join(" ").trimmed();
+        int bw = fm.width(bmText);
+        int bx = x0 + width - bw - 14;
+        if (m_current) bx = bx - fh*1.5 + 3;
+        paint->save();
+        paint->setPen(QPen(branchColour, 2));
+//        paint->setBrush(QBrush(Qt::white));
+        paint->setBrush(QBrush(branchColour));
+        paint->drawRoundedRect(QRectF(bx, -fh - 4, bw + 4, fh * 2), 5, 5);
+        paint->setPen(QPen(Qt::white));
+        paint->drawText(bx + 2, -fh + fm.ascent() - 4, bmText);
+        paint->restore();
+    }
+
     if (showProperLines) {
 
         if (m_new) {
@@ -380,9 +414,6 @@
                                             fm, textwid);
     paint->drawText(x0 + 3, fm.ascent(), person);
 
-    QColor textColour = Qt::black;
-    textColour.setAlpha(alpha);
-
     paint->setPen(QPen(textColour));
 
     QStringList tags = m_changeset->tags();
@@ -407,32 +438,6 @@
         }
     }
 
-    if (m_showBranch) {
-	// write branch name
-        paint->save();
-	f.setBold(true);
-	paint->setFont(f);
-	paint->setPen(QPen(branchColour));
-	QString branch = m_changeset->branch();
-        if (branch == "") branch = "default";
-	int wid = width - 3;
-	branch = TextAbbrev::abbreviate(branch, QFontMetrics(f), wid);
-	paint->drawText(x0, -fh + fm.ascent() - 4, branch);
-	f.setBold(false);
-        paint->restore();
-    }
-
-    QStringList bookmarks = m_changeset->bookmarks();
-    if (!bookmarks.empty()) {
-        QString bmText = bookmarks.join(" ").trimmed();
-        int bw = fm.width(bmText);
-        paint->fillRect(QRectF(x0 + width - fh*2 - bw, -fh - 4,
-                               bw + 4, fh - 1),
-                        QBrush(Qt::yellow));
-        paint->drawText(x0 + width - fh*2 - bw + 2,
-                        -fh + fm.ascent() - 4, bmText);
-    }
-
     paint->setPen(QPen(branchColour, 2));
     paint->setBrush(Qt::NoBrush);
     paint->drawRoundedRect(r, 7, 7);