comparison historywidget.cpp @ 154:6bcb4a4d6521

* Try to reduce unnecessary history updates; add --new-branch option on push
author Chris Cannam
date Thu, 02 Dec 2010 18:04:21 +0000
parents 70fe12873106
children 4bad3c5c053a
comparison
equal deleted inserted replaced
153:70fe12873106 154:6bcb4a4d6521
26 26
27 #include <iostream> 27 #include <iostream>
28 28
29 #include <QGridLayout> 29 #include <QGridLayout>
30 30
31 HistoryWidget::HistoryWidget() 31 HistoryWidget::HistoryWidget() :
32 m_showUncommitted(false),
33 m_refreshNeeded(false)
32 { 34 {
33 m_panned = new Panned; 35 m_panned = new Panned;
34 m_panner = new Panner; 36 m_panner = new Panner;
35 37
36 QGridLayout *layout = new QGridLayout; 38 QGridLayout *layout = new QGridLayout;
76 78
77 foreach (QString id, ids) { 79 foreach (QString id, ids) {
78 m_currentIds.push_back(id); 80 m_currentIds.push_back(id);
79 } 81 }
80 82
81 layoutAll(); 83 m_refreshNeeded = true;
82 } 84 }
83 85
84 void HistoryWidget::parseNewLog(QString log) 86 void HistoryWidget::parseNewLog(QString log)
85 { 87 {
86 DEBUG << "HistoryWidget::parseNewLog: log has " << log.length() << " chars" << endl; 88 DEBUG << "HistoryWidget::parseNewLog: log has " << log.length() << " chars" << endl;
87 Changesets csets = Changeset::parseChangesets(log); 89 Changesets csets = Changeset::parseChangesets(log);
88 DEBUG << "HistoryWidget::parseNewLog: log has " << csets.size() << " changesets" << endl; 90 DEBUG << "HistoryWidget::parseNewLog: log has " << csets.size() << " changesets" << endl;
89 replaceChangesets(csets); 91 replaceChangesets(csets);
90 layoutAll(); 92 m_refreshNeeded = true;
91 } 93 }
92 94
93 void HistoryWidget::parseIncrementalLog(QString log) 95 void HistoryWidget::parseIncrementalLog(QString log)
94 { 96 {
95 DEBUG << "HistoryWidget::parseIncrementalLog: log has " << log.length() << " chars" << endl; 97 DEBUG << "HistoryWidget::parseIncrementalLog: log has " << log.length() << " chars" << endl;
96 Changesets csets = Changeset::parseChangesets(log); 98 Changesets csets = Changeset::parseChangesets(log);
97 DEBUG << "HistoryWidget::parseIncrementalLog: log has " << csets.size() << " changesets" << endl; 99 DEBUG << "HistoryWidget::parseIncrementalLog: log has " << csets.size() << " changesets" << endl;
98 if (!csets.empty()) { 100 if (!csets.empty()) {
99 addChangesets(csets); 101 addChangesets(csets);
100 layoutAll(); 102 }
101 } 103 m_refreshNeeded = true;
102 } 104 }
103 105
104 void HistoryWidget::replaceChangesets(Changesets csets) 106 void HistoryWidget::replaceChangesets(Changesets csets)
105 { 107 {
106 QSet<QString> oldIds; 108 QSet<QString> oldIds;
140 142
141 csets << m_changesets; 143 csets << m_changesets;
142 m_changesets = csets; 144 m_changesets = csets;
143 } 145 }
144 146
147 void HistoryWidget::update()
148 {
149 if (m_refreshNeeded) {
150 layoutAll();
151 }
152 }
153
145 void HistoryWidget::layoutAll() 154 void HistoryWidget::layoutAll()
146 { 155 {
156 m_refreshNeeded = false;
157
147 setChangesetParents(); 158 setChangesetParents();
148 159
149 ChangesetScene *scene = new ChangesetScene(); 160 ChangesetScene *scene = new ChangesetScene();
150 ChangesetItem *tipItem = 0; 161 ChangesetItem *tipItem = 0;
151 162