changeset 124:1f27f71a7034

* Fixes to changeset details display; show on right instead of below to avoid disrupting flow
author Chris Cannam
date Mon, 29 Nov 2010 11:38:25 +0000
parents 3afa1ce339ec
children 63c2f3f61c79
files changesetdetailitem.cpp changesetitem.cpp changesetscene.cpp hgrunner.cpp
diffstat 4 files changed, 21 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/changesetdetailitem.cpp	Mon Nov 29 11:18:27 2010 +0000
+++ b/changesetdetailitem.cpp	Mon Nov 29 11:38:25 2010 +0000
@@ -46,7 +46,7 @@
 {
     int w = 350;
     m_doc->setTextWidth(w);
-    return QRectF(0, -10, w, m_doc->size().height() + 10);
+    return QRectF(-10, -10, w + 10, m_doc->size().height() + 10);
 }
 
 void
@@ -93,6 +93,16 @@
 	return;
     }
 
+    // little triangle connecting to its "owning" changeset item
+    paint->setBrush(branchColour);
+    QVector<QPointF> pts;
+    pts.push_back(QPointF(0, height/3 - 5));
+    pts.push_back(QPointF(0, height/3 + 5));
+    pts.push_back(QPointF(-10, height/3));
+    pts.push_back(QPointF(0, height/3 - 5));
+    paint->drawPolygon(QPolygonF(pts));
+
+/*
     paint->setBrush(branchColour);
     QVector<QPointF> pts;
     pts.push_back(QPointF(width/2 - 5, 0));
@@ -100,49 +110,9 @@
     pts.push_back(QPointF(width/2, -10));
     pts.push_back(QPointF(width/2 - 5, 0));
     paint->drawPolygon(QPolygonF(pts));
-
+*/
     m_doc->drawContents(paint, r);
 
-/*
-    paint->fillRect(QRectF(x0 + 0.5, 0.5, width - 4, fh - 0.5),
-		    QBrush(userColour));
-
-    paint->setPen(QPen(Qt::white));
-
-    int wid = width - 5;
-    QString person = TextAbbrev::abbreviate(m_changeset->authorName(), fm, wid);
-    paint->drawText(x0 + 3, fm.ascent(), person);
-
-    paint->setPen(QPen(Qt::black));
-
-    if (m_showBranch) {
-	// write branch name
-	f.setBold(true);
-	paint->setFont(f);
-	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);
-    }
-
-//    f.setItalic(true);
-    fm = QFontMetrics(f);
-    fh = fm.height();
-    paint->setFont(f);
-
-    wid = width - 5;
-    int nlines = (height / fh) - 1;
-    if (nlines < 1) nlines = 1;
-    comment = TextAbbrev::abbreviate(comment, fm, wid, TextAbbrev::ElideEnd,
-				     "...", nlines);
-
-    QStringList lines = comment.split('\n');
-    for (int i = 0; i < lines.size(); ++i) {
-	paint->drawText(x0 + 3, i * fh + fh + fm.ascent(), lines[i].trimmed());
-    }
-    */
     paint->restore();
 }
 
--- a/changesetitem.cpp	Mon Nov 29 11:18:27 2010 +0000
+++ b/changesetitem.cpp	Mon Nov 29 11:38:25 2010 +0000
@@ -52,14 +52,19 @@
     scene()->addItem(m_detail);
     int w = 100;
     if (m_wide) w = 180;
-    m_detail->moveBy(x() - (m_detail->boundingRect().width() - 50) / 2,
-                     y() + 60);
+    int h = 80;
+//    m_detail->moveBy(x() - (m_detail->boundingRect().width() - 50) / 2,
+//                     y() + 60);
+    m_detail->moveBy(x() + (w + 50) / 2 + 10 + 0.5,
+                     y() - (m_detail->boundingRect().height() - h) / 2 + 0.5);
     emit detailShown();
 }    
 
 void
 ChangesetItem::hideDetail()
 {
+    if (!m_detail) return;
+    scene()->removeItem(m_detail);
     delete m_detail;
     m_detail = 0;
     emit detailHidden();
--- a/changesetscene.cpp	Mon Nov 29 11:18:27 2010 +0000
+++ b/changesetscene.cpp	Mon Nov 29 11:38:25 2010 +0000
@@ -29,7 +29,7 @@
     ChangesetItem *csi = qobject_cast<ChangesetItem *>(sender());
     if (!csi) return;
 
-    if (m_detailShown) {
+    if (m_detailShown && m_detailShown != csi) {
 	m_detailShown->hideDetail();
     }
     m_detailShown = csi;
--- a/hgrunner.cpp	Mon Nov 29 11:18:27 2010 +0000
+++ b/hgrunner.cpp	Mon Nov 29 11:38:25 2010 +0000
@@ -248,7 +248,7 @@
         if (procExitCode == 0 && procExitStatus == QProcess::NormalExit) {
             DEBUG << "HgRunner::finished: Command completed successfully"
                   << endl;
-            DEBUG << "stdout is " << m_stdout << endl;
+//            DEBUG << "stdout is " << m_stdout << endl;
             emit commandCompleted(completedAction, m_stdout);
         } else {
             DEBUG << "HgRunner::finished: Command failed, exit code "