comparison mainwindow.cpp @ 98:3e6c3281fb97

* Wire up the basic Hg actions again
author Chris Cannam
date Wed, 24 Nov 2010 17:11:44 +0000
parents 05203e53b92a
children a5a2d74a83a7
comparison
equal deleted inserted replaced
97:05203e53b92a 98:3e6c3281fb97
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 2
3 /* 3 /*
4 EasyMercurial 4 EasyMercurial
5 5
6 Based on HgExplorer by Jari Korhonen 6 Based on hgExplorer by Jari Korhonen
7 Copyright (c) 2010 Jari Korhonen 7 Copyright (c) 2010 Jari Korhonen
8 Copyright (c) 2010 Chris Cannam 8 Copyright (c) 2010 Chris Cannam
9 Copyright (c) 2010 Queen Mary, University of London 9 Copyright (c) 2010 Queen Mary, University of London
10 10
11 This program is free software; you can redistribute it and/or 11 This program is free software; you can redistribute it and/or
65 65
66 readSettings(); 66 readSettings();
67 67
68 tabPage = 0; 68 tabPage = 0;
69 justMerged = false; 69 justMerged = false;
70 hgExp = new HgTabWidget((QWidget *) this, remoteRepoPath, workFolderPath); 70 hgTabs = new HgTabWidget((QWidget *) this, remoteRepoPath, workFolderPath);
71 setCentralWidget(hgExp); 71 setCentralWidget(hgTabs);
72 72
73 connect(hgExp, SIGNAL(selectionChanged()), 73 connect(hgTabs, SIGNAL(selectionChanged()),
74 this, SLOT(enableDisableActions())); 74 this, SLOT(enableDisableActions()));
75 75
76 setUnifiedTitleAndToolBarOnMac(true); 76 setUnifiedTitleAndToolBarOnMac(true);
77 connectActions(); 77 connectActions();
78 enableDisableActions(); 78 enableDisableActions();
123 { 123 {
124 QMessageBox::about(this, tr("About EasyMercurial"), 124 QMessageBox::about(this, tr("About EasyMercurial"),
125 tr("<qt><h2>About EasyMercurial</h2>" 125 tr("<qt><h2>About EasyMercurial</h2>"
126 "<p>EasyMercurial is a simple user interface for the " 126 "<p>EasyMercurial is a simple user interface for the "
127 "Mercurial version control system.</p>" 127 "Mercurial version control system.</p>"
128 "<p>EasyMercurial is based on HgExplorer by " 128 "<p>EasyMercurial is based on hgExplorer by "
129 "Jari Korhonen, with thanks.<br>EasyMercurial development carried out by " 129 "Jari Korhonen, with thanks.<br>EasyMercurial development carried out by "
130 "Chris Cannam for soundsoftware.ac.uk at the Centre for Digital Music, Queen Mary, University of London." 130 "Chris Cannam for soundsoftware.ac.uk at the Centre for Digital Music, Queen Mary, University of London."
131 "<ul><li>Copyright &copy; 2010 Jari Korhonen</li>" 131 "<ul><li>Copyright &copy; 2010 Jari Korhonen</li>"
132 "<li>Copyright &copy; 2010 Chris Cannam</li>" 132 "<li>Copyright &copy; 2010 Chris Cannam</li>"
133 "<li>Copyright &copy; 2010 Queen Mary, University of London</li>" 133 "<li>Copyright &copy; 2010 Queen Mary, University of London</li>"
139 "COPYING included with this distribution for more information.")); 139 "COPYING included with this distribution for more information."));
140 } 140 }
141 141
142 void MainWindow::clearSelections() 142 void MainWindow::clearSelections()
143 { 143 {
144 hgExp->clearSelections(); 144 hgTabs->clearSelections();
145 } 145 }
146 146
147 void MainWindow::hgStat() 147 void MainWindow::hgStat()
148 { 148 {
149 if (runningAction == ACT_NONE) 149 if (runningAction == ACT_NONE)
208 runningAction = ACT_PARENTS; 208 runningAction = ACT_PARENTS;
209 } 209 }
210 } 210 }
211 211
212 212
213
214 void MainWindow::hgRemove()
215 {
216 if (runningAction == ACT_NONE)
217 {
218 QStringList params;
219 QString currentFile;//!!! = hgExp -> getCurrentFileListLine();
220
221 if (!currentFile.isEmpty())
222 {
223 if (QMessageBox::Ok == QMessageBox::warning(this, "Remove file", "Really remove file " + currentFile.mid(2) + "?",
224 QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel))
225 {
226 params << "remove" << "--after" << "--force" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
227
228 runner -> startHgCommand(workFolderPath, params);
229 runningAction = ACT_REMOVE;
230 }
231 }
232 }
233 }
234
235 void MainWindow::hgAnnotate() 213 void MainWindow::hgAnnotate()
236 { 214 {
237 if (runningAction == ACT_NONE) 215 if (runningAction == ACT_NONE)
238 { 216 {
239 QStringList params; 217 QStringList params;
240 QString currentFile;//!!! = hgExp -> getCurrentFileListLine(); 218 QString currentFile;//!!! = hgTabs -> getCurrentFileListLine();
241 219
242 if (!currentFile.isEmpty()) 220 if (!currentFile.isEmpty())
243 { 221 {
244 params << "annotate" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ") 222 params << "annotate" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
245 223
253 void MainWindow::hgResolveMark() 231 void MainWindow::hgResolveMark()
254 { 232 {
255 if (runningAction == ACT_NONE) 233 if (runningAction == ACT_NONE)
256 { 234 {
257 QStringList params; 235 QStringList params;
258 QString currentFile;//!!! = hgExp -> getCurrentFileListLine(); 236 QString currentFile;//!!! = hgTabs -> getCurrentFileListLine();
259 237
260 if (!currentFile.isEmpty()) 238 if (!currentFile.isEmpty())
261 { 239 {
262 params << "resolve" << "--mark" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ") 240 params << "resolve" << "--mark" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
263 241
287 { 265 {
288 if (runningAction == ACT_NONE) 266 if (runningAction == ACT_NONE)
289 { 267 {
290 QStringList params; 268 QStringList params;
291 269
292 QString currentFile;//!!! = hgExp -> getCurrentFileListLine(); 270 // hgExplorer permitted adding "all" files -- I'm not sure
271 // that one is a good idea, let's require the user to select
272
273 QStringList files = hgTabs->getSelectedAddableFiles();
274
275 if (!files.empty()) {
276 params << "add" << "--" << files;
277 runner -> startHgCommand(workFolderPath, params);
278 runningAction = ACT_ADD;
279 }
280 }
281 }
282
283
284 void MainWindow::hgRemove()
285 {
286 if (runningAction == ACT_NONE)
287 {
288 QStringList params;
289
290 QStringList files = hgTabs->getSelectedRemovableFiles();
291
292 //!!! todo: confirmation dialog (with file list in it)
293
294 if (!files.empty()) {
295
296 params << "remove" << "--after" << "--force" << "--" << files;
297 runner -> startHgCommand(workFolderPath, params);
298 runningAction = ACT_REMOVE;
299 }
300
293 /*!!! 301 /*!!!
294 if (areAllSelectedUntracked(hgExp -> workFolderFileList)) 302 QString currentFile;//!!! = hgTabs -> getCurrentFileListLine();
295 { 303
296 //User wants to add selected file(s) 304 if (!currentFile.isEmpty())
297 params << "add" << "--"; 305 {
298 306 if (QMessageBox::Ok == QMessageBox::warning(this, "Remove file", "Really remove file " + currentFile.mid(2) + "?",
299 QList <QListWidgetItem *> selList = hgExp -> workFolderFileList -> selectedItems(); 307 QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel))
300 308 {
301 for (int i = 0; i < selList.size(); ++i) 309 params << "remove" << "--after" << "--force" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
302 { 310
303 QString tmp = selList.at(i)->text(); 311 runner -> startHgCommand(workFolderPath, params);
304 params.append(tmp.mid(2)); 312 runningAction = ACT_REMOVE;
305 } 313 }
306 } 314 }
307 else 315 */
308 { 316 }
309 //Add all untracked files 317 }
310 params << "add"; 318
311 }
312
313 runner -> startHgCommand(workFolderPath, params);
314 runningAction = ACT_ADD;
315 */
316 }
317 }
318 319
319 bool MainWindow::getCommentOrTag(QString& commentOrTag, 320 bool MainWindow::getCommentOrTag(QString& commentOrTag,
320 QString question, 321 QString question,
321 QString dlgTitle) 322 QString dlgTitle)
322 { 323 {
323 bool ok = false; 324 bool ok = false;
324 QString text = QInputDialog::getText(this, dlgTitle, question, QLineEdit::Normal, commentOrTag, &ok); 325 QString text = QInputDialog::getText(this, dlgTitle, question, QLineEdit::Normal, commentOrTag, &ok);
325 commentOrTag = text; 326 commentOrTag = text;
326 return ok; 327 return ok;
327
328 /*!!!
329 int ret;
330
331 QDialog dlg(this);
332
333 QLabel *commentLabel = new QLabel(question);
334 QLineEdit *commentOrTagEdit = new QLineEdit;
335 commentOrTagEdit -> setFixedWidth(400);
336 QHBoxLayout *commentLayout = new QHBoxLayout;
337 commentLayout -> addWidget(commentLabel);
338 commentLayout -> addWidget(commentOrTagEdit);
339
340 QPushButton *btnOk = new QPushButton(tr("Ok"));
341 QPushButton *btnCancel = new QPushButton(tr("Cancel"));
342 QHBoxLayout *btnLayout = new QHBoxLayout;
343 btnLayout -> addWidget(btnOk);
344 btnLayout -> addWidget(btnCancel);
345
346 QVBoxLayout *mainLayout = new QVBoxLayout;
347 mainLayout -> addLayout(commentLayout);
348 mainLayout -> addLayout(btnLayout);
349
350 dlg.setLayout(mainLayout);
351
352 dlg.setWindowTitle(dlgTitle);
353
354 connect(btnOk, SIGNAL(clicked()), &dlg, SLOT(accept()));
355 connect(btnCancel, SIGNAL(clicked()), &dlg, SLOT(reject()));
356
357 ret = dlg.exec();
358 commentOrTag = commentOrTagEdit -> text();
359 return ret;
360 */
361 } 328 }
362 329
363 void MainWindow::hgCommit() 330 void MainWindow::hgCommit()
364 { 331 {
365 //!!! Now that hg actions can be fired asynchronously (e.g. from 332 //!!! Now that hg actions can be fired asynchronously (e.g. from
371 QStringList params; 338 QStringList params;
372 QString comment; 339 QString comment;
373 340
374 if (getCommentOrTag(comment, tr("Comment:"), tr("Save (commit)"))) 341 if (getCommentOrTag(comment, tr("Comment:"), tr("Save (commit)")))
375 { 342 {
376 if (!comment.isEmpty()) 343 //!!! do something more sensible when the comment is empty
377 { 344 // (i.e. tell the user about it?)
378 /*!!! 345
379 if ((justMerged == false) && (areAllSelectedCommitable(hgExp -> workFolderFileList))) 346 QStringList files = hgTabs->getSelectedCommittableFiles();
380 { 347
381 //User wants to commit selected file(s) (and this is not merge commit, which would fail if we selected files) 348 if ((justMerged == false) && //!!! review usage of justMerged
382 params << "commit" << "--message" << comment << "--user" << getUserInfo() << "--"; 349 !files.empty()) {
383 350 // User wants to commit selected file(s) (and this is not merge commit, which would fail if we selected files)
384 QList <QListWidgetItem *> selList = hgExp -> workFolderFileList -> selectedItems(); 351 params << "commit" << "--message" << comment << "--user" << getUserInfo() << "--" << files;
385 for (int i = 0; i < selList.size(); ++i) 352 } else {
386 { 353 // Commit all changes
387 QString tmp = selList.at(i)->text(); 354 params << "commit" << "--message" << comment << "--user" << getUserInfo();
388 params.append(tmp.mid(2)); 355 }
389 } 356
390 } 357 runner -> startHgCommand(workFolderPath, params);
391 else 358 runningAction = ACT_COMMIT;
392 {
393 //Commit all changes
394 params << "commit" << "--message" << comment << "--user" << getUserInfo();
395 }
396
397 runner -> startHgCommand(workFolderPath, params);
398 runningAction = ACT_COMMIT;
399 */
400 }
401 } 359 }
402 } 360 }
403 } 361 }
404 362
405 QString MainWindow::filterTag(QString tag) 363 QString MainWindow::filterTag(QString tag)
473 { 431 {
474 if (runningAction == ACT_NONE) 432 if (runningAction == ACT_NONE)
475 { 433 {
476 QStringList params; 434 QStringList params;
477 /*!!! 435 /*!!!
478 QString currentFile = hgExp -> getCurrentFileListLine(); 436 QString currentFile = hgTabs -> getCurrentFileListLine();
479 437
480 if (!currentFile.isEmpty()) 438 if (!currentFile.isEmpty())
481 { 439 {
482 //Diff parent file against working folder file 440 //Diff parent file against working folder file
483 params << "kdiff3" << "--" << currentFile.mid(2); 441 params << "kdiff3" << "--" << currentFile.mid(2);
511 469
512 //Diff 2 history log versions against each other 470 //Diff 2 history log versions against each other
513 QString revA; 471 QString revA;
514 QString revB; 472 QString revB;
515 /*!!! 473 /*!!!
516 hgExp -> getHistoryDiffRevisions(revA, revB); 474 hgTabs -> getHistoryDiffRevisions(revA, revB);
517 475
518 if ((!revA.isEmpty()) && (!revB.isEmpty())) 476 if ((!revA.isEmpty()) && (!revB.isEmpty()))
519 { 477 {
520 params << "kdiff3" << "--rev" << revA << "--rev" << revB; 478 params << "kdiff3" << "--rev" << revA << "--rev" << revB;
521 runner -> startHgCommand(workFolderPath, params); 479 runner -> startHgCommand(workFolderPath, params);
535 { 493 {
536 if (runningAction == ACT_NONE) 494 if (runningAction == ACT_NONE)
537 { 495 {
538 QStringList params; 496 QStringList params;
539 497
540
541 params << "update"; 498 params << "update";
542
543 499
544 runner -> startHgCommand(workFolderPath, params); 500 runner -> startHgCommand(workFolderPath, params);
545 runningAction = ACT_UPDATE; 501 runningAction = ACT_UPDATE;
546 } 502 }
547 } 503 }
552 if (runningAction == ACT_NONE) 508 if (runningAction == ACT_NONE)
553 { 509 {
554 QStringList params; 510 QStringList params;
555 QString rev; 511 QString rev;
556 /*!!! 512 /*!!!
557 hgExp -> getUpdateToRevRevision(rev); 513 hgTabs -> getUpdateToRevRevision(rev);
558 514
559 hgExp -> setCurrentIndex(WORKTAB); 515 hgTabs -> setCurrentIndex(WORKTAB);
560 enableDisableActions(); 516 enableDisableActions();
561 517
562 params << "update" << "--rev" << rev << "--clean"; 518 params << "update" << "--rev" << rev << "--clean";
563 519
564 runner -> startHgCommand(workFolderPath, params); 520 runner -> startHgCommand(workFolderPath, params);
571 527
572 void MainWindow::hgRevert() 528 void MainWindow::hgRevert()
573 { 529 {
574 if (runningAction == ACT_NONE) 530 if (runningAction == ACT_NONE)
575 { 531 {
576 /*!!! 532 //!!! todo: ask user!
577 QStringList params; 533
578 QString currentFile = hgExp -> getCurrentFileListLine(); 534 QStringList params;
579 535
580 params << "revert" << "--no-backup" << "--" << currentFile.mid(2); 536 QStringList files = hgTabs->getSelectedCommittableFiles();
537
538 if (files.empty()) {
539 params << "revert" << "--no-backup";
540 } else {
541 params << "revert" << "--no-backup" << "--" << files;
542 }
581 543
582 runner -> startHgCommand(workFolderPath, params); 544 runner -> startHgCommand(workFolderPath, params);
583 runningAction = ACT_REVERT; 545 runningAction = ACT_REVERT;
584 */
585 } 546 }
586 } 547 }
587 548
588 void MainWindow::hgRetryMerge() 549 void MainWindow::hgRetryMerge()
589 { 550 {
1020 { 981 {
1021 /*!!! 982 /*!!!
1022 SettingsDialog *settingsDlg = new SettingsDialog(this); 983 SettingsDialog *settingsDlg = new SettingsDialog(this);
1023 settingsDlg->setModal(true); 984 settingsDlg->setModal(true);
1024 settingsDlg->exec(); 985 settingsDlg->exec();
1025 hgExp -> clearLists(); 986 hgTabs -> clearLists();
1026 enableDisableActions(); 987 enableDisableActions();
1027 hgStat(); 988 hgStat();
1028 */ 989 */
1029 } 990 }
1030 991
1065 1026
1066 dlg.exec(); 1027 dlg.exec();
1067 } 1028 }
1068 else 1029 else
1069 { 1030 {
1070 QMessageBox::information(this, tr("HgExplorer"), tr("Mercurial command did not return any output.")); 1031 QMessageBox::information(this, tr("EasyMercurial"), tr("Mercurial command did not return any output."));
1071 } 1032 }
1072 } 1033 }
1073 1034
1074 void MainWindow::updateFileSystemWatcher() 1035 void MainWindow::updateFileSystemWatcher()
1075 { 1036 {
1158 enableDisableActions(); 1119 enableDisableActions();
1159 break; 1120 break;
1160 } 1121 }
1161 1122
1162 case ACT_STAT: 1123 case ACT_STAT:
1163 hgExp -> updateWorkFolderFileList(runner -> getOutput()); 1124 hgTabs -> updateWorkFolderFileList(runner -> getOutput());
1164 updateFileSystemWatcher(); 1125 updateFileSystemWatcher();
1165 break; 1126 break;
1166 1127
1167 case ACT_INCOMING: 1128 case ACT_INCOMING:
1168 case ACT_ANNOTATE: 1129 case ACT_ANNOTATE:
1197 enableDisableActions(); 1158 enableDisableActions();
1198 shouldHgStat = true; 1159 shouldHgStat = true;
1199 break; 1160 break;
1200 1161
1201 case ACT_LOG: 1162 case ACT_LOG:
1202 hgExp -> updateLocalRepoHgLogList(runner -> getOutput()); 1163 hgTabs -> updateLocalRepoHgLogList(runner -> getOutput());
1203 break; 1164 break;
1204 1165
1205 case ACT_PARENTS: 1166 case ACT_PARENTS:
1206 { 1167 {
1207 //!!! hgExp -> updateLocalRepoParentsList(runner -> getOutput()); 1168 //!!! hgTabs -> updateLocalRepoParentsList(runner -> getOutput());
1208 } 1169 }
1209 break; 1170 break;
1210 1171
1211 case ACT_HEADS: 1172 case ACT_HEADS:
1212 { 1173 {
1213 QString stdOut = runner -> getOutput(); 1174 QString stdOut = runner -> getOutput();
1214 //!!! hgExp -> updateLocalRepoHeadsList(stdOut); 1175 //!!! hgTabs -> updateLocalRepoHeadsList(stdOut);
1215 } 1176 }
1216 break; 1177 break;
1217 1178
1218 case ACT_REMOVE: 1179 case ACT_REMOVE:
1219 case ACT_ADD: 1180 case ACT_ADD:
1305 connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); 1266 connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
1306 connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); 1267 connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
1307 connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); 1268 connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
1308 1269
1309 connect(hgStatAct, SIGNAL(triggered()), this, SLOT(hgPaths())); 1270 connect(hgStatAct, SIGNAL(triggered()), this, SLOT(hgPaths()));
1310 connect(hgExp, SIGNAL(workFolderViewTypesChanged()), this, SLOT(hgPaths())); 1271 connect(hgTabs, SIGNAL(workFolderViewTypesChanged()), this, SLOT(hgPaths()));
1311 connect(hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove())); 1272 connect(hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove()));
1312 connect(hgAddAct, SIGNAL(triggered()), this, SLOT(hgAdd())); 1273 connect(hgAddAct, SIGNAL(triggered()), this, SLOT(hgAdd()));
1313 connect(hgCommitAct, SIGNAL(triggered()), this, SLOT(hgCommit())); 1274 connect(hgCommitAct, SIGNAL(triggered()), this, SLOT(hgCommit()));
1314 connect(hgFileDiffAct, SIGNAL(triggered()), this, SLOT(hgFileDiff())); 1275 connect(hgFileDiffAct, SIGNAL(triggered()), this, SLOT(hgFileDiff()));
1315 connect(hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff())); 1276 connect(hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff()));
1328 connect(hgCloneFromRemoteAct, SIGNAL(triggered()), this, SLOT(hgCloneFromRemote())); 1289 connect(hgCloneFromRemoteAct, SIGNAL(triggered()), this, SLOT(hgCloneFromRemote()));
1329 connect(hgIncomingAct, SIGNAL(triggered()), this, SLOT(hgIncoming())); 1290 connect(hgIncomingAct, SIGNAL(triggered()), this, SLOT(hgIncoming()));
1330 connect(hgPullAct, SIGNAL(triggered()), this, SLOT(hgPull())); 1291 connect(hgPullAct, SIGNAL(triggered()), this, SLOT(hgPull()));
1331 connect(hgPushAct, SIGNAL(triggered()), this, SLOT(hgPush())); 1292 connect(hgPushAct, SIGNAL(triggered()), this, SLOT(hgPush()));
1332 1293
1333 connect(hgExp, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); 1294 connect(hgTabs, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
1334 1295
1335 connect(hgUpdateToRevAct, SIGNAL(triggered()), this, SLOT(hgUpdateToRev())); 1296 connect(hgUpdateToRevAct, SIGNAL(triggered()), this, SLOT(hgUpdateToRev()));
1336 connect(hgAnnotateAct, SIGNAL(triggered()), this, SLOT(hgAnnotate())); 1297 connect(hgAnnotateAct, SIGNAL(triggered()), this, SLOT(hgAnnotate()));
1337 connect(hgResolveListAct, SIGNAL(triggered()), this, SLOT(hgResolveList())); 1298 connect(hgResolveListAct, SIGNAL(triggered()), this, SLOT(hgResolveList()));
1338 connect(hgResolveMarkAct, SIGNAL(triggered()), this, SLOT(hgResolveMark())); 1299 connect(hgResolveMarkAct, SIGNAL(triggered()), this, SLOT(hgResolveMark()));
1404 hgAnnotateAct -> setEnabled(localRepoActionsEnabled); 1365 hgAnnotateAct -> setEnabled(localRepoActionsEnabled);
1405 hgServeAct -> setEnabled(localRepoActionsEnabled); 1366 hgServeAct -> setEnabled(localRepoActionsEnabled);
1406 hgTagAct -> setEnabled(localRepoActionsEnabled); 1367 hgTagAct -> setEnabled(localRepoActionsEnabled);
1407 hgIgnoreAct -> setEnabled(localRepoActionsEnabled); 1368 hgIgnoreAct -> setEnabled(localRepoActionsEnabled);
1408 1369
1409 //!!!hgExp -> enableDisableOtherTabs(tabPage); 1370 //!!!hgTabs -> enableDisableOtherTabs(tabPage);
1410 1371
1411 DEBUG << "localRepoActionsEnabled = " << localRepoActionsEnabled << endl; 1372 DEBUG << "localRepoActionsEnabled = " << localRepoActionsEnabled << endl;
1412 DEBUG << "canCommit = " << hgExp->canCommit() << endl; 1373 DEBUG << "canCommit = " << hgTabs->canCommit() << endl;
1413 1374
1414 //!!! new stuff: 1375 //!!! new stuff:
1415 hgAddAct->setEnabled(localRepoActionsEnabled && hgExp->canAdd()); 1376 hgAddAct->setEnabled(localRepoActionsEnabled && hgTabs->canAdd());
1416 hgRemoveAct->setEnabled(localRepoActionsEnabled && hgExp->canRemove()); 1377 hgRemoveAct->setEnabled(localRepoActionsEnabled && hgTabs->canRemove());
1417 hgCommitAct->setEnabled(localRepoActionsEnabled && hgExp->canCommit()); 1378 hgCommitAct->setEnabled(localRepoActionsEnabled && hgTabs->canCommit());
1418 hgRevertAct->setEnabled(localRepoActionsEnabled && hgExp->canCommit()); 1379 hgRevertAct->setEnabled(localRepoActionsEnabled && hgTabs->canCommit());
1419 hgFolderDiffAct->setEnabled(localRepoActionsEnabled && hgExp->canDoDiff()); 1380 hgFolderDiffAct->setEnabled(localRepoActionsEnabled && hgTabs->canDoDiff());
1420 1381
1421 /*!!! 1382 /*!!!
1422 int added, modified, removed, notTracked, selected, selectedAdded, selectedModified, selectedRemoved, selectedNotTracked; 1383 int added, modified, removed, notTracked, selected, selectedAdded, selectedModified, selectedRemoved, selectedNotTracked;
1423 1384
1424 countModifications(hgExp -> workFolderFileList, 1385 countModifications(hgTabs -> workFolderFileList,
1425 added, modified, removed, notTracked, 1386 added, modified, removed, notTracked,
1426 selected, 1387 selected,
1427 selectedAdded, selectedModified, selectedRemoved, selectedNotTracked); 1388 selectedAdded, selectedModified, selectedRemoved, selectedNotTracked);
1428 1389
1429 if (tabPage == WORKTAB) 1390 if (tabPage == WORKTAB)
1454 if (modified == 0) 1415 if (modified == 0)
1455 { 1416 {
1456 hgFolderDiffAct -> setEnabled(false); 1417 hgFolderDiffAct -> setEnabled(false);
1457 } 1418 }
1458 1419
1459 if (!isSelectedModified(hgExp -> workFolderFileList)) 1420 if (!isSelectedModified(hgTabs -> workFolderFileList))
1460 { 1421 {
1461 hgFileDiffAct -> setEnabled(false); 1422 hgFileDiffAct -> setEnabled(false);
1462 hgRevertAct -> setEnabled(false); 1423 hgRevertAct -> setEnabled(false);
1463 } 1424 }
1464 1425
1466 if (notTracked == 0) 1427 if (notTracked == 0)
1467 { 1428 {
1468 hgAddAct -> setEnabled(false); 1429 hgAddAct -> setEnabled(false);
1469 } 1430 }
1470 1431
1471 if (!isSelectedDeletable(hgExp -> workFolderFileList)) 1432 if (!isSelectedDeletable(hgTabs -> workFolderFileList))
1472 { 1433 {
1473 hgRemoveAct -> setEnabled(false); 1434 hgRemoveAct -> setEnabled(false);
1474 } 1435 }
1475 1436
1476 hgResolveListAct -> setEnabled(true); 1437 hgResolveListAct -> setEnabled(true);
1477 1438
1478 if (hgExp -> localRepoHeadsList->count() < 2) 1439 if (hgTabs -> localRepoHeadsList->count() < 2)
1479 { 1440 {
1480 hgMergeAct -> setEnabled(false); 1441 hgMergeAct -> setEnabled(false);
1481 hgRetryMergeAct -> setEnabled(false); 1442 hgRetryMergeAct -> setEnabled(false);
1482 } 1443 }
1483 1444
1484 if (hgExp -> localRepoHeadsList->count() < 1) 1445 if (hgTabs -> localRepoHeadsList->count() < 1)
1485 { 1446 {
1486 hgTagAct -> setEnabled(false); 1447 hgTagAct -> setEnabled(false);
1487 } 1448 }
1488 1449
1489 QString currentFile = hgExp -> getCurrentFileListLine(); 1450 QString currentFile = hgTabs -> getCurrentFileListLine();
1490 if (!currentFile.isEmpty()) 1451 if (!currentFile.isEmpty())
1491 { 1452 {
1492 hgAnnotateAct -> setEnabled(true); 1453 hgAnnotateAct -> setEnabled(true);
1493 hgResolveMarkAct -> setEnabled(true); 1454 hgResolveMarkAct -> setEnabled(true);
1494 } 1455 }
1499 } 1460 }
1500 } 1461 }
1501 } 1462 }
1502 else 1463 else
1503 { 1464 {
1504 QList <QListWidgetItem *> headSelList = hgExp -> localRepoHeadsList->selectedItems(); 1465 QList <QListWidgetItem *> headSelList = hgTabs -> localRepoHeadsList->selectedItems();
1505 QList <QListWidgetItem *> historySelList = hgExp -> localRepoHgLogList->selectedItems(); 1466 QList <QListWidgetItem *> historySelList = hgTabs -> localRepoHgLogList->selectedItems();
1506 1467
1507 if ((historySelList.count() == 2) || (headSelList.count() == 2)) 1468 if ((historySelList.count() == 2) || (headSelList.count() == 2))
1508 { 1469 {
1509 hgChgSetDiffAct -> setEnabled(true); 1470 hgChgSetDiffAct -> setEnabled(true);
1510 } 1471 }
1733 settings.setValue("pos", pos()); 1694 settings.setValue("pos", pos());
1734 settings.setValue("size", size()); 1695 settings.setValue("size", size());
1735 settings.setValue("remoterepopath", remoteRepoPath); 1696 settings.setValue("remoterepopath", remoteRepoPath);
1736 settings.setValue("workfolderpath", workFolderPath); 1697 settings.setValue("workfolderpath", workFolderPath);
1737 settings.setValue("firststart", firstStart); 1698 settings.setValue("firststart", firstStart);
1738 //!!!settings.setValue("viewFileTypes", hgExp -> getFileTypesBits()); 1699 //!!!settings.setValue("viewFileTypes", hgTabs -> getFileTypesBits());
1739 } 1700 }
1740 1701
1741 1702
1742 1703
1743 1704