diff historywidget.cpp @ 128:fcaf09ee825d

* Show tags and current working copy parents in history graph
author Chris Cannam
date Mon, 29 Nov 2010 20:09:58 +0000
parents 3afa1ce339ec
children 4986642800f0
line wrap: on
line diff
--- a/historywidget.cpp	Mon Nov 29 17:48:43 2010 +0000
+++ b/historywidget.cpp	Mon Nov 29 20:09:58 2010 +0000
@@ -51,6 +51,19 @@
     foreach (Changeset *cs, m_changesets) delete cs;
     m_changesets.clear();
 }
+
+void HistoryWidget::setCurrent(QStringList ids)
+{
+    if (m_currentIds == ids) return;
+    DEBUG << "HistoryWidget::setCurrent: " << ids.size() << " ids" << endl;
+    m_currentIds = ids;
+    updateCurrentItems();
+}
+
+void HistoryWidget::showUncommittedChanges(bool show)
+{
+    //!!! implement!
+}
     
 void HistoryWidget::parseNewLog(QString log)
 {
@@ -99,6 +112,8 @@
 
     if (oldScene) delete oldScene;
     if (tipItem) tipItem->ensureVisible();
+
+    updateCurrentItems();
 }
 
 void HistoryWidget::setChangesetParents()
@@ -116,3 +131,22 @@
         }
     }
 }
+
+void HistoryWidget::updateCurrentItems()
+{
+    QGraphicsScene *scene = m_panned->scene();
+    if (!scene) return;
+    QList<QGraphicsItem *> items = scene->items();
+    foreach (QGraphicsItem *it, items) {
+        ChangesetItem *csit = dynamic_cast<ChangesetItem *>(it);
+        if (csit) {
+            QString id = csit->getChangeset()->id();
+            bool current = m_currentIds.contains(id);
+            if (current) {
+                DEBUG << "id " << id << " is current" << endl;
+            }
+            csit->setCurrent(current);
+        }
+    }
+}
+