# HG changeset patch # User Chris Cannam # Date 1291127254 0 # Node ID e8a4817896070048f7019200f7536e8c4bebd210 # Parent a7dbc8e5b69d555acc5de11c3881c54d22c27360 * Avoid unnecessary duplicate layout; fix off-by-one in resetting changeset children diff -r a7dbc8e5b69d -r e8a481789607 grapher.cpp --- a/grapher.cpp Tue Nov 30 13:51:50 2010 +0000 +++ b/grapher.cpp Tue Nov 30 14:27:34 2010 +0000 @@ -196,6 +196,7 @@ // connection lines foreach (QString childId, cs->children()) { + DEBUG << "reserving connection line space" << endl; if (!m_changesets.contains(childId)) continue; Changeset *child = m_changesets[childId]; int childRow = m_items[childId]->row(); @@ -211,7 +212,6 @@ // branch as us: split them to a little either side of our position if (nchildren > 1) { - QList special; foreach (QString childId, cs->children()) { if (!m_changesets.contains(childId)) continue; @@ -222,6 +222,7 @@ } } if (special.size() == 2) { + DEBUG << "handling split-in-two for children " << special[0] << " and " << special[1] << endl; for (int i = 0; i < 2; ++i) { int off = i * 2 - 1; // 0 -> -1, 1 -> 1 ChangesetItem *it = m_items[special[i]]; @@ -324,12 +325,14 @@ m_alloc.clear(); m_branchHomes.clear(); + DEBUG << "Grapher::layout: Have " << csets.size() << " changesets" << endl; + if (csets.empty()) return; foreach (Changeset *cs, csets) { QString id = cs->id(); - DEBUG << id.toStdString() << endl; +// DEBUG << id.toStdString() << endl; if (id == "") { throw LayoutException("Changeset has no ID"); diff -r a7dbc8e5b69d -r e8a481789607 historywidget.cpp --- a/historywidget.cpp Tue Nov 30 13:51:50 2010 +0000 +++ b/historywidget.cpp Tue Nov 30 14:27:34 2010 +0000 @@ -70,8 +70,15 @@ void HistoryWidget::showUncommittedChanges(bool show) { + if (m_uncommittedVisible == show) return; m_uncommittedVisible = show; - layoutAll(); + QGraphicsScene *scene = m_panned->scene(); + if (!scene) return; + if (m_uncommittedVisible) { + scene->addItem(m_uncommitted); + } else { + scene->removeItem(m_uncommitted); + } } void HistoryWidget::parseNewLog(QString log) @@ -185,12 +192,15 @@ void HistoryWidget::setChangesetParents() { - for (int i = 0; i+1 < m_changesets.size(); ++i) { + for (int i = 0; i < m_changesets.size(); ++i) { Changeset *cs = m_changesets[i]; // Need to reset this, as Grapher::layout will recalculate it // and we don't want to end up with twice the children for // each parent... cs->setChildren(QStringList()); + } + for (int i = 0; i+1 < m_changesets.size(); ++i) { + Changeset *cs = m_changesets[i]; if (cs->parents().empty()) { QStringList list; list.push_back(m_changesets[i+1]->id());