Mercurial > hg > easyhg
diff historywidget.cpp @ 141:e6c6b88d19b9
* Start hooking up right-button menus on changeset & uncommitted items
author | Chris Cannam |
---|---|
date | Tue, 30 Nov 2010 17:56:11 +0000 |
parents | e8a481789607 |
children | 644bd31e8301 |
line wrap: on
line diff
--- a/historywidget.cpp Tue Nov 30 14:59:52 2010 +0000 +++ b/historywidget.cpp Tue Nov 30 17:56:11 2010 +0000 @@ -72,10 +72,11 @@ { if (m_uncommittedVisible == show) return; m_uncommittedVisible = show; - QGraphicsScene *scene = m_panned->scene(); + ChangesetScene *scene = qobject_cast<ChangesetScene *>(m_panned->scene()); if (!scene) return; if (m_uncommittedVisible) { - scene->addItem(m_uncommitted); + scene->addUncommittedItem(m_uncommitted); + m_uncommitted->ensureVisible(); } else { scene->removeItem(m_uncommitted); } @@ -174,7 +175,7 @@ } if (m_uncommittedVisible) { - scene->addItem(m_uncommitted); + scene->addUncommittedItem(m_uncommitted); } m_panned->setScene(scene); @@ -183,11 +184,14 @@ updateNewAndCurrentItems(); if (m_uncommittedVisible) { + DEBUG << "asking uncommitted item to be visible" << endl; m_uncommitted->ensureVisible(); } else if (tipItem) { DEBUG << "asking tip item to be visible" << endl; tipItem->ensureVisible(); } + + connectSceneSignals(); } void HistoryWidget::setChangesetParents() @@ -242,3 +246,33 @@ } } } + +void HistoryWidget::connectSceneSignals() +{ + ChangesetScene *scene = qobject_cast<ChangesetScene *>(m_panned->scene()); + if (!scene) return; + + connect(scene, SIGNAL(commit()), + this, SIGNAL(commit())); + + connect(scene, SIGNAL(revert()), + this, SIGNAL(revert())); + + connect(scene, SIGNAL(diffWorkingFolder()), + this, SIGNAL(diffWorkingFolder())); + + connect(scene, SIGNAL(updateTo(QString)), + this, SIGNAL(updateTo(QString))); + + connect(scene, SIGNAL(diffToCurrent(QString)), + this, SIGNAL(diffToCurrent(QString))); + + connect(scene, SIGNAL(diffToPrevious(QString)), + this, SIGNAL(diffToPrevious(QString))); + + connect(scene, SIGNAL(mergeFrom(QString)), + this, SIGNAL(mergeFrom(QString))); + + connect(scene, SIGNAL(tag(QString)), + this, SIGNAL(tag(QString))); +}