comparison 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
comparison
equal deleted inserted replaced
140:bad40d7e7a2b 141:e6c6b88d19b9
70 70
71 void HistoryWidget::showUncommittedChanges(bool show) 71 void HistoryWidget::showUncommittedChanges(bool show)
72 { 72 {
73 if (m_uncommittedVisible == show) return; 73 if (m_uncommittedVisible == show) return;
74 m_uncommittedVisible = show; 74 m_uncommittedVisible = show;
75 QGraphicsScene *scene = m_panned->scene(); 75 ChangesetScene *scene = qobject_cast<ChangesetScene *>(m_panned->scene());
76 if (!scene) return; 76 if (!scene) return;
77 if (m_uncommittedVisible) { 77 if (m_uncommittedVisible) {
78 scene->addItem(m_uncommitted); 78 scene->addUncommittedItem(m_uncommitted);
79 m_uncommitted->ensureVisible();
79 } else { 80 } else {
80 scene->removeItem(m_uncommitted); 81 scene->removeItem(m_uncommitted);
81 } 82 }
82 } 83 }
83 84
172 DEBUG << "tipItem is " << tipItem << " for tip changeset " 173 DEBUG << "tipItem is " << tipItem << " for tip changeset "
173 << m_changesets[0]->id() << endl; 174 << m_changesets[0]->id() << endl;
174 } 175 }
175 176
176 if (m_uncommittedVisible) { 177 if (m_uncommittedVisible) {
177 scene->addItem(m_uncommitted); 178 scene->addUncommittedItem(m_uncommitted);
178 } 179 }
179 180
180 m_panned->setScene(scene); 181 m_panned->setScene(scene);
181 m_panner->setScene(scene); 182 m_panner->setScene(scene);
182 183
183 updateNewAndCurrentItems(); 184 updateNewAndCurrentItems();
184 185
185 if (m_uncommittedVisible) { 186 if (m_uncommittedVisible) {
187 DEBUG << "asking uncommitted item to be visible" << endl;
186 m_uncommitted->ensureVisible(); 188 m_uncommitted->ensureVisible();
187 } else if (tipItem) { 189 } else if (tipItem) {
188 DEBUG << "asking tip item to be visible" << endl; 190 DEBUG << "asking tip item to be visible" << endl;
189 tipItem->ensureVisible(); 191 tipItem->ensureVisible();
190 } 192 }
193
194 connectSceneSignals();
191 } 195 }
192 196
193 void HistoryWidget::setChangesetParents() 197 void HistoryWidget::setChangesetParents()
194 { 198 {
195 for (int i = 0; i < m_changesets.size(); ++i) { 199 for (int i = 0; i < m_changesets.size(); ++i) {
240 m_uncommitted->setWide(csit->isWide()); 244 m_uncommitted->setWide(csit->isWide());
241 m_uncommitted->setBranch(csit->getChangeset()->branch()); 245 m_uncommitted->setBranch(csit->getChangeset()->branch());
242 } 246 }
243 } 247 }
244 } 248 }
249
250 void HistoryWidget::connectSceneSignals()
251 {
252 ChangesetScene *scene = qobject_cast<ChangesetScene *>(m_panned->scene());
253 if (!scene) return;
254
255 connect(scene, SIGNAL(commit()),
256 this, SIGNAL(commit()));
257
258 connect(scene, SIGNAL(revert()),
259 this, SIGNAL(revert()));
260
261 connect(scene, SIGNAL(diffWorkingFolder()),
262 this, SIGNAL(diffWorkingFolder()));
263
264 connect(scene, SIGNAL(updateTo(QString)),
265 this, SIGNAL(updateTo(QString)));
266
267 connect(scene, SIGNAL(diffToCurrent(QString)),
268 this, SIGNAL(diffToCurrent(QString)));
269
270 connect(scene, SIGNAL(diffToPrevious(QString)),
271 this, SIGNAL(diffToPrevious(QString)));
272
273 connect(scene, SIGNAL(mergeFrom(QString)),
274 this, SIGNAL(mergeFrom(QString)));
275
276 connect(scene, SIGNAL(tag(QString)),
277 this, SIGNAL(tag(QString)));
278 }