comparison mainwindow.cpp @ 30:45bfb8dc1faf

UpdateToRev has more power. Copyrights updated. Mrulist of repos added.
author Jari Korhonen <jtkorhonen@gmail.com>
date Mon, 14 Jun 2010 21:55:17 +0300
parents fad897ed9894
children 552a49635124
comparison
equal deleted inserted replaced
29:fad897ed9894 30:45bfb8dc1faf
1 /**************************************************************************** 1 /****************************************************************************
2 ** 2 ** Copyright (C) Jari Korhonen, 2010 (under lgpl)
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 3 ****************************************************************************/
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the examples of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** Commercial Usage
11 ** Licensees holding valid Qt Commercial licenses may use this file in
12 ** accordance with the Qt Commercial License Agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and Nokia.
15 **
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23 **
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27 **
28 ** GNU General Public License Usage
29 ** Alternatively, this file may be used under the terms of the GNU
30 ** General Public License version 3.0 as published by the Free Software
31 ** Foundation and appearing in the file LICENSE.GPL included in the
32 ** packaging of this file. Please review the following information to
33 ** ensure the GNU General Public License version 3.0 requirements will be
34 ** met: http://www.gnu.org/copyleft/gpl.html.
35 **
36 ** If you have questions regarding the use of this file, please contact
37 ** Nokia at qt-info@nokia.com.
38 ** $QT_END_LICENSE$
39 **
40 ** Copyright (C) Jari Korhonen, 2010 (HgExplorer specific parts, under lgpl)
41 *************************************************************************************/
42 4
43 #include <QtGui> 5 #include <QtGui>
44 #include <QStringList> 6 #include <QStringList>
45 #include <QDir> 7 #include <QDir>
46 #include <QNetworkInterface> 8 #include <QNetworkInterface>
1152 else 1114 else
1153 { 1115 {
1154 hgChgSetDiffAct -> setEnabled(false); 1116 hgChgSetDiffAct -> setEnabled(false);
1155 } 1117 }
1156 1118
1157 if ((added == 0) && (modified == 0) && (removed == 0)) 1119 if (historySelList.count() == 1)
1158 { 1120 {
1159 if (historySelList.count() == 1) 1121 hgUpdateToRevAct -> setEnabled(true);
1160 {
1161 hgUpdateToRevAct -> setEnabled(true);
1162 }
1163 else
1164 {
1165 hgUpdateToRevAct -> setEnabled(false);
1166 }
1167 } 1122 }
1168 else 1123 else
1169 { 1124 {
1170 hgUpdateToRevAct -> setEnabled(false); 1125 hgUpdateToRevAct -> setEnabled(false);
1171 } 1126 }
1326 { 1281 {
1327 QDir workFolder; 1282 QDir workFolder;
1328 1283
1329 QSettings settings("hgexplorer", "hgexplorer"); 1284 QSettings settings("hgexplorer", "hgexplorer");
1330 1285
1331 remoteRepoPath = settings.value("remoterepopath", "").toString() ; 1286 remoteRepoPath = settings.value("remoterepopath", "").toString();
1332 workFolderPath = settings.value("workfolderpath", "").toString(); 1287 workFolderPath = settings.value("workfolderpath", "").toString();
1333 if (!workFolder.exists(workFolderPath)) 1288 if (!workFolder.exists(workFolderPath))
1334 { 1289 {
1335 workFolderPath = ""; 1290 workFolderPath = "";
1291 }
1292
1293 for(int i = 0; i < NUM_PATHS_IN_MRU_LIST; i++)
1294 {
1295 QString tmp;
1296
1297 tmp.sprintf("remoterepomrupath%d", i);
1298 remoteRepoMruList[i] = settings.value(tmp, "").toString();
1299
1300 tmp.sprintf("workfoldermru%d", i);
1301 workFolderMruList[i] = settings.value(tmp, "").toString();
1336 } 1302 }
1337 1303
1338 userInfo = settings.value("userinfo", "").toString(); 1304 userInfo = settings.value("userinfo", "").toString();
1339 1305
1340 QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint(); 1306 QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
1352 QSettings settings("hgexplorer", "hgexplorer"); 1318 QSettings settings("hgexplorer", "hgexplorer");
1353 settings.setValue("pos", pos()); 1319 settings.setValue("pos", pos());
1354 settings.setValue("size", size()); 1320 settings.setValue("size", size());
1355 settings.setValue("remoterepopath", remoteRepoPath); 1321 settings.setValue("remoterepopath", remoteRepoPath);
1356 settings.setValue("workfolderpath", workFolderPath); 1322 settings.setValue("workfolderpath", workFolderPath);
1323
1324 for(int i = 0; i < NUM_PATHS_IN_MRU_LIST; i++)
1325 {
1326 QString tmp;
1327
1328 tmp.sprintf("remoterepomrupath%d", i);
1329 settings.setValue(tmp, remoteRepoMruList[i]);
1330
1331 tmp.sprintf("workfoldermru%d", i);
1332 settings.setValue(tmp, workFolderMruList[i]);
1333 }
1334
1357 settings.setValue("userinfo", userInfo); 1335 settings.setValue("userinfo", userInfo);
1358 settings.setValue("firststart", firstStart); 1336 settings.setValue("firststart", firstStart);
1359 settings.setValue("viewFileTypes", hgExp -> getFileTypesBits()); 1337 settings.setValue("viewFileTypes", hgExp -> getFileTypesBits());
1360 } 1338 }
1361 1339