Chris@119
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@119
|
2
|
Chris@119
|
3 /*
|
Chris@119
|
4 EasyMercurial
|
Chris@119
|
5
|
Chris@119
|
6 Based on HgExplorer by Jari Korhonen
|
Chris@119
|
7 Copyright (c) 2010 Jari Korhonen
|
Chris@119
|
8 Copyright (c) 2010 Chris Cannam
|
Chris@119
|
9 Copyright (c) 2010 Queen Mary, University of London
|
Chris@119
|
10
|
Chris@119
|
11 This program is free software; you can redistribute it and/or
|
Chris@119
|
12 modify it under the terms of the GNU General Public License as
|
Chris@119
|
13 published by the Free Software Foundation; either version 2 of the
|
Chris@119
|
14 License, or (at your option) any later version. See the file
|
Chris@119
|
15 COPYING included with this distribution for more information.
|
Chris@119
|
16 */
|
Chris@119
|
17
|
Chris@119
|
18 #include "changesetscene.h"
|
Chris@119
|
19 #include "changesetitem.h"
|
Chris@141
|
20 #include "uncommitteditem.h"
|
Chris@119
|
21
|
Chris@119
|
22 ChangesetScene::ChangesetScene()
|
Chris@119
|
23 : QGraphicsScene(), m_detailShown(0)
|
Chris@119
|
24 {
|
Chris@119
|
25 }
|
Chris@119
|
26
|
Chris@119
|
27 void
|
Chris@141
|
28 ChangesetScene::addChangesetItem(ChangesetItem *item)
|
Chris@141
|
29 {
|
Chris@141
|
30 addItem(item);
|
Chris@141
|
31
|
Chris@141
|
32 connect(item, SIGNAL(detailShown()),
|
Chris@141
|
33 this, SLOT(changesetDetailShown()));
|
Chris@141
|
34
|
Chris@141
|
35 connect(item, SIGNAL(updateTo(QString)),
|
Chris@141
|
36 this, SIGNAL(updateTo(QString)));
|
Chris@141
|
37
|
Chris@141
|
38 connect(item, SIGNAL(diffToCurrent(QString)),
|
Chris@141
|
39 this, SIGNAL(diffToCurrent(QString)));
|
Chris@141
|
40
|
Chris@148
|
41 connect(item, SIGNAL(diffToParent(QString, QString)),
|
Chris@148
|
42 this, SIGNAL(diffToParent(QString, QString)));
|
Chris@141
|
43
|
Chris@141
|
44 connect(item, SIGNAL(mergeFrom(QString)),
|
Chris@141
|
45 this, SIGNAL(mergeFrom(QString)));
|
Chris@141
|
46
|
Chris@141
|
47 connect(item, SIGNAL(tag(QString)),
|
Chris@141
|
48 this, SIGNAL(tag(QString)));
|
Chris@141
|
49 }
|
Chris@141
|
50
|
Chris@141
|
51 void
|
Chris@141
|
52 ChangesetScene::addUncommittedItem(UncommittedItem *item)
|
Chris@141
|
53 {
|
Chris@141
|
54 addItem(item);
|
Chris@141
|
55
|
Chris@141
|
56 connect(item, SIGNAL(commit()),
|
Chris@141
|
57 this, SIGNAL(commit()));
|
Chris@141
|
58
|
Chris@141
|
59 connect(item, SIGNAL(revert()),
|
Chris@141
|
60 this, SIGNAL(revert()));
|
Chris@141
|
61
|
Chris@141
|
62 connect(item, SIGNAL(diff()),
|
Chris@141
|
63 this, SIGNAL(diffWorkingFolder()));
|
Chris@141
|
64 }
|
Chris@141
|
65
|
Chris@141
|
66 void
|
Chris@119
|
67 ChangesetScene::changesetDetailShown()
|
Chris@119
|
68 {
|
Chris@119
|
69 ChangesetItem *csi = qobject_cast<ChangesetItem *>(sender());
|
Chris@119
|
70 if (!csi) return;
|
Chris@119
|
71
|
Chris@124
|
72 if (m_detailShown && m_detailShown != csi) {
|
Chris@119
|
73 m_detailShown->hideDetail();
|
Chris@119
|
74 }
|
Chris@119
|
75 m_detailShown = csi;
|
Chris@119
|
76 }
|
Chris@119
|
77
|