comparison historywidget.cpp @ 153:70fe12873106

* Show both parents of uncommitted merge; fixes to right-button menus
author Chris Cannam
date Thu, 02 Dec 2010 17:55:21 +0000
parents 2fef6b0dfbe8
children 6bcb4a4d6521
comparison
equal deleted inserted replaced
152:2b997861174b 153:70fe12873106
56 { 56 {
57 foreach (Changeset *cs, m_changesets) delete cs; 57 foreach (Changeset *cs, m_changesets) delete cs;
58 m_changesets.clear(); 58 m_changesets.clear();
59 } 59 }
60 60
61 void HistoryWidget::setCurrent(QStringList ids, bool showUncommitted) 61 void HistoryWidget::setCurrent(QStringList ids, QString branch,
62 { 62 bool showUncommitted)
63 if (m_currentIds == ids && m_showUncommitted == showUncommitted) return; 63 {
64 if (m_currentIds == ids &&
65 m_currentBranch == branch &&
66 m_showUncommitted == showUncommitted) return;
64 67
65 DEBUG << "HistoryWidget::setCurrent: " << ids.size() << " ids, " 68 DEBUG << "HistoryWidget::setCurrent: " << ids.size() << " ids, "
66 << "showUncommitted: " << showUncommitted << endl; 69 << "showUncommitted: " << showUncommitted << endl;
67 70
68 m_currentIds.clear(); 71 m_currentIds.clear();
69 m_uncommittedParentId = ""; 72 m_currentBranch = branch;
70 m_showUncommitted = showUncommitted; 73 m_showUncommitted = showUncommitted;
71 74
72 if (ids.empty()) return; 75 if (ids.empty()) return;
73 76
74 foreach (QString id, ids) { 77 foreach (QString id, ids) {
75 m_currentIds.push_back(id); 78 m_currentIds.push_back(id);
76 } 79 }
77 80
78 if (m_showUncommitted) m_uncommittedParentId = m_currentIds[0];
79 layoutAll(); 81 layoutAll();
80 } 82 }
81 83
82 void HistoryWidget::parseNewLog(QString log) 84 void HistoryWidget::parseNewLog(QString log)
83 { 85 {
157 QGraphicsItem *toFocus = 0; 159 QGraphicsItem *toFocus = 0;
158 160
159 if (!m_changesets.empty()) { 161 if (!m_changesets.empty()) {
160 Grapher g(scene); 162 Grapher g(scene);
161 try { 163 try {
162 g.layout(m_changesets, m_uncommittedParentId); 164 g.layout(m_changesets,
165 m_showUncommitted ? m_currentIds : QStringList(),
166 m_currentBranch);
163 } catch (std::string s) { 167 } catch (std::string s) {
164 std::cerr << "Internal error: Layout failed: " << s << std::endl; 168 std::cerr << "Internal error: Layout failed: " << s << std::endl;
165 } 169 }
166 toFocus = g.getUncommittedItem(); 170 toFocus = g.getUncommittedItem();
167 if (!toFocus) { 171 if (!toFocus) {
242 this, SIGNAL(revert())); 246 this, SIGNAL(revert()));
243 247
244 connect(scene, SIGNAL(diffWorkingFolder()), 248 connect(scene, SIGNAL(diffWorkingFolder()),
245 this, SIGNAL(diffWorkingFolder())); 249 this, SIGNAL(diffWorkingFolder()));
246 250
251 connect(scene, SIGNAL(showWork()),
252 this, SIGNAL(showWork()));
253
247 connect(scene, SIGNAL(updateTo(QString)), 254 connect(scene, SIGNAL(updateTo(QString)),
248 this, SIGNAL(updateTo(QString))); 255 this, SIGNAL(updateTo(QString)));
249 256
250 connect(scene, SIGNAL(diffToCurrent(QString)), 257 connect(scene, SIGNAL(diffToCurrent(QString)),
251 this, SIGNAL(diffToCurrent(QString))); 258 this, SIGNAL(diffToCurrent(QString)));