changeset 521:b5a342a71218

Bookmarks display now... OK
author Chris Cannam
date Thu, 10 Nov 2011 17:19:06 +0000
parents a17c06f773cd
children 43ddfa5e9fd0
files src/changeset.cpp src/changesetitem.cpp src/mainwindow.cpp
diffstat 3 files changed, 37 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/changeset.cpp	Wed Nov 09 13:04:00 2011 +0000
+++ b/src/changeset.cpp	Thu Nov 10 17:19:06 2011 +0000
@@ -82,7 +82,8 @@
 	      << QObject::tr("Author:")
 	      << QObject::tr("Date:")
 	      << QObject::tr("Branch:")
-	      << QObject::tr("Tag:")
+	      << QObject::tr("Tags:")
+	      << QObject::tr("Bookmarks:")
 	      << QObject::tr("Comment:");
 
     for (int i = 0; i < propNames.size(); ++i) {
--- 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);
--- a/src/mainwindow.cpp	Wed Nov 09 13:04:00 2011 +0000
+++ b/src/mainwindow.cpp	Thu Nov 10 17:19:06 2011 +0000
@@ -2227,7 +2227,7 @@
 
 void MainWindow::commandCompleted(HgAction completedAction, QString output)
 {
-    std::cerr << "commandCompleted: " << completedAction.action << std::endl;
+//    std::cerr << "commandCompleted: " << completedAction.action << std::endl;
 
     restoreFileSystemWatcher();
     HGACTIONS action = completedAction.action;