Mercurial > hg > easyhg
comparison src/changesetscene.cpp @ 370:b9c153e00e84
Move source files to src/
author | Chris Cannam |
---|---|
date | Thu, 24 Mar 2011 10:27:51 +0000 |
parents | changesetscene.cpp@4811eb34e819 |
children | 61bde1f0ff0a |
comparison
equal
deleted
inserted
replaced
369:19cce6d2c470 | 370:b9c153e00e84 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 EasyMercurial | |
5 | |
6 Based on HgExplorer by Jari Korhonen | |
7 Copyright (c) 2010 Jari Korhonen | |
8 Copyright (c) 2011 Chris Cannam | |
9 Copyright (c) 2011 Queen Mary, University of London | |
10 | |
11 This program is free software; you can redistribute it and/or | |
12 modify it under the terms of the GNU General Public License as | |
13 published by the Free Software Foundation; either version 2 of the | |
14 License, or (at your option) any later version. See the file | |
15 COPYING included with this distribution for more information. | |
16 */ | |
17 | |
18 #include "changesetscene.h" | |
19 #include "changesetitem.h" | |
20 #include "uncommitteditem.h" | |
21 #include "dateitem.h" | |
22 | |
23 ChangesetScene::ChangesetScene() | |
24 : QGraphicsScene(), m_detailShown(0) | |
25 { | |
26 } | |
27 | |
28 void | |
29 ChangesetScene::addChangesetItem(ChangesetItem *item) | |
30 { | |
31 addItem(item); | |
32 | |
33 connect(item, SIGNAL(detailShown()), | |
34 this, SLOT(changesetDetailShown())); | |
35 | |
36 connect(item, SIGNAL(detailHidden()), | |
37 this, SLOT(changesetDetailHidden())); | |
38 | |
39 connect(item, SIGNAL(updateTo(QString)), | |
40 this, SIGNAL(updateTo(QString))); | |
41 | |
42 connect(item, SIGNAL(diffToCurrent(QString)), | |
43 this, SIGNAL(diffToCurrent(QString))); | |
44 | |
45 connect(item, SIGNAL(diffToParent(QString, QString)), | |
46 this, SIGNAL(diffToParent(QString, QString))); | |
47 | |
48 connect(item, SIGNAL(showSummary(Changeset *)), | |
49 this, SIGNAL(showSummary(Changeset *))); | |
50 | |
51 connect(item, SIGNAL(mergeFrom(QString)), | |
52 this, SIGNAL(mergeFrom(QString))); | |
53 | |
54 connect(item, SIGNAL(newBranch(QString)), | |
55 this, SIGNAL(newBranch(QString))); | |
56 | |
57 connect(item, SIGNAL(tag(QString)), | |
58 this, SIGNAL(tag(QString))); | |
59 } | |
60 | |
61 void | |
62 ChangesetScene::addUncommittedItem(UncommittedItem *item) | |
63 { | |
64 addItem(item); | |
65 | |
66 connect(item, SIGNAL(commit()), | |
67 this, SIGNAL(commit())); | |
68 | |
69 connect(item, SIGNAL(revert()), | |
70 this, SIGNAL(revert())); | |
71 | |
72 connect(item, SIGNAL(diff()), | |
73 this, SIGNAL(diffWorkingFolder())); | |
74 | |
75 connect(item, SIGNAL(showSummary()), | |
76 this, SIGNAL(showSummary())); | |
77 | |
78 connect(item, SIGNAL(showWork()), | |
79 this, SIGNAL(showWork())); | |
80 | |
81 connect(item, SIGNAL(newBranch()), | |
82 this, SIGNAL(newBranch())); | |
83 | |
84 connect(item, SIGNAL(noBranch()), | |
85 this, SIGNAL(noBranch())); | |
86 | |
87 } | |
88 | |
89 void | |
90 ChangesetScene::addDateItem(DateItem *item) | |
91 { | |
92 addItem(item); | |
93 | |
94 connect(item, SIGNAL(clicked()), | |
95 this, SLOT(dateItemClicked())); | |
96 } | |
97 | |
98 void | |
99 ChangesetScene::changesetDetailShown() | |
100 { | |
101 ChangesetItem *csi = qobject_cast<ChangesetItem *>(sender()); | |
102 if (!csi) return; | |
103 | |
104 if (m_detailShown && m_detailShown != csi) { | |
105 m_detailShown->hideDetail(); | |
106 } | |
107 m_detailShown = csi; | |
108 } | |
109 | |
110 void | |
111 ChangesetScene::changesetDetailHidden() | |
112 { | |
113 m_detailShown = 0; | |
114 } | |
115 | |
116 void | |
117 ChangesetScene::dateItemClicked() | |
118 { | |
119 if (m_detailShown) { | |
120 m_detailShown->hideDetail(); | |
121 } | |
122 } | |
123 | |
124 ChangesetItem * | |
125 ChangesetScene::getItemById(QString id) | |
126 { | |
127 foreach (QGraphicsItem *it, items()) { | |
128 ChangesetItem *csit = dynamic_cast<ChangesetItem *>(it); | |
129 if (csit && csit->getId() == id) return csit; | |
130 } | |
131 return 0; | |
132 } | |
133 | |
134 |