jtkorhonen@0
|
1 /****************************************************************************
|
jtkorhonen@0
|
2 **
|
jtkorhonen@0
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
jtkorhonen@0
|
4 ** All rights reserved.
|
jtkorhonen@0
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
|
jtkorhonen@0
|
6 **
|
jtkorhonen@0
|
7 ** This file is part of the examples of the Qt Toolkit.
|
jtkorhonen@0
|
8 **
|
jtkorhonen@0
|
9 ** $QT_BEGIN_LICENSE:LGPL$
|
jtkorhonen@0
|
10 ** Commercial Usage
|
jtkorhonen@0
|
11 ** Licensees holding valid Qt Commercial licenses may use this file in
|
jtkorhonen@0
|
12 ** accordance with the Qt Commercial License Agreement provided with the
|
jtkorhonen@0
|
13 ** Software or, alternatively, in accordance with the terms contained in
|
jtkorhonen@0
|
14 ** a written agreement between you and Nokia.
|
jtkorhonen@0
|
15 **
|
jtkorhonen@0
|
16 ** GNU Lesser General Public License Usage
|
jtkorhonen@0
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
|
jtkorhonen@0
|
18 ** General Public License version 2.1 as published by the Free Software
|
jtkorhonen@0
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
|
jtkorhonen@0
|
20 ** packaging of this file. Please review the following information to
|
jtkorhonen@0
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
|
jtkorhonen@0
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
jtkorhonen@0
|
23 **
|
jtkorhonen@0
|
24 ** In addition, as a special exception, Nokia gives you certain additional
|
jtkorhonen@0
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
|
jtkorhonen@0
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
jtkorhonen@0
|
27 **
|
jtkorhonen@0
|
28 ** GNU General Public License Usage
|
jtkorhonen@0
|
29 ** Alternatively, this file may be used under the terms of the GNU
|
jtkorhonen@0
|
30 ** General Public License version 3.0 as published by the Free Software
|
jtkorhonen@0
|
31 ** Foundation and appearing in the file LICENSE.GPL included in the
|
jtkorhonen@0
|
32 ** packaging of this file. Please review the following information to
|
jtkorhonen@0
|
33 ** ensure the GNU General Public License version 3.0 requirements will be
|
jtkorhonen@0
|
34 ** met: http://www.gnu.org/copyleft/gpl.html.
|
jtkorhonen@0
|
35 **
|
jtkorhonen@0
|
36 ** If you have questions regarding the use of this file, please contact
|
jtkorhonen@0
|
37 ** Nokia at qt-info@nokia.com.
|
jtkorhonen@0
|
38 ** $QT_END_LICENSE$
|
jtkorhonen@0
|
39 **
|
jtkorhonen@0
|
40 ** Copyright (C) Jari Korhonen, 2010 (HgExplorer specific parts, under lgpl)
|
jtkorhonen@0
|
41 *************************************************************************************/
|
jtkorhonen@0
|
42
|
jtkorhonen@0
|
43 #include <QtGui>
|
jtkorhonen@0
|
44 #include <QStringList>
|
jtkorhonen@0
|
45 #include <QDir>
|
jtkorhonen@0
|
46
|
jtkorhonen@0
|
47 #include "mainwindow.h"
|
jtkorhonen@0
|
48 #include "settingsdialog.h"
|
jtkorhonen@0
|
49
|
jtkorhonen@0
|
50
|
jtkorhonen@0
|
51 MainWindow::MainWindow()
|
jtkorhonen@0
|
52 {
|
jtkorhonen@0
|
53 QString wndTitle;
|
jtkorhonen@0
|
54
|
jtkorhonen@0
|
55 createActions();
|
jtkorhonen@0
|
56 createMenus();
|
jtkorhonen@0
|
57 createToolBars();
|
jtkorhonen@0
|
58 createStatusBar();
|
jtkorhonen@0
|
59
|
jtkorhonen@0
|
60 timerId = startTimer(200);
|
jtkorhonen@0
|
61 runner = new HgRunner(this);
|
jtkorhonen@0
|
62 runningAction = ACT_NONE;
|
jtkorhonen@0
|
63 statusBar()->addPermanentWidget(runner);
|
jtkorhonen@0
|
64
|
jtkorhonen@0
|
65 wndTitle.sprintf("%s %s", APPNAME, APPVERSION);
|
jtkorhonen@0
|
66 setWindowTitle(wndTitle);
|
jtkorhonen@0
|
67
|
jtkorhonen@0
|
68 remoteRepoPath = "";
|
jtkorhonen@0
|
69 workFolderPath = "";
|
jtkorhonen@0
|
70
|
jtkorhonen@0
|
71 readSettings();
|
jtkorhonen@0
|
72
|
jtkorhonen@0
|
73 tabPage = 0;
|
jtkorhonen@0
|
74 hgExp = new HgExpWidget((QWidget *) this, remoteRepoPath, workFolderPath, initialFileTypesBits);
|
jtkorhonen@0
|
75 setCentralWidget(hgExp);
|
jtkorhonen@0
|
76
|
jtkorhonen@0
|
77 setUnifiedTitleAndToolBarOnMac(true);
|
jtkorhonen@0
|
78 connectActions();
|
jtkorhonen@0
|
79 enableDisableActions();
|
jtkorhonen@0
|
80
|
jtkorhonen@0
|
81 if (firstStart)
|
jtkorhonen@0
|
82 {
|
jtkorhonen@0
|
83 QMessageBox::information(this, tr("First start todo"), tr("Going to \"Settings\" first."));
|
jtkorhonen@0
|
84 settings();
|
jtkorhonen@0
|
85 }
|
jtkorhonen@0
|
86
|
jtkorhonen@0
|
87 hgStat();
|
jtkorhonen@0
|
88 }
|
jtkorhonen@0
|
89
|
jtkorhonen@0
|
90
|
jtkorhonen@0
|
91 void MainWindow::closeEvent(QCloseEvent *)
|
jtkorhonen@0
|
92 {
|
jtkorhonen@0
|
93 writeSettings();
|
jtkorhonen@0
|
94 }
|
jtkorhonen@0
|
95
|
jtkorhonen@0
|
96
|
jtkorhonen@0
|
97 void MainWindow::about()
|
jtkorhonen@0
|
98 {
|
jtkorhonen@0
|
99 QMessageBox::about(this, tr("About HgExplorer"),
|
jtkorhonen@0
|
100 tr("<b>HgExplorer</b> tries to be Mercurial's <b>VSS Explorer:</b> ;-)<br><br>"
|
jtkorhonen@0
|
101 "-Hides command line in normal use<br>"
|
jtkorhonen@0
|
102 "-Makes common operations easier<br><br>"
|
jtkorhonen@0
|
103 "(c) 2010 (lgpl), Jari Korhonen (jtkorhonen@gmail.com)<br><br>"
|
jtkorhonen@0
|
104 "-Needs Mercurial ;-) (thanks Matt Mackall, Bryan O'Sullivan and others !)<br>"
|
jtkorhonen@0
|
105 "-Uses excellent Nuvola icons (c) David Vignoni (Thanks, David !)<br>"
|
jtkorhonen@0
|
106 "-Needs Qt4, mingw (in windows), python, kdiff3 (Thanks to all of you !)<br>"));
|
jtkorhonen@0
|
107 }
|
jtkorhonen@0
|
108
|
jtkorhonen@0
|
109
|
jtkorhonen@0
|
110 void MainWindow::hgStat()
|
jtkorhonen@0
|
111 {
|
jtkorhonen@0
|
112 if (hgStatAct -> isEnabled())
|
jtkorhonen@0
|
113 {
|
jtkorhonen@0
|
114 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
115 {
|
jtkorhonen@0
|
116 QStringList params;
|
jtkorhonen@0
|
117
|
jtkorhonen@0
|
118 QString statFlags = hgExp -> getStatFlags();
|
jtkorhonen@0
|
119 if (statFlags.isEmpty())
|
jtkorhonen@0
|
120 {
|
jtkorhonen@0
|
121 params << "stat";
|
jtkorhonen@0
|
122 }
|
jtkorhonen@0
|
123 else
|
jtkorhonen@0
|
124 {
|
jtkorhonen@0
|
125 params << "stat" << "-" + statFlags;
|
jtkorhonen@0
|
126 }
|
jtkorhonen@0
|
127
|
jtkorhonen@0
|
128
|
jtkorhonen@0
|
129 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
130 runningAction = ACT_STAT;
|
jtkorhonen@0
|
131 }
|
jtkorhonen@0
|
132 }
|
jtkorhonen@0
|
133 }
|
jtkorhonen@0
|
134
|
jtkorhonen@0
|
135 void MainWindow::hgHeads()
|
jtkorhonen@0
|
136 {
|
jtkorhonen@0
|
137 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
138 {
|
jtkorhonen@0
|
139 QStringList params;
|
jtkorhonen@0
|
140 params << "heads";
|
jtkorhonen@0
|
141
|
jtkorhonen@0
|
142 //on empty repos, "hg heads" will fail, don't care of that.
|
jtkorhonen@0
|
143 runner -> startProc(getHgBinaryName(), workFolderPath, params, false);
|
jtkorhonen@0
|
144 runningAction = ACT_HEADS;
|
jtkorhonen@0
|
145 }
|
jtkorhonen@0
|
146 }
|
jtkorhonen@0
|
147
|
jtkorhonen@0
|
148 void MainWindow::hgLog()
|
jtkorhonen@0
|
149 {
|
jtkorhonen@0
|
150 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
151 {
|
jtkorhonen@0
|
152 QStringList params;
|
jtkorhonen@0
|
153 params << "glog" << "--verbose";
|
jtkorhonen@0
|
154
|
jtkorhonen@0
|
155 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
156 runningAction = ACT_LOG;
|
jtkorhonen@0
|
157 }
|
jtkorhonen@0
|
158 }
|
jtkorhonen@0
|
159
|
jtkorhonen@0
|
160
|
jtkorhonen@0
|
161 void MainWindow::hgParents()
|
jtkorhonen@0
|
162 {
|
jtkorhonen@0
|
163 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
164 {
|
jtkorhonen@0
|
165 QStringList params;
|
jtkorhonen@0
|
166 params << "parents";
|
jtkorhonen@0
|
167
|
jtkorhonen@0
|
168 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
169 runningAction = ACT_PARENTS;
|
jtkorhonen@0
|
170 }
|
jtkorhonen@0
|
171 }
|
jtkorhonen@0
|
172
|
jtkorhonen@0
|
173
|
jtkorhonen@0
|
174
|
jtkorhonen@0
|
175 void MainWindow::hgRemove()
|
jtkorhonen@0
|
176 {
|
jtkorhonen@0
|
177 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
178 {
|
jtkorhonen@0
|
179 QStringList params;
|
jtkorhonen@0
|
180 QString currentFile = hgExp -> getCurrentFileListLine();
|
jtkorhonen@0
|
181
|
jtkorhonen@0
|
182 if (!currentFile.isEmpty())
|
jtkorhonen@0
|
183 {
|
jtkorhonen@0
|
184 params << "remove" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
|
jtkorhonen@0
|
185
|
jtkorhonen@0
|
186 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
187 runningAction = ACT_REMOVE;
|
jtkorhonen@0
|
188 }
|
jtkorhonen@0
|
189 }
|
jtkorhonen@0
|
190 }
|
jtkorhonen@0
|
191
|
jtkorhonen@0
|
192 void MainWindow::hgAnnotate()
|
jtkorhonen@0
|
193 {
|
jtkorhonen@0
|
194 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
195 {
|
jtkorhonen@0
|
196 QStringList params;
|
jtkorhonen@0
|
197 QString currentFile = hgExp -> getCurrentFileListLine();
|
jtkorhonen@0
|
198
|
jtkorhonen@0
|
199 if (!currentFile.isEmpty())
|
jtkorhonen@0
|
200 {
|
jtkorhonen@0
|
201 params << "annotate" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
|
jtkorhonen@0
|
202
|
jtkorhonen@0
|
203 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
204 runningAction = ACT_ANNOTATE;
|
jtkorhonen@0
|
205 }
|
jtkorhonen@0
|
206 }
|
jtkorhonen@0
|
207 }
|
jtkorhonen@0
|
208
|
jtkorhonen@0
|
209
|
jtkorhonen@0
|
210 void MainWindow::hgResolveMark()
|
jtkorhonen@0
|
211 {
|
jtkorhonen@0
|
212 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
213 {
|
jtkorhonen@0
|
214 QStringList params;
|
jtkorhonen@0
|
215 QString currentFile = hgExp -> getCurrentFileListLine();
|
jtkorhonen@0
|
216
|
jtkorhonen@0
|
217 if (!currentFile.isEmpty())
|
jtkorhonen@0
|
218 {
|
jtkorhonen@0
|
219 params << "resolve" << "--mark" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
|
jtkorhonen@0
|
220
|
jtkorhonen@0
|
221 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
222 runningAction = ACT_RESOLVE_MARK;
|
jtkorhonen@0
|
223 }
|
jtkorhonen@0
|
224 }
|
jtkorhonen@0
|
225 }
|
jtkorhonen@0
|
226
|
jtkorhonen@0
|
227
|
jtkorhonen@0
|
228
|
jtkorhonen@0
|
229 void MainWindow::hgResolveList()
|
jtkorhonen@0
|
230 {
|
jtkorhonen@0
|
231 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
232 {
|
jtkorhonen@0
|
233 QStringList params;
|
jtkorhonen@0
|
234
|
jtkorhonen@0
|
235 params << "resolve" << "--list";
|
jtkorhonen@0
|
236 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
237 runningAction = ACT_RESOLVE_LIST;
|
jtkorhonen@0
|
238 }
|
jtkorhonen@0
|
239 }
|
jtkorhonen@0
|
240
|
jtkorhonen@0
|
241
|
jtkorhonen@0
|
242
|
jtkorhonen@0
|
243 void MainWindow::hgAdd()
|
jtkorhonen@0
|
244 {
|
jtkorhonen@0
|
245 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
246 {
|
jtkorhonen@0
|
247 QStringList params;
|
jtkorhonen@0
|
248
|
jtkorhonen@0
|
249 params << "add";
|
jtkorhonen@0
|
250
|
jtkorhonen@0
|
251 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
252 runningAction = ACT_ADD;
|
jtkorhonen@0
|
253 }
|
jtkorhonen@0
|
254 }
|
jtkorhonen@0
|
255
|
jtkorhonen@0
|
256 int MainWindow::getCommitComment(QString& comment)
|
jtkorhonen@0
|
257 {
|
jtkorhonen@0
|
258 int ret;
|
jtkorhonen@0
|
259
|
jtkorhonen@0
|
260 QDialog dlg(this);
|
jtkorhonen@0
|
261
|
jtkorhonen@0
|
262 QLabel *commentLabel = new QLabel(tr("Comment:"));
|
jtkorhonen@0
|
263 QLineEdit *commentEdit = new QLineEdit;
|
jtkorhonen@0
|
264 commentEdit -> setFixedWidth(400);
|
jtkorhonen@0
|
265 QHBoxLayout *commentLayout = new QHBoxLayout;
|
jtkorhonen@0
|
266 commentLayout -> addWidget(commentLabel);
|
jtkorhonen@0
|
267 commentLayout -> addWidget(commentEdit);
|
jtkorhonen@0
|
268
|
jtkorhonen@0
|
269 QPushButton *btnOk = new QPushButton(tr("Ok"));
|
jtkorhonen@0
|
270 QPushButton *btnCancel = new QPushButton(tr("Cancel"));
|
jtkorhonen@0
|
271 QHBoxLayout *btnLayout = new QHBoxLayout;
|
jtkorhonen@0
|
272 btnLayout -> addWidget(btnOk);
|
jtkorhonen@0
|
273 btnLayout -> addWidget(btnCancel);
|
jtkorhonen@0
|
274
|
jtkorhonen@0
|
275 QVBoxLayout *mainLayout = new QVBoxLayout;
|
jtkorhonen@0
|
276 mainLayout -> addLayout(commentLayout);
|
jtkorhonen@0
|
277 mainLayout -> addLayout(btnLayout);
|
jtkorhonen@0
|
278
|
jtkorhonen@0
|
279 dlg.setLayout(mainLayout);
|
jtkorhonen@0
|
280
|
jtkorhonen@0
|
281 dlg.setWindowTitle(tr("Save (commit)"));
|
jtkorhonen@0
|
282
|
jtkorhonen@0
|
283 connect(btnOk, SIGNAL(clicked()), &dlg, SLOT(accept()));
|
jtkorhonen@0
|
284 connect(btnCancel, SIGNAL(clicked()), &dlg, SLOT(reject()));
|
jtkorhonen@0
|
285
|
jtkorhonen@0
|
286 ret = dlg.exec();
|
jtkorhonen@0
|
287 comment = commentEdit -> text();
|
jtkorhonen@0
|
288 return ret;
|
jtkorhonen@0
|
289 }
|
jtkorhonen@0
|
290
|
jtkorhonen@0
|
291 void MainWindow::hgCommit()
|
jtkorhonen@0
|
292 {
|
jtkorhonen@0
|
293 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
294 {
|
jtkorhonen@0
|
295 QStringList params;
|
jtkorhonen@0
|
296 QString comment;
|
jtkorhonen@0
|
297
|
jtkorhonen@0
|
298 if (QDialog::Accepted == getCommitComment(comment))
|
jtkorhonen@0
|
299 {
|
jtkorhonen@0
|
300 if (!comment.isEmpty())
|
jtkorhonen@0
|
301 {
|
jtkorhonen@0
|
302 params << "commit" << "--message" << comment << "--user" << userInfo;
|
jtkorhonen@0
|
303
|
jtkorhonen@0
|
304 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
305 runningAction = ACT_COMMIT;
|
jtkorhonen@0
|
306 }
|
jtkorhonen@0
|
307 }
|
jtkorhonen@0
|
308 }
|
jtkorhonen@0
|
309 }
|
jtkorhonen@0
|
310
|
jtkorhonen@0
|
311 void MainWindow::hgFileDiff()
|
jtkorhonen@0
|
312 {
|
jtkorhonen@0
|
313 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
314 {
|
jtkorhonen@0
|
315 QStringList params;
|
jtkorhonen@0
|
316
|
jtkorhonen@0
|
317 QString currentFile = hgExp -> getCurrentFileListLine();
|
jtkorhonen@0
|
318
|
jtkorhonen@0
|
319 if (!currentFile.isEmpty())
|
jtkorhonen@0
|
320 {
|
jtkorhonen@0
|
321 //Diff parent file against working folder file
|
jtkorhonen@0
|
322 params << "kdiff3" << currentFile.mid(2);
|
jtkorhonen@0
|
323 runner -> startProc(getHgBinaryName(), workFolderPath, params, false);
|
jtkorhonen@0
|
324 runningAction = ACT_FILEDIFF;
|
jtkorhonen@0
|
325 }
|
jtkorhonen@0
|
326 }
|
jtkorhonen@0
|
327 }
|
jtkorhonen@0
|
328
|
jtkorhonen@0
|
329
|
jtkorhonen@0
|
330 void MainWindow::hgFolderDiff()
|
jtkorhonen@0
|
331 {
|
jtkorhonen@0
|
332 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
333 {
|
jtkorhonen@0
|
334 QStringList params;
|
jtkorhonen@0
|
335
|
jtkorhonen@0
|
336 //Diff parent against working folder (folder diff)
|
jtkorhonen@0
|
337 params << "kdiff3";
|
jtkorhonen@0
|
338 runner -> startProc(getHgBinaryName(), workFolderPath, params, false);
|
jtkorhonen@0
|
339 runningAction = ACT_FOLDERDIFF;
|
jtkorhonen@0
|
340 }
|
jtkorhonen@0
|
341 }
|
jtkorhonen@0
|
342
|
jtkorhonen@0
|
343
|
jtkorhonen@0
|
344 void MainWindow::hgChgSetDiff()
|
jtkorhonen@0
|
345 {
|
jtkorhonen@0
|
346 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
347 {
|
jtkorhonen@0
|
348 QStringList params;
|
jtkorhonen@0
|
349
|
jtkorhonen@0
|
350 //Diff 2 history log versions against each other
|
jtkorhonen@0
|
351 QString revA;
|
jtkorhonen@0
|
352 QString revB;
|
jtkorhonen@0
|
353
|
jtkorhonen@0
|
354 hgExp -> getHistoryDiffRevisions(revA, revB);
|
jtkorhonen@0
|
355
|
jtkorhonen@0
|
356 if ((!revA.isEmpty()) && (!revB.isEmpty()))
|
jtkorhonen@0
|
357 {
|
jtkorhonen@0
|
358 params << "kdiff3" << "--rev" << revA << "--rev" << revB;
|
jtkorhonen@0
|
359 runner -> startProc(getHgBinaryName(), workFolderPath, params, false);
|
jtkorhonen@0
|
360 runningAction = ACT_CHGSETDIFF;
|
jtkorhonen@0
|
361 }
|
jtkorhonen@0
|
362 else
|
jtkorhonen@0
|
363 {
|
jtkorhonen@0
|
364 QMessageBox::information(this, tr("Changeset diff"), tr("Please select two changesets from history list or heads list first."));
|
jtkorhonen@0
|
365 }
|
jtkorhonen@0
|
366 }
|
jtkorhonen@0
|
367 }
|
jtkorhonen@0
|
368
|
jtkorhonen@0
|
369
|
jtkorhonen@0
|
370
|
jtkorhonen@0
|
371 void MainWindow::hgUpdate()
|
jtkorhonen@0
|
372 {
|
jtkorhonen@0
|
373 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
374 {
|
jtkorhonen@0
|
375 QStringList params;
|
jtkorhonen@0
|
376
|
jtkorhonen@0
|
377
|
jtkorhonen@0
|
378 params << "update";
|
jtkorhonen@0
|
379
|
jtkorhonen@0
|
380
|
jtkorhonen@0
|
381 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
382 runningAction = ACT_UPDATE;
|
jtkorhonen@0
|
383 }
|
jtkorhonen@0
|
384 }
|
jtkorhonen@0
|
385
|
jtkorhonen@0
|
386
|
jtkorhonen@0
|
387 void MainWindow::hgUpdateToRev()
|
jtkorhonen@0
|
388 {
|
jtkorhonen@0
|
389 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
390 {
|
jtkorhonen@0
|
391 QStringList params;
|
jtkorhonen@0
|
392 QString rev;
|
jtkorhonen@0
|
393
|
jtkorhonen@0
|
394 hgExp -> getUpdateToRevRevision(rev);
|
jtkorhonen@0
|
395
|
jtkorhonen@0
|
396 hgExp -> setCurrentIndex(WORKTAB);
|
jtkorhonen@0
|
397 enableDisableActions();
|
jtkorhonen@0
|
398
|
jtkorhonen@0
|
399 params << "update" << "--rev" << rev << "--clean";
|
jtkorhonen@0
|
400
|
jtkorhonen@0
|
401 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
402
|
jtkorhonen@0
|
403 runningAction = ACT_UPDATE;
|
jtkorhonen@0
|
404 }
|
jtkorhonen@0
|
405 }
|
jtkorhonen@0
|
406
|
jtkorhonen@0
|
407
|
jtkorhonen@0
|
408 void MainWindow::hgRevert()
|
jtkorhonen@0
|
409 {
|
jtkorhonen@0
|
410 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
411 {
|
jtkorhonen@0
|
412 QStringList params;
|
jtkorhonen@0
|
413 QString currentFile = hgExp -> getCurrentFileListLine();
|
jtkorhonen@0
|
414
|
jtkorhonen@0
|
415 params << "revert" << currentFile.mid(2);
|
jtkorhonen@0
|
416
|
jtkorhonen@0
|
417 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
418 runningAction = ACT_REVERT;
|
jtkorhonen@0
|
419 }
|
jtkorhonen@0
|
420 }
|
jtkorhonen@0
|
421
|
jtkorhonen@0
|
422 void MainWindow::hgMerge()
|
jtkorhonen@0
|
423 {
|
jtkorhonen@0
|
424 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
425 {
|
jtkorhonen@0
|
426 QStringList params;
|
jtkorhonen@0
|
427
|
jtkorhonen@0
|
428 params << "merge";
|
jtkorhonen@0
|
429
|
jtkorhonen@0
|
430 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
431 runningAction = ACT_MERGE;
|
jtkorhonen@0
|
432 }
|
jtkorhonen@0
|
433 }
|
jtkorhonen@0
|
434
|
jtkorhonen@0
|
435
|
jtkorhonen@0
|
436 void MainWindow::hgCloneFromRemote()
|
jtkorhonen@0
|
437 {
|
jtkorhonen@0
|
438 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
439 {
|
jtkorhonen@0
|
440 QStringList params;
|
jtkorhonen@0
|
441
|
jtkorhonen@0
|
442 params << "clone" << remoteRepoPath << workFolderPath;
|
jtkorhonen@0
|
443
|
jtkorhonen@0
|
444 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
445 runningAction = ACT_CLONEFROMREMOTE;
|
jtkorhonen@0
|
446 }
|
jtkorhonen@0
|
447 }
|
jtkorhonen@0
|
448
|
jtkorhonen@0
|
449
|
jtkorhonen@0
|
450 void MainWindow::hgInit()
|
jtkorhonen@0
|
451 {
|
jtkorhonen@0
|
452 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
453 {
|
jtkorhonen@0
|
454 QStringList params;
|
jtkorhonen@0
|
455
|
jtkorhonen@0
|
456 params << "init";
|
jtkorhonen@0
|
457
|
jtkorhonen@0
|
458 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
459 runningAction = ACT_INIT;
|
jtkorhonen@0
|
460 }
|
jtkorhonen@0
|
461 }
|
jtkorhonen@0
|
462
|
jtkorhonen@0
|
463
|
jtkorhonen@0
|
464 void MainWindow::hgIncoming()
|
jtkorhonen@0
|
465 {
|
jtkorhonen@0
|
466 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
467 {
|
jtkorhonen@0
|
468 QStringList params;
|
jtkorhonen@0
|
469
|
jtkorhonen@0
|
470 params << "incoming" << "--newest-first" << remoteRepoPath;
|
jtkorhonen@0
|
471
|
jtkorhonen@0
|
472 runner -> startProc(getHgBinaryName(), workFolderPath, params, false);
|
jtkorhonen@0
|
473 runningAction = ACT_INCOMING;
|
jtkorhonen@0
|
474 }
|
jtkorhonen@0
|
475 }
|
jtkorhonen@0
|
476
|
jtkorhonen@0
|
477
|
jtkorhonen@0
|
478 void MainWindow::hgPull()
|
jtkorhonen@0
|
479 {
|
jtkorhonen@0
|
480 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
481 {
|
jtkorhonen@0
|
482 QStringList params;
|
jtkorhonen@0
|
483
|
jtkorhonen@0
|
484 params << "pull" << remoteRepoPath;
|
jtkorhonen@0
|
485
|
jtkorhonen@0
|
486 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
487 runningAction = ACT_PULL;
|
jtkorhonen@0
|
488 }
|
jtkorhonen@0
|
489 }
|
jtkorhonen@0
|
490
|
jtkorhonen@0
|
491
|
jtkorhonen@0
|
492 void MainWindow::hgPush()
|
jtkorhonen@0
|
493 {
|
jtkorhonen@0
|
494 if (runningAction == ACT_NONE)
|
jtkorhonen@0
|
495 {
|
jtkorhonen@0
|
496 QStringList params;
|
jtkorhonen@0
|
497
|
jtkorhonen@0
|
498 params << "push" << remoteRepoPath;
|
jtkorhonen@0
|
499
|
jtkorhonen@0
|
500 runner -> startProc(getHgBinaryName(), workFolderPath, params);
|
jtkorhonen@0
|
501 runningAction = ACT_PUSH;
|
jtkorhonen@0
|
502 }
|
jtkorhonen@0
|
503 }
|
jtkorhonen@0
|
504
|
jtkorhonen@0
|
505
|
jtkorhonen@0
|
506 void MainWindow::settings()
|
jtkorhonen@0
|
507 {
|
jtkorhonen@0
|
508 SettingsDialog *settingsDlg = new SettingsDialog(this);
|
jtkorhonen@0
|
509 settingsDlg->setModal(true);
|
jtkorhonen@0
|
510 settingsDlg->exec();
|
jtkorhonen@0
|
511 hgExp -> clearLists();
|
jtkorhonen@0
|
512 enableDisableActions();
|
jtkorhonen@0
|
513 hgStat();
|
jtkorhonen@0
|
514 }
|
jtkorhonen@0
|
515
|
jtkorhonen@2
|
516 #define STDOUT_NEEDS_BIG_WINDOW 512
|
jtkorhonen@2
|
517 #define SMALL_WND_W 500
|
jtkorhonen@2
|
518 #define SMALL_WND_H 300
|
jtkorhonen@2
|
519
|
jtkorhonen@2
|
520 #define BIG_WND_W 1024
|
jtkorhonen@2
|
521 #define BIG_WND_H 768
|
jtkorhonen@2
|
522
|
jtkorhonen@2
|
523
|
jtkorhonen@2
|
524 void MainWindow::presentLongStdoutToUser(QString stdo)
|
jtkorhonen@0
|
525 {
|
jtkorhonen@2
|
526 if (!stdo.isEmpty())
|
jtkorhonen@2
|
527 {
|
jtkorhonen@2
|
528 QDialog dlg;
|
jtkorhonen@0
|
529
|
jtkorhonen@2
|
530 if (stdo.length() > STDOUT_NEEDS_BIG_WINDOW)
|
jtkorhonen@2
|
531 {
|
jtkorhonen@2
|
532 dlg.setMinimumWidth(BIG_WND_W);
|
jtkorhonen@2
|
533 dlg.setMinimumHeight(BIG_WND_H);
|
jtkorhonen@2
|
534 }
|
jtkorhonen@2
|
535 else
|
jtkorhonen@2
|
536 {
|
jtkorhonen@2
|
537 dlg.setMinimumWidth(SMALL_WND_W);
|
jtkorhonen@2
|
538 dlg.setMinimumHeight(SMALL_WND_H);
|
jtkorhonen@2
|
539 }
|
jtkorhonen@0
|
540
|
jtkorhonen@2
|
541 QVBoxLayout *box = new QVBoxLayout;
|
jtkorhonen@2
|
542 QListWidget *list = new QListWidget;
|
jtkorhonen@2
|
543 list-> addItems(stdo.split("\n"));
|
jtkorhonen@2
|
544 QPushButton *btn = new QPushButton(tr("Ok"));
|
jtkorhonen@2
|
545 connect(btn, SIGNAL(clicked()), &dlg, SLOT(accept()));
|
jtkorhonen@0
|
546
|
jtkorhonen@2
|
547 box -> addWidget(list);
|
jtkorhonen@2
|
548 box -> addWidget(btn);
|
jtkorhonen@2
|
549 dlg.setLayout(box);
|
jtkorhonen@2
|
550
|
jtkorhonen@2
|
551 dlg.exec();
|
jtkorhonen@2
|
552 }
|
jtkorhonen@2
|
553 else
|
jtkorhonen@2
|
554 {
|
jtkorhonen@2
|
555 QMessageBox::information(this, tr("HgExplorer"), tr("Mercurial command did not return any output."));
|
jtkorhonen@2
|
556 }
|
jtkorhonen@0
|
557 }
|
jtkorhonen@0
|
558
|
jtkorhonen@0
|
559
|
jtkorhonen@0
|
560 bool MainWindow::isSelectedLocallyDeleted(QListWidget *workList)
|
jtkorhonen@0
|
561 {
|
jtkorhonen@0
|
562 QList<QListWidgetItem *> selList = workList -> selectedItems();
|
jtkorhonen@0
|
563 if (selList.count() == 1)
|
jtkorhonen@0
|
564 {
|
jtkorhonen@0
|
565 if (selList.at(0)->text().mid(0, 1) == "!")
|
jtkorhonen@0
|
566 {
|
jtkorhonen@0
|
567 return true;
|
jtkorhonen@0
|
568 }
|
jtkorhonen@0
|
569 }
|
jtkorhonen@0
|
570 return false;
|
jtkorhonen@0
|
571 }
|
jtkorhonen@0
|
572
|
jtkorhonen@0
|
573
|
jtkorhonen@0
|
574 bool MainWindow::isSelectedUntracked(QListWidget *workList)
|
jtkorhonen@0
|
575 {
|
jtkorhonen@0
|
576 QList<QListWidgetItem *> selList = workList -> selectedItems();
|
jtkorhonen@0
|
577 if (selList.count() == 1)
|
jtkorhonen@0
|
578 {
|
jtkorhonen@0
|
579 if (selList.at(0)->text().mid(0, 1) == "?")
|
jtkorhonen@0
|
580 {
|
jtkorhonen@0
|
581 return true;
|
jtkorhonen@0
|
582 }
|
jtkorhonen@0
|
583 }
|
jtkorhonen@0
|
584 return false;
|
jtkorhonen@0
|
585 }
|
jtkorhonen@0
|
586
|
jtkorhonen@0
|
587
|
jtkorhonen@0
|
588 bool MainWindow::isSelectedModified(QListWidget *workList)
|
jtkorhonen@0
|
589 {
|
jtkorhonen@0
|
590 QList<QListWidgetItem *> selList = workList -> selectedItems();
|
jtkorhonen@0
|
591 if (selList.count() == 1)
|
jtkorhonen@0
|
592 {
|
jtkorhonen@0
|
593 if (selList.at(0)->text().mid(0, 1) == "M")
|
jtkorhonen@0
|
594 {
|
jtkorhonen@0
|
595 return true;
|
jtkorhonen@0
|
596 }
|
jtkorhonen@0
|
597 }
|
jtkorhonen@0
|
598 return false;
|
jtkorhonen@0
|
599 }
|
jtkorhonen@0
|
600
|
jtkorhonen@0
|
601 void MainWindow::countAMRModifications(QListWidget *workList, int& a, int& m, int& r)
|
jtkorhonen@0
|
602 {
|
jtkorhonen@0
|
603 int itemCount = workList -> count();
|
jtkorhonen@0
|
604 if (itemCount > 0)
|
jtkorhonen@0
|
605 {
|
jtkorhonen@0
|
606 int A= 0;
|
jtkorhonen@0
|
607 int M=0;
|
jtkorhonen@0
|
608 int R=0;
|
jtkorhonen@0
|
609 for (int i = 0; i < workList -> count(); i++)
|
jtkorhonen@0
|
610 {
|
jtkorhonen@0
|
611 QListWidgetItem *currItem = workList -> item(i);
|
jtkorhonen@0
|
612
|
jtkorhonen@0
|
613 QString tmp = currItem->text().mid(0, 1);
|
jtkorhonen@0
|
614 if (tmp == "M")
|
jtkorhonen@0
|
615 {
|
jtkorhonen@0
|
616 M++;
|
jtkorhonen@0
|
617 }
|
jtkorhonen@0
|
618 else if (tmp == "R")
|
jtkorhonen@0
|
619 {
|
jtkorhonen@0
|
620 R++;
|
jtkorhonen@0
|
621 }
|
jtkorhonen@0
|
622 else if (tmp == "A")
|
jtkorhonen@0
|
623 {
|
jtkorhonen@0
|
624 A++;
|
jtkorhonen@0
|
625 }
|
jtkorhonen@0
|
626 }
|
jtkorhonen@0
|
627
|
jtkorhonen@0
|
628 a = A;
|
jtkorhonen@0
|
629 m = M;
|
jtkorhonen@0
|
630 r = R;
|
jtkorhonen@0
|
631 }
|
jtkorhonen@0
|
632 else
|
jtkorhonen@0
|
633 {
|
jtkorhonen@0
|
634 a = 0;
|
jtkorhonen@0
|
635 m = 0;
|
jtkorhonen@0
|
636 r = 0;
|
jtkorhonen@0
|
637 }
|
jtkorhonen@0
|
638 }
|
jtkorhonen@0
|
639
|
jtkorhonen@0
|
640
|
jtkorhonen@0
|
641 void MainWindow::timerEvent(QTimerEvent *)
|
jtkorhonen@0
|
642 {
|
jtkorhonen@0
|
643 bool shouldHgStat = false;
|
jtkorhonen@0
|
644
|
jtkorhonen@0
|
645 if (runningAction != ACT_NONE)
|
jtkorhonen@0
|
646 {
|
jtkorhonen@0
|
647 //We are running some hg command...
|
jtkorhonen@0
|
648 if (runner -> isProcRunning() == false)
|
jtkorhonen@0
|
649 {
|
jtkorhonen@0
|
650 //Running has just ended.
|
jtkorhonen@0
|
651 int exitCode = runner -> getExitCode();
|
jtkorhonen@0
|
652
|
jtkorhonen@0
|
653 runner -> hideProgBar();
|
jtkorhonen@0
|
654
|
jtkorhonen@0
|
655 //Clumsy...
|
jtkorhonen@0
|
656 if ((EXITOK(exitCode)) || ((exitCode == 1) && (runningAction == ACT_INCOMING)))
|
jtkorhonen@0
|
657 {
|
jtkorhonen@0
|
658 //Successful running.
|
jtkorhonen@0
|
659 switch(runningAction)
|
jtkorhonen@0
|
660 {
|
jtkorhonen@0
|
661 case ACT_STAT:
|
jtkorhonen@0
|
662 {
|
jtkorhonen@0
|
663 hgExp -> updateWorkFolderFileList(runner -> getStdOut());
|
jtkorhonen@0
|
664 }
|
jtkorhonen@0
|
665 break;
|
jtkorhonen@0
|
666
|
jtkorhonen@0
|
667 case ACT_INCOMING:
|
jtkorhonen@0
|
668 case ACT_ANNOTATE:
|
jtkorhonen@0
|
669 case ACT_RESOLVE_LIST:
|
jtkorhonen@0
|
670 case ACT_RESOLVE_MARK:
|
jtkorhonen@2
|
671 presentLongStdoutToUser(runner -> getStdOut());
|
jtkorhonen@0
|
672 shouldHgStat = true;
|
jtkorhonen@0
|
673 break;
|
jtkorhonen@0
|
674
|
jtkorhonen@0
|
675 case ACT_PULL:
|
jtkorhonen@0
|
676 QMessageBox::information(this, "pull", runner -> getStdOut());
|
jtkorhonen@0
|
677 shouldHgStat = true;
|
jtkorhonen@0
|
678 break;
|
jtkorhonen@0
|
679
|
jtkorhonen@0
|
680 case ACT_PUSH:
|
jtkorhonen@0
|
681 QMessageBox::information(this, "push", runner -> getStdOut());
|
jtkorhonen@0
|
682 shouldHgStat = true;
|
jtkorhonen@0
|
683 break;
|
jtkorhonen@0
|
684
|
jtkorhonen@0
|
685 case ACT_INIT:
|
jtkorhonen@0
|
686 enableDisableActions();
|
jtkorhonen@0
|
687 shouldHgStat = true;
|
jtkorhonen@0
|
688 break;
|
jtkorhonen@0
|
689
|
jtkorhonen@0
|
690 case ACT_CLONEFROMREMOTE:
|
jtkorhonen@0
|
691 QMessageBox::information(this, "clone", runner -> getStdOut());
|
jtkorhonen@0
|
692 enableDisableActions();
|
jtkorhonen@0
|
693 shouldHgStat = true;
|
jtkorhonen@0
|
694 break;
|
jtkorhonen@0
|
695
|
jtkorhonen@0
|
696 case ACT_LOG:
|
jtkorhonen@0
|
697 {
|
jtkorhonen@0
|
698 hgExp -> updateLocalRepoHgLogList(runner -> getStdOut());
|
jtkorhonen@0
|
699 }
|
jtkorhonen@0
|
700 break;
|
jtkorhonen@0
|
701
|
jtkorhonen@0
|
702 case ACT_PARENTS:
|
jtkorhonen@0
|
703 {
|
jtkorhonen@0
|
704 hgExp -> updateLocalRepoParentsList(runner -> getStdOut());
|
jtkorhonen@0
|
705 }
|
jtkorhonen@0
|
706 break;
|
jtkorhonen@0
|
707
|
jtkorhonen@0
|
708 case ACT_HEADS:
|
jtkorhonen@0
|
709 {
|
jtkorhonen@0
|
710 QString stdOut = runner -> getStdOut();
|
jtkorhonen@0
|
711 hgExp -> updateLocalRepoHeadsList(stdOut);
|
jtkorhonen@0
|
712 }
|
jtkorhonen@0
|
713 break;
|
jtkorhonen@0
|
714
|
jtkorhonen@0
|
715 case ACT_REMOVE:
|
jtkorhonen@0
|
716 case ACT_ADD:
|
jtkorhonen@0
|
717 case ACT_COMMIT:
|
jtkorhonen@0
|
718 case ACT_FILEDIFF:
|
jtkorhonen@0
|
719 case ACT_FOLDERDIFF:
|
jtkorhonen@0
|
720 case ACT_CHGSETDIFF:
|
jtkorhonen@0
|
721 case ACT_REVERT:
|
jtkorhonen@0
|
722 shouldHgStat = true;
|
jtkorhonen@0
|
723 break;
|
jtkorhonen@0
|
724
|
jtkorhonen@0
|
725 case ACT_UPDATE:
|
jtkorhonen@0
|
726 QMessageBox::information(this, "update", runner -> getStdOut());
|
jtkorhonen@0
|
727 shouldHgStat = true;
|
jtkorhonen@0
|
728 break;
|
jtkorhonen@0
|
729
|
jtkorhonen@0
|
730 case ACT_MERGE:
|
jtkorhonen@0
|
731 QMessageBox::information(this, "merge", runner -> getStdOut());
|
jtkorhonen@0
|
732 shouldHgStat = true;
|
jtkorhonen@0
|
733 break;
|
jtkorhonen@0
|
734
|
jtkorhonen@0
|
735 default:
|
jtkorhonen@0
|
736 break;
|
jtkorhonen@0
|
737 }
|
jtkorhonen@0
|
738 }
|
jtkorhonen@0
|
739
|
jtkorhonen@0
|
740 //Typical sequence goes stat -> heads -> parents -> log
|
jtkorhonen@0
|
741 if (runningAction == ACT_STAT)
|
jtkorhonen@0
|
742 {
|
jtkorhonen@0
|
743 runningAction = ACT_NONE;
|
jtkorhonen@0
|
744 hgHeads();
|
jtkorhonen@0
|
745 }
|
jtkorhonen@0
|
746 else if (runningAction == ACT_HEADS)
|
jtkorhonen@0
|
747 {
|
jtkorhonen@0
|
748 runningAction = ACT_NONE;
|
jtkorhonen@0
|
749 hgParents();
|
jtkorhonen@0
|
750 }
|
jtkorhonen@0
|
751 else if (runningAction == ACT_PARENTS)
|
jtkorhonen@0
|
752 {
|
jtkorhonen@0
|
753 runningAction = ACT_NONE;
|
jtkorhonen@0
|
754 hgLog();
|
jtkorhonen@0
|
755 }
|
jtkorhonen@0
|
756 else
|
jtkorhonen@0
|
757 {
|
jtkorhonen@0
|
758 runningAction = ACT_NONE;
|
jtkorhonen@0
|
759 if (shouldHgStat)
|
jtkorhonen@0
|
760 {
|
jtkorhonen@0
|
761 hgStat();
|
jtkorhonen@0
|
762 }
|
jtkorhonen@0
|
763 }
|
jtkorhonen@0
|
764 }
|
jtkorhonen@0
|
765 }
|
jtkorhonen@0
|
766 else
|
jtkorhonen@0
|
767 {
|
jtkorhonen@0
|
768 enableDisableActions();
|
jtkorhonen@0
|
769 }
|
jtkorhonen@0
|
770 }
|
jtkorhonen@0
|
771
|
jtkorhonen@0
|
772 void MainWindow::connectActions()
|
jtkorhonen@0
|
773 {
|
jtkorhonen@0
|
774 connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
|
jtkorhonen@0
|
775 connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
|
jtkorhonen@0
|
776 connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
jtkorhonen@0
|
777
|
jtkorhonen@0
|
778 connect(hgStatAct, SIGNAL(triggered()), this, SLOT(hgStat()));
|
jtkorhonen@0
|
779 connect(hgExp, SIGNAL(workFolderViewTypesChanged()), this, SLOT(hgStat()));
|
jtkorhonen@0
|
780 connect(hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove()));
|
jtkorhonen@0
|
781 connect(hgAddAct, SIGNAL(triggered()), this, SLOT(hgAdd()));
|
jtkorhonen@0
|
782 connect(hgCommitAct, SIGNAL(triggered()), this, SLOT(hgCommit()));
|
jtkorhonen@0
|
783 connect(hgFileDiffAct, SIGNAL(triggered()), this, SLOT(hgFileDiff()));
|
jtkorhonen@0
|
784 connect(hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff()));
|
jtkorhonen@0
|
785 connect(hgChgSetDiffAct, SIGNAL(triggered()), this, SLOT(hgChgSetDiff()));
|
jtkorhonen@0
|
786 connect(hgUpdateAct, SIGNAL(triggered()), this, SLOT(hgUpdate()));
|
jtkorhonen@0
|
787 connect(hgRevertAct, SIGNAL(triggered()), this, SLOT(hgRevert()));
|
jtkorhonen@0
|
788 connect(hgMergeAct, SIGNAL(triggered()), this, SLOT(hgMerge()));
|
jtkorhonen@0
|
789
|
jtkorhonen@0
|
790 connect(settingsAct, SIGNAL(triggered()), this, SLOT(settings()));
|
jtkorhonen@0
|
791
|
jtkorhonen@0
|
792 connect(hgInitAct, SIGNAL(triggered()), this, SLOT(hgInit()));
|
jtkorhonen@0
|
793 connect(hgCloneFromRemoteAct, SIGNAL(triggered()), this, SLOT(hgCloneFromRemote()));
|
jtkorhonen@0
|
794 connect(hgIncomingAct, SIGNAL(triggered()), this, SLOT(hgIncoming()));
|
jtkorhonen@0
|
795 connect(hgPullAct, SIGNAL(triggered()), this, SLOT(hgPull()));
|
jtkorhonen@0
|
796 connect(hgPushAct, SIGNAL(triggered()), this, SLOT(hgPush()));
|
jtkorhonen@0
|
797
|
jtkorhonen@0
|
798 connect(hgExp, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
|
jtkorhonen@0
|
799
|
jtkorhonen@0
|
800 connect(hgUpdateToRevAct, SIGNAL(triggered()), this, SLOT(hgUpdateToRev()));
|
jtkorhonen@0
|
801 connect(hgAnnotateAct, SIGNAL(triggered()), this, SLOT(hgAnnotate()));
|
jtkorhonen@0
|
802 connect(hgResolveListAct, SIGNAL(triggered()), this, SLOT(hgResolveList()));
|
jtkorhonen@0
|
803 connect(hgResolveMarkAct, SIGNAL(triggered()), this, SLOT(hgResolveMark()));
|
jtkorhonen@0
|
804 }
|
jtkorhonen@0
|
805
|
jtkorhonen@0
|
806 void MainWindow::tabChanged(int currTab)
|
jtkorhonen@0
|
807 {
|
jtkorhonen@0
|
808 tabPage = currTab;
|
jtkorhonen@0
|
809 }
|
jtkorhonen@0
|
810
|
jtkorhonen@0
|
811 void MainWindow::enableDisableActions()
|
jtkorhonen@0
|
812 {
|
jtkorhonen@0
|
813 QDir localRepoDir;
|
jtkorhonen@0
|
814 QDir workFolderDir;
|
jtkorhonen@0
|
815 bool workFolderExist;
|
jtkorhonen@0
|
816 bool localRepoExist;
|
jtkorhonen@0
|
817
|
jtkorhonen@0
|
818 remoteRepoActionsEnabled = true;
|
jtkorhonen@0
|
819 if (remoteRepoPath.isEmpty())
|
jtkorhonen@0
|
820 {
|
jtkorhonen@0
|
821 remoteRepoActionsEnabled = false;
|
jtkorhonen@0
|
822 }
|
jtkorhonen@0
|
823
|
jtkorhonen@0
|
824 localRepoActionsEnabled = true;
|
jtkorhonen@0
|
825 if (workFolderPath.isEmpty())
|
jtkorhonen@0
|
826 {
|
jtkorhonen@0
|
827 localRepoActionsEnabled = false;
|
jtkorhonen@0
|
828 workFolderExist = false;
|
jtkorhonen@0
|
829 }
|
jtkorhonen@0
|
830
|
jtkorhonen@0
|
831 if (!workFolderDir.exists(workFolderPath))
|
jtkorhonen@0
|
832 {
|
jtkorhonen@0
|
833 localRepoActionsEnabled = false;
|
jtkorhonen@0
|
834 workFolderExist = false;
|
jtkorhonen@0
|
835 }
|
jtkorhonen@0
|
836 else
|
jtkorhonen@0
|
837 {
|
jtkorhonen@0
|
838 workFolderExist = true;
|
jtkorhonen@0
|
839 }
|
jtkorhonen@0
|
840
|
jtkorhonen@0
|
841 if (!localRepoDir.exists(workFolderPath + getHgDirName()))
|
jtkorhonen@0
|
842 {
|
jtkorhonen@0
|
843 localRepoActionsEnabled = false;
|
jtkorhonen@0
|
844 localRepoExist = false;
|
jtkorhonen@0
|
845 }
|
jtkorhonen@0
|
846
|
jtkorhonen@0
|
847 hgCloneFromRemoteAct -> setEnabled(remoteRepoActionsEnabled);
|
jtkorhonen@0
|
848 hgIncomingAct -> setEnabled(remoteRepoActionsEnabled && remoteRepoActionsEnabled);
|
jtkorhonen@0
|
849 hgPullAct -> setEnabled(remoteRepoActionsEnabled && remoteRepoActionsEnabled);
|
jtkorhonen@0
|
850 hgPushAct -> setEnabled(remoteRepoActionsEnabled && remoteRepoActionsEnabled);
|
jtkorhonen@0
|
851
|
jtkorhonen@0
|
852 if (tabPage != WORKTAB)
|
jtkorhonen@0
|
853 {
|
jtkorhonen@0
|
854 localRepoActionsEnabled = false;
|
jtkorhonen@0
|
855 }
|
jtkorhonen@0
|
856
|
jtkorhonen@0
|
857 hgInitAct -> setEnabled((localRepoExist == false) && (workFolderExist==true));
|
jtkorhonen@0
|
858 hgStatAct -> setEnabled(localRepoActionsEnabled);
|
jtkorhonen@0
|
859 hgFileDiffAct -> setEnabled(localRepoActionsEnabled);
|
jtkorhonen@0
|
860 hgFolderDiffAct -> setEnabled(localRepoActionsEnabled);
|
jtkorhonen@0
|
861 hgRevertAct -> setEnabled(localRepoActionsEnabled);
|
jtkorhonen@0
|
862 hgAddAct -> setEnabled(localRepoActionsEnabled);
|
jtkorhonen@0
|
863 hgRemoveAct -> setEnabled(localRepoActionsEnabled);
|
jtkorhonen@0
|
864 hgUpdateAct -> setEnabled(localRepoActionsEnabled);
|
jtkorhonen@0
|
865 hgCommitAct -> setEnabled(localRepoActionsEnabled);
|
jtkorhonen@0
|
866 hgMergeAct -> setEnabled(localRepoActionsEnabled);
|
jtkorhonen@2
|
867 hgResolveListAct -> setEnabled(localRepoActionsEnabled);
|
jtkorhonen@2
|
868 hgResolveMarkAct -> setEnabled(localRepoActionsEnabled);
|
jtkorhonen@2
|
869 hgAnnotateAct -> setEnabled(localRepoActionsEnabled);
|
jtkorhonen@0
|
870
|
jtkorhonen@0
|
871 hgExp -> enableDisableOtherTabs();
|
jtkorhonen@0
|
872
|
jtkorhonen@0
|
873 int a, m, r;
|
jtkorhonen@0
|
874 countAMRModifications(hgExp -> workFolderFileList, a, m, r);
|
jtkorhonen@0
|
875
|
jtkorhonen@0
|
876 if (tabPage == WORKTAB)
|
jtkorhonen@0
|
877 {
|
jtkorhonen@0
|
878 //Enable / disable actions according to workFolderFileList selections / currentSelection / count
|
jtkorhonen@0
|
879 hgChgSetDiffAct -> setEnabled(false);
|
jtkorhonen@0
|
880 hgUpdateToRevAct -> setEnabled(false);
|
jtkorhonen@0
|
881
|
jtkorhonen@0
|
882 if (localRepoActionsEnabled)
|
jtkorhonen@0
|
883 {
|
jtkorhonen@0
|
884 if ((a == 0) && (m == 0) && (r == 0))
|
jtkorhonen@0
|
885 {
|
jtkorhonen@0
|
886 hgCommitAct -> setEnabled(false);
|
jtkorhonen@0
|
887 hgRevertAct -> setEnabled(false);
|
jtkorhonen@0
|
888 }
|
jtkorhonen@0
|
889
|
jtkorhonen@0
|
890 if (m == 0)
|
jtkorhonen@0
|
891 {
|
jtkorhonen@0
|
892 hgFolderDiffAct -> setEnabled(false);
|
jtkorhonen@0
|
893 }
|
jtkorhonen@0
|
894
|
jtkorhonen@0
|
895 if (!isSelectedModified(hgExp -> workFolderFileList))
|
jtkorhonen@0
|
896 {
|
jtkorhonen@0
|
897 hgFileDiffAct -> setEnabled(false);
|
jtkorhonen@0
|
898 hgRevertAct -> setEnabled(false);
|
jtkorhonen@0
|
899 }
|
jtkorhonen@0
|
900
|
jtkorhonen@0
|
901 if (!isSelectedUntracked(hgExp -> workFolderFileList))
|
jtkorhonen@0
|
902 {
|
jtkorhonen@0
|
903 hgAddAct -> setEnabled(false);
|
jtkorhonen@0
|
904 }
|
jtkorhonen@0
|
905
|
jtkorhonen@0
|
906 if (!isSelectedLocallyDeleted(hgExp -> workFolderFileList))
|
jtkorhonen@0
|
907 {
|
jtkorhonen@0
|
908 hgRemoveAct -> setEnabled(false);
|
jtkorhonen@0
|
909 }
|
jtkorhonen@0
|
910
|
jtkorhonen@2
|
911 hgResolveListAct -> setEnabled(true);
|
jtkorhonen@2
|
912
|
jtkorhonen@0
|
913 if (hgExp -> localRepoHeadsList->count() == 1)
|
jtkorhonen@0
|
914 {
|
jtkorhonen@0
|
915 hgMergeAct -> setEnabled(false);
|
jtkorhonen@0
|
916 }
|
jtkorhonen@0
|
917
|
jtkorhonen@2
|
918 QString currentFile = hgExp -> getCurrentFileListLine();
|
jtkorhonen@2
|
919 if (!currentFile.isEmpty())
|
jtkorhonen@2
|
920 {
|
jtkorhonen@2
|
921 hgAnnotateAct -> setEnabled(true);
|
jtkorhonen@2
|
922 hgResolveMarkAct -> setEnabled(true);
|
jtkorhonen@2
|
923 }
|
jtkorhonen@2
|
924 else
|
jtkorhonen@2
|
925 {
|
jtkorhonen@2
|
926 hgAnnotateAct -> setEnabled(false);
|
jtkorhonen@2
|
927 hgResolveMarkAct -> setEnabled(false);
|
jtkorhonen@2
|
928 }
|
jtkorhonen@0
|
929 }
|
jtkorhonen@0
|
930 }
|
jtkorhonen@0
|
931 else
|
jtkorhonen@0
|
932 {
|
jtkorhonen@0
|
933 QList <QListWidgetItem *> headSelList = hgExp -> localRepoHeadsList->selectedItems();
|
jtkorhonen@0
|
934 QList <QListWidgetItem *> historySelList = hgExp -> localRepoHgLogList->selectedItems();
|
jtkorhonen@0
|
935
|
jtkorhonen@0
|
936 if ((historySelList.count() == 2) || (headSelList.count() == 2))
|
jtkorhonen@0
|
937 {
|
jtkorhonen@0
|
938 hgChgSetDiffAct -> setEnabled(true);
|
jtkorhonen@0
|
939 }
|
jtkorhonen@0
|
940 else
|
jtkorhonen@0
|
941 {
|
jtkorhonen@0
|
942 hgChgSetDiffAct -> setEnabled(false);
|
jtkorhonen@0
|
943 }
|
jtkorhonen@0
|
944
|
jtkorhonen@0
|
945 if ((a == 0) && (m == 0) && (r == 0))
|
jtkorhonen@0
|
946 {
|
jtkorhonen@0
|
947 if (historySelList.count() == 1)
|
jtkorhonen@0
|
948 {
|
jtkorhonen@0
|
949 hgUpdateToRevAct -> setEnabled(true);
|
jtkorhonen@0
|
950 }
|
jtkorhonen@0
|
951 else
|
jtkorhonen@0
|
952 {
|
jtkorhonen@0
|
953 hgUpdateToRevAct -> setEnabled(false);
|
jtkorhonen@0
|
954 }
|
jtkorhonen@0
|
955 }
|
jtkorhonen@0
|
956 else
|
jtkorhonen@0
|
957 {
|
jtkorhonen@0
|
958 hgUpdateToRevAct -> setEnabled(false);
|
jtkorhonen@0
|
959 }
|
jtkorhonen@0
|
960 }
|
jtkorhonen@0
|
961 }
|
jtkorhonen@0
|
962
|
jtkorhonen@0
|
963 void MainWindow::createActions()
|
jtkorhonen@0
|
964 {
|
jtkorhonen@0
|
965 //File actions
|
jtkorhonen@0
|
966 hgInitAct = new QAction(tr("Init local repository"), this);
|
jtkorhonen@0
|
967 hgInitAct->setStatusTip(tr("Create an empty local repository in selected folder"));
|
jtkorhonen@0
|
968
|
jtkorhonen@0
|
969 hgCloneFromRemoteAct = new QAction(tr("Clone from remote"), this);
|
jtkorhonen@0
|
970 hgCloneFromRemoteAct->setStatusTip(tr("Clone from remote repository into local repository in selected folder"));
|
jtkorhonen@0
|
971
|
jtkorhonen@0
|
972 settingsAct = new QAction(QIcon(":/images/settings.png"), tr("Settings..."), this);
|
jtkorhonen@0
|
973 settingsAct -> setStatusTip(tr("View and change application settings"));
|
jtkorhonen@0
|
974 settingsAct -> setIconVisibleInMenu(true);
|
jtkorhonen@0
|
975
|
jtkorhonen@0
|
976 exitAct = new QAction(QIcon(":/images/exit.png"), tr("Exit"), this);
|
jtkorhonen@0
|
977 exitAct->setShortcuts(QKeySequence::Quit);
|
jtkorhonen@0
|
978 exitAct->setStatusTip(tr("Exit application"));
|
jtkorhonen@0
|
979 exitAct -> setIconVisibleInMenu(true);
|
jtkorhonen@0
|
980
|
jtkorhonen@0
|
981 //Repository actions
|
jtkorhonen@0
|
982 hgIncomingAct = new QAction(QIcon(":/images/incoming.png"), tr("View incoming changesets"), this);
|
jtkorhonen@0
|
983 hgIncomingAct -> setStatusTip(tr("View info of changesets incoming to us from remote repository (on pull operation)"));
|
jtkorhonen@0
|
984
|
jtkorhonen@0
|
985 hgPullAct = new QAction(QIcon(":/images/pull.png"), tr("Pull from remote"), this);
|
jtkorhonen@0
|
986 hgPullAct -> setStatusTip(tr("Pull changesets from remote repository to local repository"));
|
jtkorhonen@0
|
987
|
jtkorhonen@0
|
988 hgPushAct = new QAction(QIcon(":/images/push.png"), tr("Push to remote"), this);
|
jtkorhonen@0
|
989 hgPushAct->setStatusTip(tr("Push local changesets to remote repository"));
|
jtkorhonen@0
|
990
|
jtkorhonen@0
|
991 //Workfolder actions
|
jtkorhonen@0
|
992 hgStatAct = new QAction(QIcon(":/images/status.png"), tr("Refresh status"), this);
|
jtkorhonen@0
|
993 hgStatAct->setStatusTip(tr("Refresh (info of) status of workfolder files (A=Added, M=Mofified, R=Removed, C=Clean, !=Locally deleted, ?=Not tracked, I=Ignored)"));
|
jtkorhonen@0
|
994
|
jtkorhonen@0
|
995 hgFileDiffAct = new QAction(QIcon(":/images/diff.png"), tr("View filediff"), this);
|
jtkorhonen@0
|
996 hgFileDiffAct->setStatusTip(tr("Filediff: View differences between selected working folder file and local repository file"));
|
jtkorhonen@0
|
997
|
jtkorhonen@0
|
998 hgFolderDiffAct = new QAction(QIcon(":/images/folderdiff.png"), tr("View folderdiff"), this);
|
jtkorhonen@0
|
999 hgFolderDiffAct->setStatusTip(tr("Folderdiff: View all differences between working folder files and local repository files"));
|
jtkorhonen@0
|
1000
|
jtkorhonen@0
|
1001 hgChgSetDiffAct = new QAction(QIcon(":/images/chgsetdiff.png"), tr("View changesetdiff"), this);
|
jtkorhonen@0
|
1002 hgChgSetDiffAct->setStatusTip(tr("Change set diff: View differences between all files of 2 repository changesets"));
|
jtkorhonen@0
|
1003
|
jtkorhonen@0
|
1004 hgRevertAct = new QAction(QIcon(":/images/undo.png"), tr("Undo changes"), this);
|
jtkorhonen@0
|
1005 hgRevertAct->setStatusTip(tr("Undo selected working folder file changes (return to local repository version)"));
|
jtkorhonen@0
|
1006
|
jtkorhonen@0
|
1007 hgAddAct = new QAction(QIcon(":/images/add.png"), tr("Add files"), this);
|
jtkorhonen@0
|
1008 hgAddAct -> setStatusTip(tr("Add working folder files to local repository (on next commit)"));
|
jtkorhonen@0
|
1009
|
jtkorhonen@0
|
1010 hgRemoveAct = new QAction(QIcon(":/images/remove.png"), tr("Remove file"), this);
|
jtkorhonen@0
|
1011 hgRemoveAct -> setStatusTip(tr("Remove selected working folder file from local repository (on next commit)"));
|
jtkorhonen@0
|
1012
|
jtkorhonen@0
|
1013 hgUpdateAct = new QAction(QIcon(":/images/update.png"), tr("Update working folder"), this);
|
jtkorhonen@0
|
1014 hgUpdateAct->setStatusTip(tr("Update working folder from local repository"));
|
jtkorhonen@0
|
1015
|
jtkorhonen@0
|
1016 hgCommitAct = new QAction(QIcon(":/images/commit.png"), tr("Commit / Save changes"), this);
|
jtkorhonen@0
|
1017 hgCommitAct->setStatusTip(tr("Save all changes in working folder (and all subfolders) to local repository"));
|
jtkorhonen@0
|
1018
|
jtkorhonen@0
|
1019 hgMergeAct = new QAction(QIcon(":/images/merge.png"), tr("Merge"), this);
|
jtkorhonen@0
|
1020 hgMergeAct->setStatusTip(tr("Merge two local repository changesets to working folder"));
|
jtkorhonen@0
|
1021
|
jtkorhonen@0
|
1022 //Advanced actions
|
jtkorhonen@0
|
1023 hgUpdateToRevAct = new QAction(tr("Update to revision"), this);
|
jtkorhonen@0
|
1024 hgUpdateToRevAct -> setStatusTip(tr("Update working folder to version selected from history list"));
|
jtkorhonen@0
|
1025
|
jtkorhonen@0
|
1026 hgAnnotateAct = new QAction(tr("Annotate"), this);
|
jtkorhonen@0
|
1027 hgAnnotateAct -> setStatusTip(tr("Show line-by-line version information for selected file"));
|
jtkorhonen@0
|
1028
|
jtkorhonen@0
|
1029 hgResolveListAct = new QAction(tr("Resolve (list)"), this);
|
jtkorhonen@0
|
1030 hgResolveListAct -> setStatusTip(tr("Resolve (list): Show list of files needing merge"));
|
jtkorhonen@0
|
1031
|
jtkorhonen@0
|
1032 hgResolveMarkAct = new QAction(tr("Resolve (mark)"), this);
|
jtkorhonen@0
|
1033 hgResolveMarkAct -> setStatusTip(tr("Resolve (mark): Mark selected file status as resolved"));
|
jtkorhonen@0
|
1034
|
jtkorhonen@0
|
1035 //Help actions
|
jtkorhonen@0
|
1036 aboutAct = new QAction(tr("About"), this);
|
jtkorhonen@0
|
1037 aboutAct->setStatusTip(tr("Show the application's About box"));
|
jtkorhonen@0
|
1038
|
jtkorhonen@0
|
1039 aboutQtAct = new QAction(tr("About Qt"), this);
|
jtkorhonen@0
|
1040 aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
|
jtkorhonen@0
|
1041 }
|
jtkorhonen@0
|
1042
|
jtkorhonen@0
|
1043 void MainWindow::createMenus()
|
jtkorhonen@0
|
1044 {
|
jtkorhonen@0
|
1045 fileMenu = menuBar()->addMenu(tr("File"));
|
jtkorhonen@0
|
1046 fileMenu -> addAction(hgInitAct);
|
jtkorhonen@0
|
1047 fileMenu -> addAction(hgCloneFromRemoteAct);
|
jtkorhonen@0
|
1048 fileMenu -> addSeparator();
|
jtkorhonen@0
|
1049 fileMenu -> addAction(settingsAct);
|
jtkorhonen@0
|
1050 fileMenu -> addSeparator();
|
jtkorhonen@0
|
1051 fileMenu -> addAction(exitAct);
|
jtkorhonen@0
|
1052
|
jtkorhonen@0
|
1053 advancedMenu = menuBar()->addMenu(tr("Advanced"));
|
jtkorhonen@0
|
1054 advancedMenu -> addAction(hgUpdateToRevAct);
|
jtkorhonen@0
|
1055 advancedMenu -> addSeparator();
|
jtkorhonen@0
|
1056 advancedMenu -> addAction(hgAnnotateAct);
|
jtkorhonen@0
|
1057 advancedMenu -> addSeparator();
|
jtkorhonen@0
|
1058 advancedMenu -> addAction(hgResolveListAct);
|
jtkorhonen@0
|
1059 advancedMenu -> addAction(hgResolveMarkAct);
|
jtkorhonen@0
|
1060
|
jtkorhonen@0
|
1061 helpMenu = menuBar()->addMenu(tr("Help"));
|
jtkorhonen@0
|
1062 helpMenu->addAction(aboutAct);
|
jtkorhonen@0
|
1063 helpMenu->addAction(aboutQtAct);
|
jtkorhonen@0
|
1064 }
|
jtkorhonen@0
|
1065
|
jtkorhonen@0
|
1066 void MainWindow::createToolBars()
|
jtkorhonen@0
|
1067 {
|
jtkorhonen@0
|
1068 fileToolBar = addToolBar(tr("File"));
|
jtkorhonen@0
|
1069 fileToolBar -> setIconSize(QSize(MY_ICON_SIZE, MY_ICON_SIZE));
|
jtkorhonen@0
|
1070 fileToolBar -> addAction(settingsAct);
|
jtkorhonen@0
|
1071 fileToolBar -> addAction(exitAct);
|
jtkorhonen@0
|
1072 fileToolBar -> addSeparator();
|
jtkorhonen@0
|
1073 fileToolBar -> addAction(hgChgSetDiffAct);
|
jtkorhonen@0
|
1074 fileToolBar -> setMovable(false);
|
jtkorhonen@0
|
1075
|
jtkorhonen@0
|
1076 repoToolBar = addToolBar(tr(REPOMENU_TITLE));
|
jtkorhonen@0
|
1077 repoToolBar -> setIconSize(QSize(MY_ICON_SIZE, MY_ICON_SIZE));
|
jtkorhonen@0
|
1078 repoToolBar->addAction(hgIncomingAct);
|
jtkorhonen@0
|
1079 repoToolBar->addAction(hgPullAct);
|
jtkorhonen@0
|
1080 repoToolBar->addAction(hgPushAct);
|
jtkorhonen@0
|
1081 repoToolBar -> setMovable(false);
|
jtkorhonen@0
|
1082
|
jtkorhonen@0
|
1083 workFolderToolBar = addToolBar(tr(WORKFOLDERMENU_TITLE));
|
jtkorhonen@0
|
1084 addToolBar(Qt::LeftToolBarArea, workFolderToolBar);
|
jtkorhonen@0
|
1085 workFolderToolBar -> setIconSize(QSize(MY_ICON_SIZE, MY_ICON_SIZE));
|
jtkorhonen@0
|
1086 workFolderToolBar->addAction(hgStatAct);
|
jtkorhonen@0
|
1087 workFolderToolBar->addSeparator();
|
jtkorhonen@0
|
1088 workFolderToolBar->addAction(hgFileDiffAct);
|
jtkorhonen@0
|
1089 workFolderToolBar->addAction(hgFolderDiffAct);
|
jtkorhonen@0
|
1090 workFolderToolBar->addSeparator();
|
jtkorhonen@0
|
1091 workFolderToolBar->addAction(hgRevertAct);
|
jtkorhonen@0
|
1092 workFolderToolBar->addAction(hgUpdateAct);
|
jtkorhonen@0
|
1093 workFolderToolBar->addAction(hgCommitAct);
|
jtkorhonen@0
|
1094 workFolderToolBar->addAction(hgMergeAct);
|
jtkorhonen@0
|
1095 workFolderToolBar->addSeparator();
|
jtkorhonen@0
|
1096 workFolderToolBar->addAction(hgAddAct);
|
jtkorhonen@0
|
1097 workFolderToolBar->addAction(hgRemoveAct);
|
jtkorhonen@0
|
1098 workFolderToolBar -> setMovable(false);
|
jtkorhonen@0
|
1099
|
jtkorhonen@0
|
1100 }
|
jtkorhonen@0
|
1101
|
jtkorhonen@0
|
1102
|
jtkorhonen@0
|
1103 void MainWindow::createStatusBar()
|
jtkorhonen@0
|
1104 {
|
jtkorhonen@0
|
1105 statusBar()->showMessage(tr("Ready"));
|
jtkorhonen@0
|
1106 }
|
jtkorhonen@0
|
1107
|
jtkorhonen@0
|
1108 void MainWindow::readSettings()
|
jtkorhonen@0
|
1109 {
|
jtkorhonen@0
|
1110 QDir workFolder;
|
jtkorhonen@0
|
1111
|
jtkorhonen@0
|
1112 QSettings settings("hgexplorer", "hgexplorer");
|
jtkorhonen@0
|
1113
|
jtkorhonen@0
|
1114 remoteRepoPath = settings.value("remoterepopath", "").toString() ;
|
jtkorhonen@0
|
1115 workFolderPath = settings.value("workfolderpath", "").toString();
|
jtkorhonen@0
|
1116 if (!workFolder.exists(workFolderPath))
|
jtkorhonen@0
|
1117 {
|
jtkorhonen@0
|
1118 workFolderPath = "";
|
jtkorhonen@0
|
1119 }
|
jtkorhonen@0
|
1120
|
jtkorhonen@0
|
1121 userInfo = settings.value("userinfo", "").toString();
|
jtkorhonen@0
|
1122
|
jtkorhonen@0
|
1123 QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
|
jtkorhonen@0
|
1124 QSize size = settings.value("size", QSize(400, 400)).toSize();
|
jtkorhonen@0
|
1125 firstStart = settings.value("firststart", QVariant(true)).toBool();
|
jtkorhonen@0
|
1126
|
jtkorhonen@0
|
1127 initialFileTypesBits = (unsigned char) settings.value("viewFileTypes", QVariant(DEFAULT_HG_STAT_BITS)).toInt();
|
jtkorhonen@0
|
1128 resize(size);
|
jtkorhonen@0
|
1129 move(pos);
|
jtkorhonen@0
|
1130 }
|
jtkorhonen@0
|
1131
|
jtkorhonen@0
|
1132 void MainWindow::writeSettings()
|
jtkorhonen@0
|
1133 {
|
jtkorhonen@0
|
1134 QSettings settings("hgexplorer", "hgexplorer");
|
jtkorhonen@0
|
1135 settings.setValue("pos", pos());
|
jtkorhonen@0
|
1136 settings.setValue("size", size());
|
jtkorhonen@0
|
1137 settings.setValue("remoterepopath", remoteRepoPath);
|
jtkorhonen@0
|
1138 settings.setValue("workfolderpath", workFolderPath);
|
jtkorhonen@0
|
1139 settings.setValue("userinfo", userInfo);
|
jtkorhonen@0
|
1140 settings.setValue("firststart", firstStart);
|
jtkorhonen@0
|
1141 settings.setValue("viewFileTypes", hgExp -> getFileTypesBits());
|
jtkorhonen@0
|
1142 }
|
jtkorhonen@0
|
1143
|
jtkorhonen@0
|
1144
|
jtkorhonen@0
|
1145
|
jtkorhonen@0
|
1146
|