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@244
|
8 Copyright (c) 2011 Chris Cannam
|
Chris@244
|
9 Copyright (c) 2011 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@168
|
21 #include "dateitem.h"
|
Chris@119
|
22
|
Chris@119
|
23 ChangesetScene::ChangesetScene()
|
Chris@119
|
24 : QGraphicsScene(), m_detailShown(0)
|
Chris@119
|
25 {
|
Chris@119
|
26 }
|
Chris@119
|
27
|
Chris@119
|
28 void
|
Chris@141
|
29 ChangesetScene::addChangesetItem(ChangesetItem *item)
|
Chris@141
|
30 {
|
Chris@141
|
31 addItem(item);
|
Chris@141
|
32
|
Chris@141
|
33 connect(item, SIGNAL(detailShown()),
|
Chris@141
|
34 this, SLOT(changesetDetailShown()));
|
Chris@141
|
35
|
Chris@168
|
36 connect(item, SIGNAL(detailHidden()),
|
Chris@168
|
37 this, SLOT(changesetDetailHidden()));
|
Chris@168
|
38
|
Chris@141
|
39 connect(item, SIGNAL(updateTo(QString)),
|
Chris@141
|
40 this, SIGNAL(updateTo(QString)));
|
Chris@141
|
41
|
Chris@141
|
42 connect(item, SIGNAL(diffToCurrent(QString)),
|
Chris@141
|
43 this, SIGNAL(diffToCurrent(QString)));
|
Chris@141
|
44
|
Chris@148
|
45 connect(item, SIGNAL(diffToParent(QString, QString)),
|
Chris@148
|
46 this, SIGNAL(diffToParent(QString, QString)));
|
Chris@141
|
47
|
Chris@141
|
48 connect(item, SIGNAL(mergeFrom(QString)),
|
Chris@141
|
49 this, SIGNAL(mergeFrom(QString)));
|
Chris@141
|
50
|
Chris@141
|
51 connect(item, SIGNAL(tag(QString)),
|
Chris@141
|
52 this, SIGNAL(tag(QString)));
|
Chris@141
|
53 }
|
Chris@141
|
54
|
Chris@141
|
55 void
|
Chris@141
|
56 ChangesetScene::addUncommittedItem(UncommittedItem *item)
|
Chris@141
|
57 {
|
Chris@141
|
58 addItem(item);
|
Chris@141
|
59
|
Chris@141
|
60 connect(item, SIGNAL(commit()),
|
Chris@141
|
61 this, SIGNAL(commit()));
|
Chris@141
|
62
|
Chris@141
|
63 connect(item, SIGNAL(revert()),
|
Chris@141
|
64 this, SIGNAL(revert()));
|
Chris@141
|
65
|
Chris@141
|
66 connect(item, SIGNAL(diff()),
|
Chris@141
|
67 this, SIGNAL(diffWorkingFolder()));
|
Chris@153
|
68
|
Chris@168
|
69 connect(item, SIGNAL(showSummary()),
|
Chris@168
|
70 this, SIGNAL(showSummary()));
|
Chris@168
|
71
|
Chris@153
|
72 connect(item, SIGNAL(showWork()),
|
Chris@153
|
73 this, SIGNAL(showWork()));
|
Chris@141
|
74 }
|
Chris@141
|
75
|
Chris@141
|
76 void
|
Chris@168
|
77 ChangesetScene::addDateItem(DateItem *item)
|
Chris@168
|
78 {
|
Chris@168
|
79 addItem(item);
|
Chris@168
|
80
|
Chris@168
|
81 connect(item, SIGNAL(clicked()),
|
Chris@168
|
82 this, SLOT(dateItemClicked()));
|
Chris@168
|
83 }
|
Chris@168
|
84
|
Chris@168
|
85 void
|
Chris@119
|
86 ChangesetScene::changesetDetailShown()
|
Chris@119
|
87 {
|
Chris@119
|
88 ChangesetItem *csi = qobject_cast<ChangesetItem *>(sender());
|
Chris@119
|
89 if (!csi) return;
|
Chris@119
|
90
|
Chris@124
|
91 if (m_detailShown && m_detailShown != csi) {
|
Chris@119
|
92 m_detailShown->hideDetail();
|
Chris@119
|
93 }
|
Chris@119
|
94 m_detailShown = csi;
|
Chris@119
|
95 }
|
Chris@119
|
96
|
Chris@168
|
97 void
|
Chris@168
|
98 ChangesetScene::changesetDetailHidden()
|
Chris@168
|
99 {
|
Chris@168
|
100 m_detailShown = 0;
|
Chris@168
|
101 }
|
Chris@168
|
102
|
Chris@168
|
103 void
|
Chris@168
|
104 ChangesetScene::dateItemClicked()
|
Chris@168
|
105 {
|
Chris@168
|
106 if (m_detailShown) {
|
Chris@168
|
107 m_detailShown->hideDetail();
|
Chris@168
|
108 }
|
Chris@168
|
109 }
|
Chris@168
|
110
|