jtkorhonen@30
|
1 /****************************************************************************
|
jtkorhonen@30
|
2 ** Copyright (C) Jari Korhonen, 2010 (under lgpl)
|
jtkorhonen@30
|
3 ****************************************************************************/
|
jtkorhonen@0
|
4
|
jtkorhonen@0
|
5 #include <QtGui>
|
jtkorhonen@32
|
6 #include <QtCore>
|
jtkorhonen@32
|
7 #include <QClipboard>
|
jtkorhonen@0
|
8
|
jtkorhonen@0
|
9 #include "hgexpwidget.h"
|
jtkorhonen@0
|
10 #include "common.h"
|
jtkorhonen@0
|
11
|
jtkorhonen@0
|
12 #define REMOTE_REPO_STR "Remote repository: "
|
jtkorhonen@0
|
13 #define LOCAL_REPO_STR "Local repository: "
|
jtkorhonen@0
|
14 #define WORKFOLDER_STR "Working folder: "
|
jtkorhonen@0
|
15
|
jtkorhonen@0
|
16
|
jtkorhonen@0
|
17 const char hgStatViewOptions[NUM_STAT_FILE_TYPES] = {'m','a','r','d','u','c','i'};
|
jtkorhonen@0
|
18
|
jtkorhonen@0
|
19 const char *statFilesStr[NUM_STAT_FILE_TYPES] = { "M: Modified",
|
jtkorhonen@0
|
20 "A: To be added on next commit",
|
jtkorhonen@0
|
21 "R: To be removed on next commit",
|
jtkorhonen@0
|
22 "!: Tracked, locally deleted",
|
jtkorhonen@0
|
23 "?: Unknown, not yet tracked",
|
jtkorhonen@0
|
24 "C: Clean (not changed)",
|
jtkorhonen@0
|
25 "I: Ignored (via .hgignore file)"};
|
jtkorhonen@0
|
26
|
jtkorhonen@0
|
27
|
jtkorhonen@0
|
28 HgExpWidget::HgExpWidget(QWidget *parent, QString remoteRepo, QString workFolderPath, unsigned char viewFileTypesBits): QTabWidget(parent)
|
jtkorhonen@0
|
29 {
|
jtkorhonen@0
|
30 //Work page
|
jtkorhonen@0
|
31 //Work page
|
jtkorhonen@0
|
32 //Work page
|
jtkorhonen@0
|
33
|
jtkorhonen@0
|
34 //Remote repo
|
jtkorhonen@0
|
35 grpRemoteRepo = new QGroupBox(tr(REMOTE_REPO_STR) + remoteRepo);
|
jtkorhonen@0
|
36 grpRemoteRepo -> setMinimumHeight(24);
|
jtkorhonen@0
|
37
|
jtkorhonen@0
|
38 //Local Repo
|
jtkorhonen@0
|
39 grpLocalRepo = new QGroupBox(tr(LOCAL_REPO_STR) + workFolderPath + getHgDirName());
|
jtkorhonen@0
|
40 parentsLabel = new QLabel(tr("Working folder parent(s):"));
|
jtkorhonen@0
|
41 localRepoHgParentsList = new QListWidget;
|
jtkorhonen@0
|
42 localRepoHgParentsList -> setSelectionMode(QAbstractItemView::NoSelection);
|
jtkorhonen@0
|
43 parentsLayout = new QVBoxLayout;
|
jtkorhonen@0
|
44 parentsLayout -> addWidget(parentsLabel);
|
jtkorhonen@0
|
45 parentsLayout -> addWidget(localRepoHgParentsList);
|
jtkorhonen@0
|
46 grpLocalRepo -> setLayout(parentsLayout);
|
jtkorhonen@32
|
47 copyCommentAct = new QAction("Copy comment", localRepoHgParentsList);
|
jtkorhonen@32
|
48 userListMenu = new QMenu(localRepoHgParentsList);
|
jtkorhonen@32
|
49 userListMenu -> addAction(copyCommentAct);
|
jtkorhonen@32
|
50 connect(copyCommentAct, SIGNAL(triggered()), this, SLOT(copyComment()));
|
jtkorhonen@0
|
51
|
jtkorhonen@0
|
52 //Workfolder
|
jtkorhonen@0
|
53 grpWorkFolder = new QGroupBox(tr(WORKFOLDER_STR) + workFolderPath);
|
jtkorhonen@0
|
54 workFolderLayout = new QHBoxLayout;
|
jtkorhonen@0
|
55 workFolderFileList = new QListWidget;
|
jtkorhonen@19
|
56 workFolderFileList -> setSelectionMode(QAbstractItemView::ExtendedSelection);
|
jtkorhonen@0
|
57 grpViewFileTypes = new QGroupBox;
|
jtkorhonen@0
|
58 fileTypesLayout = new QVBoxLayout;
|
jtkorhonen@0
|
59
|
jtkorhonen@0
|
60 for(int i = 0; i < NUM_STAT_FILE_TYPES; i++)
|
jtkorhonen@0
|
61 {
|
jtkorhonen@0
|
62 chkViewFileTypes[i] = new QCheckBox(statFilesStr[i]);
|
jtkorhonen@0
|
63 if ((1U << i) & viewFileTypesBits)
|
jtkorhonen@0
|
64 {
|
jtkorhonen@0
|
65 chkViewFileTypes[i]->setChecked(true);
|
jtkorhonen@0
|
66 }
|
jtkorhonen@0
|
67 else
|
jtkorhonen@0
|
68 {
|
jtkorhonen@0
|
69 chkViewFileTypes[i]->setChecked(false);
|
jtkorhonen@0
|
70 }
|
jtkorhonen@0
|
71 connect(chkViewFileTypes[i], SIGNAL(stateChanged(int)), this, SIGNAL(workFolderViewTypesChanged()));
|
jtkorhonen@0
|
72 fileTypesLayout -> addWidget(chkViewFileTypes[i]);
|
jtkorhonen@0
|
73 }
|
jtkorhonen@0
|
74
|
jtkorhonen@0
|
75 grpViewFileTypes -> setLayout(fileTypesLayout);
|
jtkorhonen@0
|
76 workFolderLayout->addWidget(workFolderFileList, 3);
|
jtkorhonen@0
|
77 workFolderLayout->addWidget(grpViewFileTypes, 1);
|
jtkorhonen@0
|
78 grpWorkFolder -> setLayout(workFolderLayout);
|
jtkorhonen@0
|
79
|
jtkorhonen@0
|
80 workPageWidget = new QWidget;
|
jtkorhonen@0
|
81 mainLayout = new QVBoxLayout(workPageWidget);
|
jtkorhonen@0
|
82 mainLayout -> addWidget(grpRemoteRepo, 1);
|
jtkorhonen@0
|
83 mainLayout -> addWidget(grpLocalRepo, 8);
|
jtkorhonen@0
|
84 mainLayout -> addWidget(grpWorkFolder, 12);
|
jtkorhonen@0
|
85 addTab(workPageWidget, tr("Work"));
|
jtkorhonen@0
|
86
|
jtkorhonen@0
|
87 //History page
|
jtkorhonen@0
|
88 //History page
|
jtkorhonen@0
|
89 //History page
|
jtkorhonen@0
|
90 historyPageWidget = new QWidget;
|
jtkorhonen@0
|
91 localRepoHgLogList = new QListWidget;
|
jtkorhonen@0
|
92 localRepoHgLogList->setFont(QFont("Courier New"));
|
jtkorhonen@0
|
93 localRepoHgLogList -> setSelectionMode(QAbstractItemView::ExtendedSelection);
|
jtkorhonen@0
|
94
|
jtkorhonen@0
|
95 historyLayout = new QVBoxLayout(historyPageWidget);
|
jtkorhonen@0
|
96 historyLayout->addWidget(localRepoHgLogList);
|
jtkorhonen@0
|
97 addTab(historyPageWidget, tr("History (log)"));
|
jtkorhonen@0
|
98
|
jtkorhonen@0
|
99 //Heads page
|
jtkorhonen@0
|
100 //Heads page
|
jtkorhonen@0
|
101 //Heads page
|
jtkorhonen@0
|
102 headsPageWidget = new QWidget;
|
jtkorhonen@0
|
103 localRepoHeadsList = new QListWidget;
|
jtkorhonen@0
|
104 localRepoHeadsList -> setSelectionMode(QAbstractItemView::ExtendedSelection);
|
jtkorhonen@0
|
105
|
jtkorhonen@0
|
106 headsLayout = new QVBoxLayout(headsPageWidget);
|
jtkorhonen@0
|
107 headsLayout->addWidget(localRepoHeadsList);
|
jtkorhonen@0
|
108 addTab(headsPageWidget, tr("Heads"));
|
jtkorhonen@0
|
109
|
jtkorhonen@0
|
110 //Initially, only work page is active
|
jtkorhonen@0
|
111 setTabEnabled(HEADSTAB, false);
|
jtkorhonen@0
|
112 setTabEnabled(HISTORYTAB, false);
|
jtkorhonen@0
|
113 }
|
jtkorhonen@0
|
114
|
jtkorhonen@32
|
115 void HgExpWidget::contextMenuEvent(QContextMenuEvent * event)
|
jtkorhonen@32
|
116 {
|
jtkorhonen@32
|
117 if (copyCommentAct -> isEnabled())
|
jtkorhonen@32
|
118 {
|
jtkorhonen@32
|
119 QPoint topL;
|
jtkorhonen@32
|
120 QPoint bottomR;
|
jtkorhonen@32
|
121
|
jtkorhonen@32
|
122 topL = localRepoHgParentsList->
|
jtkorhonen@32
|
123 mapToGlobal(QPoint(0, 0));
|
jtkorhonen@32
|
124 bottomR = localRepoHgParentsList->
|
jtkorhonen@32
|
125 mapToGlobal(QPoint(localRepoHgParentsList -> width(), localRepoHgParentsList -> height()));
|
jtkorhonen@32
|
126
|
jtkorhonen@32
|
127 if ((event -> globalPos().x() > topL.x()) && (event -> globalPos().x() < bottomR.x()))
|
jtkorhonen@32
|
128 {
|
jtkorhonen@32
|
129 if ((event -> globalPos().y() > topL.y()) && (event -> globalPos().y() < bottomR.y()))
|
jtkorhonen@32
|
130 {
|
jtkorhonen@32
|
131 userListMenu->exec(event -> globalPos());
|
jtkorhonen@32
|
132 }
|
jtkorhonen@32
|
133 }
|
jtkorhonen@32
|
134 }
|
jtkorhonen@32
|
135 }
|
jtkorhonen@32
|
136
|
jtkorhonen@32
|
137 void HgExpWidget::copyComment()
|
jtkorhonen@32
|
138 {
|
jtkorhonen@32
|
139 if (localRepoHgParentsList -> count() >= 1)
|
jtkorhonen@32
|
140 {
|
jtkorhonen@32
|
141 QListWidgetItem *it = localRepoHgParentsList -> item(0);
|
jtkorhonen@32
|
142 QString tmp = it -> text();
|
jtkorhonen@32
|
143 int ind = tmp.indexOf("summary:");
|
jtkorhonen@32
|
144 if (ind != -1)
|
jtkorhonen@32
|
145 {
|
jtkorhonen@32
|
146 QString comment;
|
jtkorhonen@32
|
147 ind += 11; //jump over word "summary:"
|
jtkorhonen@32
|
148
|
jtkorhonen@32
|
149 comment = tmp.mid(ind);
|
jtkorhonen@32
|
150
|
jtkorhonen@32
|
151 QClipboard *clipboard = QApplication::clipboard();
|
jtkorhonen@32
|
152 clipboard->setText(comment);
|
jtkorhonen@32
|
153 }
|
jtkorhonen@32
|
154 }
|
jtkorhonen@32
|
155 }
|
jtkorhonen@32
|
156
|
jtkorhonen@32
|
157
|
jtkorhonen@0
|
158
|
jtkorhonen@0
|
159 QString HgExpWidget::getStatFlags()
|
jtkorhonen@0
|
160 {
|
jtkorhonen@0
|
161 QString ret;
|
jtkorhonen@0
|
162
|
jtkorhonen@0
|
163 for(int i = 0; i < NUM_STAT_FILE_TYPES; i++)
|
jtkorhonen@0
|
164 {
|
jtkorhonen@0
|
165 if (Qt::Checked == chkViewFileTypes[i]->checkState())
|
jtkorhonen@0
|
166 {
|
jtkorhonen@0
|
167 ret += hgStatViewOptions[i];
|
jtkorhonen@0
|
168 }
|
jtkorhonen@0
|
169 }
|
jtkorhonen@0
|
170
|
jtkorhonen@0
|
171 return ret;
|
jtkorhonen@0
|
172 }
|
jtkorhonen@0
|
173
|
jtkorhonen@0
|
174
|
jtkorhonen@0
|
175 unsigned char HgExpWidget::getFileTypesBits()
|
jtkorhonen@0
|
176 {
|
jtkorhonen@0
|
177 unsigned char ret;
|
jtkorhonen@0
|
178
|
jtkorhonen@0
|
179 ret = 0;
|
jtkorhonen@0
|
180
|
jtkorhonen@0
|
181 for(int i = 0; i < NUM_STAT_FILE_TYPES; i++)
|
jtkorhonen@0
|
182 {
|
jtkorhonen@0
|
183 if (Qt::Checked == chkViewFileTypes[i]->checkState())
|
jtkorhonen@0
|
184 {
|
jtkorhonen@0
|
185 ret |= (1U << i);
|
jtkorhonen@0
|
186 }
|
jtkorhonen@0
|
187 }
|
jtkorhonen@0
|
188
|
jtkorhonen@0
|
189 return ret;
|
jtkorhonen@0
|
190 }
|
jtkorhonen@0
|
191
|
jtkorhonen@0
|
192
|
jtkorhonen@0
|
193 void HgExpWidget::updateWorkFolderFileList(QString fileList)
|
jtkorhonen@0
|
194 {
|
jtkorhonen@0
|
195 workFolderFileList-> clear();
|
jtkorhonen@0
|
196 workFolderFileList -> addItems(fileList.split("\n"));
|
jtkorhonen@0
|
197 }
|
jtkorhonen@0
|
198
|
jtkorhonen@0
|
199 void HgExpWidget::updateLocalRepoHeadsList(QString headList)
|
jtkorhonen@0
|
200 {
|
jtkorhonen@0
|
201 localRepoHeadsList-> clear();
|
jtkorhonen@0
|
202 localRepoHeadsList -> addItems(splitChangeSets(headList));
|
jtkorhonen@0
|
203
|
jtkorhonen@0
|
204 //heads list is interesting only when we have 2 or more
|
jtkorhonen@0
|
205 if (localRepoHeadsList-> count() < 2)
|
jtkorhonen@0
|
206 {
|
jtkorhonen@0
|
207 setTabEnabled(HEADSTAB, false);
|
jtkorhonen@0
|
208 }
|
jtkorhonen@0
|
209 else
|
jtkorhonen@0
|
210 {
|
jtkorhonen@0
|
211 setTabEnabled(HEADSTAB, true);
|
jtkorhonen@0
|
212 }
|
jtkorhonen@0
|
213 }
|
jtkorhonen@0
|
214
|
jtkorhonen@0
|
215
|
jtkorhonen@0
|
216 void HgExpWidget::clearLists()
|
jtkorhonen@0
|
217 {
|
jtkorhonen@0
|
218 localRepoHeadsList-> clear();
|
jtkorhonen@0
|
219 localRepoHgParentsList-> clear();
|
jtkorhonen@0
|
220 workFolderFileList-> clear();
|
jtkorhonen@0
|
221 localRepoHgLogList -> clear();
|
jtkorhonen@0
|
222 }
|
jtkorhonen@0
|
223
|
jtkorhonen@0
|
224 void HgExpWidget::updateLocalRepoParentsList(QString parentsList)
|
jtkorhonen@0
|
225 {
|
jtkorhonen@0
|
226 localRepoHgParentsList-> clear();
|
jtkorhonen@0
|
227 localRepoHgParentsList -> addItems(splitChangeSets(parentsList));
|
jtkorhonen@0
|
228 }
|
jtkorhonen@0
|
229
|
jtkorhonen@0
|
230 void HgExpWidget::updateLocalRepoHgLogList(QString hgLogList)
|
jtkorhonen@0
|
231 {
|
jtkorhonen@0
|
232 localRepoHgLogList -> clear();
|
jtkorhonen@0
|
233 localRepoHgLogList -> addItems(splitChangeSets(hgLogList));
|
jtkorhonen@0
|
234
|
jtkorhonen@0
|
235 }
|
jtkorhonen@0
|
236
|
jtkorhonen@0
|
237
|
jtkorhonen@0
|
238 int HgExpWidget::findLineStart(int nowIndex, QString str)
|
jtkorhonen@0
|
239 {
|
jtkorhonen@0
|
240 if (nowIndex < 0)
|
jtkorhonen@0
|
241 {
|
jtkorhonen@0
|
242 return -1;
|
jtkorhonen@0
|
243 }
|
jtkorhonen@0
|
244
|
jtkorhonen@0
|
245 while(str.at(nowIndex) != '\n')
|
jtkorhonen@0
|
246 {
|
jtkorhonen@0
|
247 if (nowIndex == 0)
|
jtkorhonen@0
|
248 {
|
jtkorhonen@0
|
249 return nowIndex;
|
jtkorhonen@0
|
250 }
|
jtkorhonen@0
|
251 nowIndex--;
|
jtkorhonen@0
|
252 }
|
jtkorhonen@0
|
253 return nowIndex + 1;
|
jtkorhonen@0
|
254 }
|
jtkorhonen@0
|
255
|
jtkorhonen@0
|
256
|
jtkorhonen@0
|
257 QStringList HgExpWidget::splitChangeSets(QString chgSetsStr)
|
jtkorhonen@0
|
258 {
|
jtkorhonen@0
|
259 int currChgSet;
|
jtkorhonen@0
|
260 int currChgSetLineStart;
|
jtkorhonen@0
|
261
|
jtkorhonen@0
|
262 int prevChgSet;
|
jtkorhonen@0
|
263 QStringList tmp;
|
jtkorhonen@0
|
264
|
jtkorhonen@0
|
265 currChgSet = chgSetsStr.indexOf(CHGSET);
|
jtkorhonen@0
|
266 currChgSetLineStart = findLineStart(currChgSet, chgSetsStr);
|
jtkorhonen@0
|
267 prevChgSet = -1;
|
jtkorhonen@0
|
268 while (currChgSet != -1)
|
jtkorhonen@0
|
269 {
|
jtkorhonen@0
|
270 if (prevChgSet != -1)
|
jtkorhonen@0
|
271 {
|
jtkorhonen@0
|
272 tmp.append(chgSetsStr.mid(prevChgSet, (currChgSetLineStart - prevChgSet - 1)));
|
jtkorhonen@0
|
273 }
|
jtkorhonen@0
|
274
|
jtkorhonen@0
|
275 prevChgSet = currChgSetLineStart;
|
jtkorhonen@0
|
276
|
jtkorhonen@0
|
277 currChgSet = chgSetsStr.indexOf(CHGSET, currChgSet + 1);
|
jtkorhonen@0
|
278 currChgSetLineStart = findLineStart(currChgSet, chgSetsStr);
|
jtkorhonen@0
|
279 }
|
jtkorhonen@0
|
280
|
jtkorhonen@0
|
281 if (prevChgSet != -1)
|
jtkorhonen@0
|
282 {
|
jtkorhonen@0
|
283 //Last changeset
|
jtkorhonen@0
|
284 tmp.append(chgSetsStr.mid(prevChgSet));
|
jtkorhonen@0
|
285 }
|
jtkorhonen@0
|
286 else
|
jtkorhonen@0
|
287 {
|
jtkorhonen@0
|
288 //Only changeset (if any)
|
jtkorhonen@0
|
289 if (!chgSetsStr.isEmpty())
|
jtkorhonen@0
|
290 {
|
jtkorhonen@0
|
291 tmp.append(chgSetsStr.mid(0));
|
jtkorhonen@0
|
292 }
|
jtkorhonen@0
|
293 }
|
jtkorhonen@0
|
294
|
jtkorhonen@0
|
295 return tmp;
|
jtkorhonen@0
|
296 }
|
jtkorhonen@0
|
297
|
jtkorhonen@0
|
298 QString HgExpWidget::getCurrentFileListLine()
|
jtkorhonen@0
|
299 {
|
jtkorhonen@0
|
300 if (workFolderFileList -> currentItem() != NULL)
|
jtkorhonen@0
|
301 {
|
jtkorhonen@0
|
302 return workFolderFileList -> currentItem()->text();
|
jtkorhonen@0
|
303 }
|
jtkorhonen@0
|
304 return "";
|
jtkorhonen@0
|
305 }
|
jtkorhonen@0
|
306
|
jtkorhonen@0
|
307 void HgExpWidget::setWorkFolderAndRepoNames(QString workFolderPath, QString remoteRepoPath)
|
jtkorhonen@0
|
308 {
|
jtkorhonen@0
|
309 grpRemoteRepo -> setTitle(tr(REMOTE_REPO_STR) + remoteRepoPath);
|
jtkorhonen@0
|
310 grpLocalRepo -> setTitle(tr(LOCAL_REPO_STR) + workFolderPath + getHgDirName());
|
jtkorhonen@0
|
311 grpWorkFolder -> setTitle(tr(WORKFOLDER_STR) + workFolderPath);
|
jtkorhonen@0
|
312 }
|
jtkorhonen@0
|
313
|
jtkorhonen@0
|
314 #define MERC_SHA1_MARKER_LEN 12
|
jtkorhonen@0
|
315 QString HgExpWidget::findRev(QString itemText, QString & smallRev)
|
jtkorhonen@0
|
316 {
|
jtkorhonen@0
|
317 QString tmp(itemText);
|
jtkorhonen@0
|
318 int i;
|
jtkorhonen@0
|
319 int j;
|
jtkorhonen@0
|
320
|
jtkorhonen@0
|
321 smallRev ="0";
|
jtkorhonen@0
|
322
|
jtkorhonen@0
|
323 i = tmp.indexOf(CHGSET);
|
jtkorhonen@0
|
324 if (i != -1)
|
jtkorhonen@0
|
325 {
|
jtkorhonen@0
|
326 j = i + 10;
|
jtkorhonen@0
|
327 i = tmp.indexOf(":", j); //xx:yyyyyy after changeset:
|
jtkorhonen@0
|
328
|
jtkorhonen@0
|
329 if (i != -1)
|
jtkorhonen@0
|
330 {
|
jtkorhonen@0
|
331 smallRev = tmp.mid(j, (i-j));
|
jtkorhonen@0
|
332 return tmp.mid(i+1, MERC_SHA1_MARKER_LEN);
|
jtkorhonen@0
|
333 }
|
jtkorhonen@0
|
334 }
|
jtkorhonen@0
|
335
|
jtkorhonen@0
|
336 return "";
|
jtkorhonen@0
|
337 }
|
jtkorhonen@0
|
338
|
jtkorhonen@0
|
339 void HgExpWidget::getHistoryDiffRevisions(QString& revA, QString& revB)
|
jtkorhonen@0
|
340 {
|
jtkorhonen@0
|
341 QList <QListWidgetItem *> histList = localRepoHgLogList->selectedItems();
|
jtkorhonen@0
|
342 QList <QListWidgetItem *> headList = localRepoHeadsList->selectedItems();
|
jtkorhonen@0
|
343
|
jtkorhonen@0
|
344 QString revATmp;
|
jtkorhonen@0
|
345 QString revBTmp;
|
jtkorhonen@0
|
346 QString smallRevA;
|
jtkorhonen@0
|
347 QString smallRevB;
|
jtkorhonen@0
|
348 QString txtA;
|
jtkorhonen@0
|
349 QString txtB;
|
jtkorhonen@0
|
350
|
jtkorhonen@0
|
351 if (histList.count() == REQUIRED_CHGSET_DIFF_COUNT)
|
jtkorhonen@0
|
352 {
|
jtkorhonen@0
|
353 txtA = histList.last()->text();
|
jtkorhonen@0
|
354 txtB = histList.first()->text();
|
jtkorhonen@0
|
355
|
jtkorhonen@0
|
356 }
|
jtkorhonen@0
|
357 else if (headList.count() == REQUIRED_CHGSET_DIFF_COUNT)
|
jtkorhonen@0
|
358 {
|
jtkorhonen@0
|
359 txtA = headList.last()->text();
|
jtkorhonen@0
|
360 txtB = headList.first()->text();
|
jtkorhonen@0
|
361 }
|
jtkorhonen@0
|
362 else
|
jtkorhonen@0
|
363 {
|
jtkorhonen@0
|
364 revA = "";
|
jtkorhonen@0
|
365 revB = "";
|
jtkorhonen@0
|
366 return;
|
jtkorhonen@0
|
367 }
|
jtkorhonen@0
|
368
|
jtkorhonen@0
|
369 revATmp = findRev(txtA, smallRevA);
|
jtkorhonen@0
|
370 revBTmp = findRev(txtB, smallRevB);
|
jtkorhonen@0
|
371
|
jtkorhonen@0
|
372 //Switch order according to repo small revision number (user can select items from list in "wrong" order)
|
jtkorhonen@0
|
373 if (smallRevB.toULongLong() > smallRevA.toULongLong())
|
jtkorhonen@0
|
374 {
|
jtkorhonen@0
|
375 revA = revATmp;
|
jtkorhonen@0
|
376 revB = revBTmp;
|
jtkorhonen@0
|
377 }
|
jtkorhonen@0
|
378 else
|
jtkorhonen@0
|
379 {
|
jtkorhonen@0
|
380 revA = revBTmp;
|
jtkorhonen@0
|
381 revB = revATmp;
|
jtkorhonen@0
|
382 }
|
jtkorhonen@0
|
383 }
|
jtkorhonen@0
|
384
|
jtkorhonen@0
|
385
|
jtkorhonen@0
|
386 void HgExpWidget::getUpdateToRevRevision(QString& rev)
|
jtkorhonen@0
|
387 {
|
jtkorhonen@0
|
388 QList <QListWidgetItem *> histList = localRepoHgLogList->selectedItems();
|
jtkorhonen@0
|
389 QString txt;
|
jtkorhonen@0
|
390 QString smallRev;
|
jtkorhonen@0
|
391
|
jtkorhonen@0
|
392
|
jtkorhonen@0
|
393 if (histList.count() == 1)
|
jtkorhonen@0
|
394 {
|
jtkorhonen@0
|
395 txt = histList.first()->text();
|
jtkorhonen@0
|
396 rev = findRev(txt, smallRev);
|
jtkorhonen@0
|
397 }
|
jtkorhonen@0
|
398 else
|
jtkorhonen@0
|
399 {
|
jtkorhonen@0
|
400 rev = "";
|
jtkorhonen@0
|
401 }
|
jtkorhonen@0
|
402 }
|
jtkorhonen@0
|
403
|
jtkorhonen@0
|
404
|
jtkorhonen@32
|
405 void HgExpWidget::enableDisableOtherTabs(int tabPage)
|
jtkorhonen@32
|
406 {
|
jtkorhonen@32
|
407 static int oldTabPage = -1;
|
jtkorhonen@0
|
408
|
jtkorhonen@32
|
409 if (tabPage != oldTabPage)
|
jtkorhonen@32
|
410 {
|
jtkorhonen@32
|
411 oldTabPage = tabPage;
|
jtkorhonen@32
|
412 if (tabPage == WORKTAB)
|
jtkorhonen@32
|
413 {
|
jtkorhonen@32
|
414 copyCommentAct -> setEnabled(true);
|
jtkorhonen@32
|
415 }
|
jtkorhonen@32
|
416 else
|
jtkorhonen@32
|
417 {
|
jtkorhonen@32
|
418 copyCommentAct -> setEnabled(false);
|
jtkorhonen@32
|
419 }
|
jtkorhonen@32
|
420 }
|
jtkorhonen@32
|
421
|
jtkorhonen@0
|
422 //history list is only interesting when we have something in it ;-)
|
jtkorhonen@0
|
423 if (localRepoHgLogList -> count() < 2)
|
jtkorhonen@0
|
424 {
|
jtkorhonen@0
|
425 setTabEnabled(HISTORYTAB, false);
|
jtkorhonen@0
|
426 }
|
jtkorhonen@0
|
427 else
|
jtkorhonen@0
|
428 {
|
jtkorhonen@0
|
429 setTabEnabled(HISTORYTAB, true);
|
jtkorhonen@0
|
430 }
|
jtkorhonen@0
|
431
|
jtkorhonen@0
|
432 //history list is only interesting when we have something in it ;-)
|
jtkorhonen@0
|
433 if (localRepoHgLogList -> count() < 2)
|
jtkorhonen@0
|
434 {
|
jtkorhonen@0
|
435 setTabEnabled(HISTORYTAB, false);
|
jtkorhonen@0
|
436 }
|
jtkorhonen@0
|
437 else
|
jtkorhonen@0
|
438 {
|
jtkorhonen@0
|
439 setTabEnabled(HISTORYTAB, true);
|
jtkorhonen@0
|
440 }
|
jtkorhonen@0
|
441 }
|
jtkorhonen@0
|
442
|
jtkorhonen@0
|
443
|
jtkorhonen@0
|
444
|
jtkorhonen@0
|
445
|