comparison mainwindow.cpp @ 172:b6dd1ee0e486

* Fix failure to recognise local uncommitted changes when an untracked file was selected * Win32: Look in installed location (currently just the location of the present .exe) for executables as well as in path * Win32: Search for easyhg extension in same way as executables * Win32: Set installed location to path when running hg commands (for dependent DLLs)
author Chris Cannam
date Wed, 15 Dec 2010 22:07:31 +0000
parents c7fa56707ae9
children a6d336837ebe
comparison
equal deleted inserted replaced
171:aab308a3b304 172:b6dd1ee0e486
39 #include "logparser.h" 39 #include "logparser.h"
40 #include "confirmcommentdialog.h" 40 #include "confirmcommentdialog.h"
41 #include "incomingdialog.h" 41 #include "incomingdialog.h"
42 42
43 43
44 MainWindow::MainWindow() 44 MainWindow::MainWindow(QString myDirPath) :
45 m_myDirPath(myDirPath)
45 { 46 {
46 QString wndTitle; 47 QString wndTitle;
47 48
48 fsWatcher = 0; 49 fsWatcher = 0;
49 commitsSincePush = 0; 50 commitsSincePush = 0;
52 createActions(); 53 createActions();
53 createMenus(); 54 createMenus();
54 createToolBars(); 55 createToolBars();
55 createStatusBar(); 56 createStatusBar();
56 57
57 runner = new HgRunner(this); 58 runner = new HgRunner(myDirPath, this);
58 connect(runner, SIGNAL(commandCompleted(HgAction, QString)), 59 connect(runner, SIGNAL(commandCompleted(HgAction, QString)),
59 this, SLOT(commandCompleted(HgAction, QString))); 60 this, SLOT(commandCompleted(HgAction, QString)));
60 connect(runner, SIGNAL(commandFailed(HgAction, QString)), 61 connect(runner, SIGNAL(commandFailed(HgAction, QString)),
61 this, SLOT(commandFailed(HgAction, QString))); 62 this, SLOT(commandFailed(HgAction, QString)));
62 statusBar()->addPermanentWidget(runner); 63 statusBar()->addPermanentWidget(runner);
397 if (diff == "") { 398 if (diff == "") {
398 QStringList bases; 399 QStringList bases;
399 bases << "opendiff" << "kompare" << "kdiff3" << "meld"; 400 bases << "opendiff" << "kompare" << "kdiff3" << "meld";
400 bool found = false; 401 bool found = false;
401 foreach (QString base, bases) { 402 foreach (QString base, bases) {
402 diff = findExecutable(base); 403 diff = findInPath(base, m_myDirPath, true);
403 if (diff != base) { 404 if (diff != base) {
404 found = true; 405 found = true;
405 break; 406 break;
406 } 407 }
407 } 408 }
421 if (merge == "") { 422 if (merge == "") {
422 QStringList bases; 423 QStringList bases;
423 bases << "fmdiff3" << "meld" << "diffuse" << "kdiff3"; 424 bases << "fmdiff3" << "meld" << "diffuse" << "kdiff3";
424 bool found = false; 425 bool found = false;
425 foreach (QString base, bases) { 426 foreach (QString base, bases) {
426 merge = findExecutable(base); 427 merge = findInPath(base, m_myDirPath, true);
427 if (merge != base) { 428 if (merge != base) {
428 found = true; 429 found = true;
429 break; 430 break;
430 } 431 }
431 } 432 }
1568 1569
1569 connect(hgIncomingAct, SIGNAL(triggered()), this, SLOT(hgIncoming())); 1570 connect(hgIncomingAct, SIGNAL(triggered()), this, SLOT(hgIncoming()));
1570 connect(hgPullAct, SIGNAL(triggered()), this, SLOT(hgPull())); 1571 connect(hgPullAct, SIGNAL(triggered()), this, SLOT(hgPull()));
1571 connect(hgPushAct, SIGNAL(triggered()), this, SLOT(hgPush())); 1572 connect(hgPushAct, SIGNAL(triggered()), this, SLOT(hgPush()));
1572 1573
1573 // connect(hgTabs, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
1574
1575 // connect(hgUpdateToRevAct, SIGNAL(triggered()), this, SLOT(hgUpdateToRev()));
1576 connect(hgAnnotateAct, SIGNAL(triggered()), this, SLOT(hgAnnotate())); 1574 connect(hgAnnotateAct, SIGNAL(triggered()), this, SLOT(hgAnnotate()));
1577 connect(hgServeAct, SIGNAL(triggered()), this, SLOT(hgServe())); 1575 connect(hgServeAct, SIGNAL(triggered()), this, SLOT(hgServe()));
1578 connect(clearSelectionsAct, SIGNAL(triggered()), this, SLOT(clearSelections())); 1576 connect(clearSelectionsAct, SIGNAL(triggered()), this, SLOT(clearSelections()));
1579 } 1577 }
1580 1578
1606 1604
1607 connect(hgTabs, SIGNAL(tag(QString)), 1605 connect(hgTabs, SIGNAL(tag(QString)),
1608 this, SLOT(hgTag(QString))); 1606 this, SLOT(hgTag(QString)));
1609 } 1607 }
1610 1608
1611 /*!!!
1612 void MainWindow::tabChanged(int currTab)
1613 {
1614 tabPage = currTab;
1615
1616 }
1617 */
1618 void MainWindow::enableDisableActions() 1609 void MainWindow::enableDisableActions()
1619 { 1610 {
1620 DEBUG << "MainWindow::enableDisableActions" << endl; 1611 DEBUG << "MainWindow::enableDisableActions" << endl;
1621 1612
1622 //!!! should also do things like set the status texts for the 1613 //!!! should also do things like set the status texts for the
1723 } 1714 }
1724 1715
1725 hgMergeAct->setEnabled(localRepoActionsEnabled && 1716 hgMergeAct->setEnabled(localRepoActionsEnabled &&
1726 (canMerge || hgTabs->canResolve())); 1717 (canMerge || hgTabs->canResolve()));
1727 hgUpdateAct->setEnabled(localRepoActionsEnabled && 1718 hgUpdateAct->setEnabled(localRepoActionsEnabled &&
1728 (canUpdate && !hgTabs->canRevert())); 1719 (canUpdate && !hgTabs->haveChangesToCommit()));
1729 1720
1730 // Set the state field on the file status widget 1721 // Set the state field on the file status widget
1731 1722
1732 QString branchText; 1723 QString branchText;
1733 if (currentBranch == "" || currentBranch == "default") { 1724 if (currentBranch == "" || currentBranch == "default") {
1743 } else if (!hgTabs->getAllUnresolvedFiles().empty()) { 1734 } else if (!hgTabs->getAllUnresolvedFiles().empty()) {
1744 hgTabs->setState(tr("Have unresolved files following merge on %1").arg(branchText)); 1735 hgTabs->setState(tr("Have unresolved files following merge on %1").arg(branchText));
1745 } else if (haveMerge) { 1736 } else if (haveMerge) {
1746 hgTabs->setState(tr("Have merged but not yet committed on %1").arg(branchText)); 1737 hgTabs->setState(tr("Have merged but not yet committed on %1").arg(branchText));
1747 } else if (canUpdate) { 1738 } else if (canUpdate) {
1748 if (hgTabs->canRevert()) { 1739 if (hgTabs->haveChangesToCommit()) {
1749 // have uncommitted changes 1740 // have uncommitted changes
1750 hgTabs->setState(tr("On %1. Not at the head of the branch").arg(branchText)); 1741 hgTabs->setState(tr("On %1. Not at the head of the branch").arg(branchText));
1751 } else { 1742 } else {
1752 // no uncommitted changes 1743 // no uncommitted changes
1753 hgTabs->setState(tr("On %1. Not at the head of the branch: consider updating").arg(branchText)); 1744 hgTabs->setState(tr("On %1. Not at the head of the branch: consider updating").arg(branchText));