Mercurial > hg > easyhg
comparison changesetitem.cpp @ 281:9162f14c5ab7
* Change "diff to parent <id>" menu entries in changeset item right-button menu to "diff to left parent" and "diff to right parent"
author | Chris Cannam |
---|---|
date | Fri, 18 Feb 2011 13:38:31 +0000 |
parents | be483734bde5 |
children | ca6edd303c9d |
comparison
equal
deleted
inserted
replaced
277:b6e4643d6c05 | 281:9162f14c5ab7 |
---|---|
14 License, or (at your option) any later version. See the file | 14 License, or (at your option) any later version. See the file |
15 COPYING included with this distribution for more information. | 15 COPYING included with this distribution for more information. |
16 */ | 16 */ |
17 | 17 |
18 #include "changesetitem.h" | 18 #include "changesetitem.h" |
19 #include "changesetscene.h" | |
19 #include "changesetdetailitem.h" | 20 #include "changesetdetailitem.h" |
20 #include "changeset.h" | 21 #include "changeset.h" |
21 #include "textabbrev.h" | 22 #include "textabbrev.h" |
22 #include "colourset.h" | 23 #include "colourset.h" |
23 #include "debug.h" | 24 #include "debug.h" |
119 QAction *copyId = menu->addAction(tr("Copy identifier to clipboard")); | 120 QAction *copyId = menu->addAction(tr("Copy identifier to clipboard")); |
120 connect(copyId, SIGNAL(triggered()), this, SLOT(copyIdActivated())); | 121 connect(copyId, SIGNAL(triggered()), this, SLOT(copyIdActivated())); |
121 | 122 |
122 menu->addSeparator(); | 123 menu->addSeparator(); |
123 | 124 |
124 if (m_changeset->parents().size() > 1) { | 125 QStringList parents = m_changeset->parents(); |
125 | 126 |
126 foreach (QString parentId, m_changeset->parents()) { | 127 if (parents.size() > 1) { |
127 QAction *diffParent = | 128 |
128 menu->addAction(tr("Diff to parent %1") | 129 QString leftId, rightId; |
129 .arg(Changeset::hashOf(parentId))); | 130 ChangesetScene *cs = dynamic_cast<ChangesetScene *>(scene()); |
131 bool havePositions = false; | |
132 | |
133 if (cs && parents.size() == 2) { | |
134 ChangesetItem *i0 = cs->getItemById(parents[0]); | |
135 ChangesetItem *i1 = cs->getItemById(parents[1]); | |
136 if (i0 && i1) { | |
137 if (i0->x() < i1->x()) { | |
138 leftId = parents[0]; | |
139 rightId = parents[1]; | |
140 } else { | |
141 leftId = parents[1]; | |
142 rightId = parents[0]; | |
143 } | |
144 havePositions = true; | |
145 } | |
146 } | |
147 | |
148 if (havePositions) { | |
149 | |
150 QAction *diffParent = menu->addAction(tr("Diff to left parent")); | |
130 connect(diffParent, SIGNAL(triggered()), | 151 connect(diffParent, SIGNAL(triggered()), |
131 this, SLOT(diffToParentActivated())); | 152 this, SLOT(diffToParentActivated())); |
132 m_parentDiffActions[diffParent] = parentId; | 153 m_parentDiffActions[diffParent] = leftId; |
154 | |
155 diffParent = menu->addAction(tr("Diff to right parent")); | |
156 connect(diffParent, SIGNAL(triggered()), | |
157 this, SLOT(diffToParentActivated())); | |
158 m_parentDiffActions[diffParent] = rightId; | |
159 | |
160 } else { | |
161 | |
162 foreach (QString parentId, parents) { | |
163 QString text = tr("Diff to parent %1") | |
164 .arg(Changeset::hashOf(parentId)); | |
165 QAction *diffParent = menu->addAction(text); | |
166 connect(diffParent, SIGNAL(triggered()), | |
167 this, SLOT(diffToParentActivated())); | |
168 m_parentDiffActions[diffParent] = parentId; | |
169 } | |
133 } | 170 } |
134 | 171 |
135 } else { | 172 } else { |
136 | 173 |
137 QAction *diffParent = | 174 QAction *diffParent = |