comparison historywidget.cpp @ 139:e8a481789607

* Avoid unnecessary duplicate layout; fix off-by-one in resetting changeset children
author Chris Cannam
date Tue, 30 Nov 2010 14:27:34 +0000
parents a7dbc8e5b69d
children e6c6b88d19b9
comparison
equal deleted inserted replaced
138:a7dbc8e5b69d 139:e8a481789607
68 updateNewAndCurrentItems(); 68 updateNewAndCurrentItems();
69 } 69 }
70 70
71 void HistoryWidget::showUncommittedChanges(bool show) 71 void HistoryWidget::showUncommittedChanges(bool show)
72 { 72 {
73 if (m_uncommittedVisible == show) return;
73 m_uncommittedVisible = show; 74 m_uncommittedVisible = show;
74 layoutAll(); 75 QGraphicsScene *scene = m_panned->scene();
76 if (!scene) return;
77 if (m_uncommittedVisible) {
78 scene->addItem(m_uncommitted);
79 } else {
80 scene->removeItem(m_uncommitted);
81 }
75 } 82 }
76 83
77 void HistoryWidget::parseNewLog(QString log) 84 void HistoryWidget::parseNewLog(QString log)
78 { 85 {
79 DEBUG << "HistoryWidget::parseNewLog: log has " << log.length() << " chars" << endl; 86 DEBUG << "HistoryWidget::parseNewLog: log has " << log.length() << " chars" << endl;
183 } 190 }
184 } 191 }
185 192
186 void HistoryWidget::setChangesetParents() 193 void HistoryWidget::setChangesetParents()
187 { 194 {
188 for (int i = 0; i+1 < m_changesets.size(); ++i) { 195 for (int i = 0; i < m_changesets.size(); ++i) {
189 Changeset *cs = m_changesets[i]; 196 Changeset *cs = m_changesets[i];
190 // Need to reset this, as Grapher::layout will recalculate it 197 // Need to reset this, as Grapher::layout will recalculate it
191 // and we don't want to end up with twice the children for 198 // and we don't want to end up with twice the children for
192 // each parent... 199 // each parent...
193 cs->setChildren(QStringList()); 200 cs->setChildren(QStringList());
201 }
202 for (int i = 0; i+1 < m_changesets.size(); ++i) {
203 Changeset *cs = m_changesets[i];
194 if (cs->parents().empty()) { 204 if (cs->parents().empty()) {
195 QStringList list; 205 QStringList list;
196 list.push_back(m_changesets[i+1]->id()); 206 list.push_back(m_changesets[i+1]->id());
197 cs->setParents(list); 207 cs->setParents(list);
198 } 208 }