comparison mainwindow.cpp @ 169:c7fa56707ae9

* Status text updates
author Chris Cannam
date Tue, 14 Dec 2010 20:36:30 +0000
parents 4bad3c5c053a
children b6dd1ee0e486
comparison
equal deleted inserted replaced
168:4bad3c5c053a 169:c7fa56707ae9
1550 1550
1551 void MainWindow::connectActions() 1551 void MainWindow::connectActions()
1552 { 1552 {
1553 connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); 1553 connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
1554 connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); 1554 connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
1555 connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
1556 1555
1557 connect(hgRefreshAct, SIGNAL(triggered()), this, SLOT(hgRefresh())); 1556 connect(hgRefreshAct, SIGNAL(triggered()), this, SLOT(hgRefresh()));
1558 connect(hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove())); 1557 connect(hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove()));
1559 connect(hgAddAct, SIGNAL(triggered()), this, SLOT(hgAdd())); 1558 connect(hgAddAct, SIGNAL(triggered()), this, SLOT(hgAdd()));
1560 connect(hgCommitAct, SIGNAL(triggered()), this, SLOT(hgCommit())); 1559 connect(hgCommitAct, SIGNAL(triggered()), this, SLOT(hgCommit()));
1561 connect(hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff())); 1560 connect(hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff()));
1562 // connect(hgChgSetDiffAct, SIGNAL(triggered()), this, SLOT(hgChgSetDiff()));
1563 connect(hgUpdateAct, SIGNAL(triggered()), this, SLOT(hgUpdate())); 1561 connect(hgUpdateAct, SIGNAL(triggered()), this, SLOT(hgUpdate()));
1564 connect(hgRevertAct, SIGNAL(triggered()), this, SLOT(hgRevert())); 1562 connect(hgRevertAct, SIGNAL(triggered()), this, SLOT(hgRevert()));
1565 connect(hgMergeAct, SIGNAL(triggered()), this, SLOT(hgMerge())); 1563 connect(hgMergeAct, SIGNAL(triggered()), this, SLOT(hgMerge()));
1566 // connect(hgTagAct, SIGNAL(triggered()), this, SLOT(hgTag()));
1567 connect(hgIgnoreAct, SIGNAL(triggered()), this, SLOT(hgIgnore())); 1564 connect(hgIgnoreAct, SIGNAL(triggered()), this, SLOT(hgIgnore()));
1568 1565
1569 connect(settingsAct, SIGNAL(triggered()), this, SLOT(settings())); 1566 connect(settingsAct, SIGNAL(triggered()), this, SLOT(settings()));
1570 connect(openAct, SIGNAL(triggered()), this, SLOT(open())); 1567 connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
1571 1568
1572 connect(hgInitAct, SIGNAL(triggered()), this, SLOT(hgInit()));
1573 connect(hgCloneFromRemoteAct, SIGNAL(triggered()), this, SLOT(hgCloneFromRemote()));
1574 connect(hgIncomingAct, SIGNAL(triggered()), this, SLOT(hgIncoming())); 1569 connect(hgIncomingAct, SIGNAL(triggered()), this, SLOT(hgIncoming()));
1575 connect(hgPullAct, SIGNAL(triggered()), this, SLOT(hgPull())); 1570 connect(hgPullAct, SIGNAL(triggered()), this, SLOT(hgPull()));
1576 connect(hgPushAct, SIGNAL(triggered()), this, SLOT(hgPush())); 1571 connect(hgPushAct, SIGNAL(triggered()), this, SLOT(hgPush()));
1577 1572
1578 // connect(hgTabs, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); 1573 // connect(hgTabs, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
1653 if (!localRepoDir.exists(workFolderPath + "/.hg")) { 1648 if (!localRepoDir.exists(workFolderPath + "/.hg")) {
1654 localRepoActionsEnabled = false; 1649 localRepoActionsEnabled = false;
1655 localRepoExist = false; 1650 localRepoExist = false;
1656 } 1651 }
1657 1652
1658 hgCloneFromRemoteAct -> setEnabled(remoteRepoActionsEnabled);
1659 hgIncomingAct -> setEnabled(remoteRepoActionsEnabled && remoteRepoActionsEnabled); 1653 hgIncomingAct -> setEnabled(remoteRepoActionsEnabled && remoteRepoActionsEnabled);
1660 hgPullAct -> setEnabled(remoteRepoActionsEnabled && remoteRepoActionsEnabled); 1654 hgPullAct -> setEnabled(remoteRepoActionsEnabled && remoteRepoActionsEnabled);
1661 hgPushAct -> setEnabled(remoteRepoActionsEnabled && remoteRepoActionsEnabled); 1655 hgPushAct -> setEnabled(remoteRepoActionsEnabled && remoteRepoActionsEnabled);
1662 /* 1656
1663 if (tabPage != WORKTAB)
1664 {
1665 localRepoActionsEnabled = false;
1666 }
1667 */
1668 bool haveDiff = (diffBinaryName != ""); 1657 bool haveDiff = (diffBinaryName != "");
1669 1658
1670 hgInitAct -> setEnabled((localRepoExist == false) && (workFolderExist==true));
1671 hgRefreshAct -> setEnabled(localRepoActionsEnabled); 1659 hgRefreshAct -> setEnabled(localRepoActionsEnabled);
1672 hgFolderDiffAct -> setEnabled(localRepoActionsEnabled && haveDiff); 1660 hgFolderDiffAct -> setEnabled(localRepoActionsEnabled && haveDiff);
1673 hgRevertAct -> setEnabled(localRepoActionsEnabled); 1661 hgRevertAct -> setEnabled(localRepoActionsEnabled);
1674 hgAddAct -> setEnabled(localRepoActionsEnabled); 1662 hgAddAct -> setEnabled(localRepoActionsEnabled);
1675 hgRemoveAct -> setEnabled(localRepoActionsEnabled); 1663 hgRemoveAct -> setEnabled(localRepoActionsEnabled);
1676 hgUpdateAct -> setEnabled(localRepoActionsEnabled); 1664 hgUpdateAct -> setEnabled(localRepoActionsEnabled);
1677 hgCommitAct -> setEnabled(localRepoActionsEnabled); 1665 hgCommitAct -> setEnabled(localRepoActionsEnabled);
1678 hgMergeAct -> setEnabled(localRepoActionsEnabled); 1666 hgMergeAct -> setEnabled(localRepoActionsEnabled);
1679 hgAnnotateAct -> setEnabled(localRepoActionsEnabled); 1667 hgAnnotateAct -> setEnabled(localRepoActionsEnabled);
1680 hgServeAct -> setEnabled(localRepoActionsEnabled); 1668 hgServeAct -> setEnabled(localRepoActionsEnabled);
1681 hgTagAct -> setEnabled(localRepoActionsEnabled);
1682 hgIgnoreAct -> setEnabled(localRepoActionsEnabled); 1669 hgIgnoreAct -> setEnabled(localRepoActionsEnabled);
1683
1684 //!!!hgTabs -> enableDisableOtherTabs(tabPage);
1685 1670
1686 DEBUG << "localRepoActionsEnabled = " << localRepoActionsEnabled << endl; 1671 DEBUG << "localRepoActionsEnabled = " << localRepoActionsEnabled << endl;
1687 DEBUG << "canCommit = " << hgTabs->canCommit() << endl; 1672 DEBUG << "canCommit = " << hgTabs->canCommit() << endl;
1688 1673
1689 //!!! new stuff:
1690 hgAddAct->setEnabled(localRepoActionsEnabled && hgTabs->canAdd()); 1674 hgAddAct->setEnabled(localRepoActionsEnabled && hgTabs->canAdd());
1691 hgRemoveAct->setEnabled(localRepoActionsEnabled && hgTabs->canRemove()); 1675 hgRemoveAct->setEnabled(localRepoActionsEnabled && hgTabs->canRemove());
1692 hgCommitAct->setEnabled(localRepoActionsEnabled && hgTabs->canCommit()); 1676 hgCommitAct->setEnabled(localRepoActionsEnabled && hgTabs->canCommit());
1693 hgRevertAct->setEnabled(localRepoActionsEnabled && hgTabs->canRevert()); 1677 hgRevertAct->setEnabled(localRepoActionsEnabled && hgTabs->canRevert());
1694 hgFolderDiffAct->setEnabled(localRepoActionsEnabled && hgTabs->canDiff()); 1678 hgFolderDiffAct->setEnabled(localRepoActionsEnabled && hgTabs->canDiff());
1749 if (currentBranch == "" || currentBranch == "default") { 1733 if (currentBranch == "" || currentBranch == "default") {
1750 branchText = tr("the default branch"); 1734 branchText = tr("the default branch");
1751 } else { 1735 } else {
1752 branchText = tr("branch \"%1\"").arg(currentBranch); 1736 branchText = tr("branch \"%1\"").arg(currentBranch);
1753 } 1737 }
1754
1755 //!!! Want "merge failed" report
1756 1738
1757 if (emptyRepo) { 1739 if (emptyRepo) {
1758 hgTabs->setState(tr("Nothing committed to this repository yet")); 1740 hgTabs->setState(tr("Nothing committed to this repository yet"));
1759 } else if (canMerge) { 1741 } else if (canMerge) {
1760 hgTabs->setState(tr("<b>Awaiting merge</b> on %1").arg(branchText)); 1742 hgTabs->setState(tr("<b>Awaiting merge</b> on %1").arg(branchText));
1778 } 1760 }
1779 1761
1780 void MainWindow::createActions() 1762 void MainWindow::createActions()
1781 { 1763 {
1782 //File actions 1764 //File actions
1783 hgInitAct = new QAction(tr("Init local repository"), this);
1784 hgInitAct->setStatusTip(tr("Create an empty local repository in selected folder"));
1785
1786 hgCloneFromRemoteAct = new QAction(tr("Clone from remote"), this);
1787 hgCloneFromRemoteAct->setStatusTip(tr("Clone from remote repository into local repository in selected folder"));
1788
1789 openAct = new QAction(QIcon(":/images/fileopen.png"), tr("Open..."), this); 1765 openAct = new QAction(QIcon(":/images/fileopen.png"), tr("Open..."), this);
1790 openAct -> setStatusTip(tr("Open repository")); 1766 openAct -> setStatusTip(tr("Open a repository"));
1791 openAct -> setIconVisibleInMenu(true);
1792 1767
1793 settingsAct = new QAction(QIcon(":/images/settings.png"), tr("Settings..."), this); 1768 settingsAct = new QAction(QIcon(":/images/settings.png"), tr("Settings..."), this);
1794 settingsAct -> setStatusTip(tr("View and change application settings")); 1769 settingsAct -> setStatusTip(tr("View and change application settings"));
1795 settingsAct -> setIconVisibleInMenu(true); 1770
1796 1771 exitAct = new QAction(QIcon(":/images/exit.png"), tr("Quit"), this);
1797 exitAct = new QAction(QIcon(":/images/exit.png"), tr("Exit"), this);
1798 exitAct->setShortcuts(QKeySequence::Quit); 1772 exitAct->setShortcuts(QKeySequence::Quit);
1799 exitAct->setStatusTip(tr("Exit application")); 1773 exitAct->setStatusTip(tr("Quit EasyMercurial"));
1800 exitAct -> setIconVisibleInMenu(true);
1801 1774
1802 //Repository actions 1775 //Repository actions
1803 hgRefreshAct = new QAction(QIcon(":/images/status.png"), tr("Refresh"), this); 1776 hgRefreshAct = new QAction(QIcon(":/images/status.png"), tr("Refresh"), this);
1804 hgRefreshAct->setStatusTip(tr("Refresh (info of) status of workfolder files")); 1777 hgRefreshAct->setStatusTip(tr("Update the window to show the current state of the working folder"));
1805 1778
1806 hgIncomingAct = new QAction(QIcon(":/images/incoming.png"), tr("Preview"), this); 1779 hgIncomingAct = new QAction(QIcon(":/images/incoming.png"), tr("Preview"), this);
1807 hgIncomingAct -> setStatusTip(tr("View info of changesets incoming to us from remote repository (on pull operation)")); 1780 hgIncomingAct -> setStatusTip(tr("See what changes are available in the remote repository waiting to be pulled"));
1808 1781
1809 hgPullAct = new QAction(QIcon(":/images/pull.png"), tr("Pull"), this); 1782 hgPullAct = new QAction(QIcon(":/images/pull.png"), tr("Pull"), this);
1810 hgPullAct -> setStatusTip(tr("Pull changesets from remote repository to local repository")); 1783 hgPullAct -> setStatusTip(tr("Pull changes from the remote repository to the local repository"));
1811 1784
1812 hgPushAct = new QAction(QIcon(":/images/push.png"), tr("Push"), this); 1785 hgPushAct = new QAction(QIcon(":/images/push.png"), tr("Push"), this);
1813 hgPushAct->setStatusTip(tr("Push local changesets to remote repository")); 1786 hgPushAct->setStatusTip(tr("Push changes from the local repository to the remote repository"));
1814 1787
1815 //Workfolder actions 1788 //Workfolder actions
1816 hgFolderDiffAct = new QAction(QIcon(":/images/folderdiff.png"), tr("Diff"), this); 1789 hgFolderDiffAct = new QAction(QIcon(":/images/folderdiff.png"), tr("Diff"), this);
1817 hgFolderDiffAct->setStatusTip(tr("Folderdiff: View all differences between working folder files and local repository files")); 1790 hgFolderDiffAct->setStatusTip(tr("See what has changed in the working folder compared with the last committed state"));
1818
1819 hgChgSetDiffAct = new QAction(QIcon(":/images/chgsetdiff.png"), tr("View changesetdiff"), this);
1820 hgChgSetDiffAct->setStatusTip(tr("Change set diff: View differences between all files of 2 repository changesets"));
1821 1791
1822 hgRevertAct = new QAction(QIcon(":/images/undo.png"), tr("Revert"), this); 1792 hgRevertAct = new QAction(QIcon(":/images/undo.png"), tr("Revert"), this);
1823 hgRevertAct->setStatusTip(tr("Undo selected working folder file changes (return to local repository version)")); 1793 hgRevertAct->setStatusTip(tr("Throw away your changes and return to the last committed state"));
1824 1794
1825 hgAddAct = new QAction(QIcon(":/images/add.png"), tr("Add"), this); 1795 hgAddAct = new QAction(QIcon(":/images/add.png"), tr("Add"), this);
1826 hgAddAct -> setStatusTip(tr("Add working folder file(s) (selected or all yet untracked) to local repository (on next commit)")); 1796 hgAddAct -> setStatusTip(tr("Mark the selected file(s) to be added on the next commit"));
1827 1797
1798 //!!! needs to be modified for number
1828 hgRemoveAct = new QAction(QIcon(":/images/remove.png"), tr("Remove"), this); 1799 hgRemoveAct = new QAction(QIcon(":/images/remove.png"), tr("Remove"), this);
1829 hgRemoveAct -> setStatusTip(tr("Remove selected working folder file from local repository (on next commit)")); 1800 hgRemoveAct -> setStatusTip(tr("Mark the selected file(s) to be removed from version control on the next commit"));
1830 1801
1831 hgUpdateAct = new QAction(QIcon(":/images/update.png"), tr("Update"), this); 1802 hgUpdateAct = new QAction(QIcon(":/images/update.png"), tr("Update"), this);
1832 hgUpdateAct->setStatusTip(tr("Update working folder from local repository")); 1803 hgUpdateAct->setStatusTip(tr("Update the working folder to the head of the current repository branch"));
1833 1804
1805 //!!! needs to be modified when files selected
1834 hgCommitAct = new QAction(QIcon(":/images/commit.png"), tr("Commit"), this); 1806 hgCommitAct = new QAction(QIcon(":/images/commit.png"), tr("Commit"), this);
1835 hgCommitAct->setStatusTip(tr("Save selected file(s) or all changed files in working folder (and all subfolders) to local repository")); 1807 hgCommitAct->setStatusTip(tr("Commit your changes to the local repository"));
1836 1808
1837 hgMergeAct = new QAction(QIcon(":/images/merge.png"), tr("Merge"), this); 1809 hgMergeAct = new QAction(QIcon(":/images/merge.png"), tr("Merge"), this);
1838 hgMergeAct->setStatusTip(tr("Merge two local repository changesets to working folder")); 1810 hgMergeAct->setStatusTip(tr("Merge the two independent sets of changes in the local repository into the working folder"));
1839 1811
1840 //Advanced actions 1812 //Advanced actions
1841 /* hgUpdateToRevAct = new QAction(tr("Update to revision"), this); 1813 //!!! needs to be modified for number
1842 hgUpdateToRevAct -> setStatusTip(tr("Update working folder to version selected from history list"));
1843 */
1844 hgAnnotateAct = new QAction(tr("Annotate"), this); 1814 hgAnnotateAct = new QAction(tr("Annotate"), this);
1845 hgAnnotateAct -> setStatusTip(tr("Show line-by-line version information for selected file")); 1815 hgAnnotateAct -> setStatusTip(tr("Show line-by-line version information for selected file"));
1846 1816
1847 hgTagAct = new QAction(tr("Tag revision"), this);
1848 hgTagAct -> setStatusTip(tr("Give decsriptive name (tag) to current workfolder parent revision."));
1849
1850 hgIgnoreAct = new QAction(tr("Edit .hgignore"), this); 1817 hgIgnoreAct = new QAction(tr("Edit .hgignore"), this);
1851 hgIgnoreAct -> setStatusTip(tr("Edit .hgignore file (file contains names of files that should be ignored by mercurial)")); 1818 hgIgnoreAct -> setStatusTip(tr("Edit the .hgignore file, containing the names of files that should be ignored by Mercurial"));
1852 1819
1853 hgServeAct = new QAction(tr("Serve (via http)"), this); 1820 hgServeAct = new QAction(tr("Serve (via http)"), this);
1854 hgServeAct -> setStatusTip(tr("Serve local repository via http for workgroup access")); 1821 hgServeAct -> setStatusTip(tr("Serve local repository via http for workgroup access"));
1855 1822
1856 //Help actions 1823 //Help actions
1857 aboutAct = new QAction(tr("About"), this); 1824 aboutAct = new QAction(tr("About"), this);
1858 aboutAct->setStatusTip(tr("Show the application's About box"));
1859
1860 aboutQtAct = new QAction(tr("About Qt"), this);
1861 aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
1862 1825
1863 // Miscellaneous 1826 // Miscellaneous
1864 clearSelectionsAct = new QAction(tr("Clear selections"), this); 1827 clearSelectionsAct = new QAction(tr("Clear selections"), this);
1865 clearSelectionsAct->setShortcut(Qt::Key_Escape); 1828 clearSelectionsAct->setShortcut(Qt::Key_Escape);
1866 } 1829 }
1867 1830
1868 void MainWindow::createMenus() 1831 void MainWindow::createMenus()
1869 { 1832 {
1870 fileMenu = menuBar()->addMenu(tr("File")); 1833 fileMenu = menuBar()->addMenu(tr("File"));
1871 /* fileMenu -> addAction(hgInitAct); 1834
1872 fileMenu -> addAction(hgCloneFromRemoteAct);
1873 fileMenu->addAction(clearSelectionsAct); //!!! can't live here!
1874 fileMenu -> addSeparator();
1875 */
1876 fileMenu -> addAction(openAct); 1835 fileMenu -> addAction(openAct);
1877 fileMenu -> addAction(settingsAct); 1836 fileMenu -> addAction(settingsAct);
1878 fileMenu -> addSeparator(); 1837 fileMenu -> addSeparator();
1879 fileMenu -> addAction(exitAct); 1838 fileMenu -> addAction(exitAct);
1880 1839
1881 advancedMenu = menuBar()->addMenu(tr("Advanced")); 1840 advancedMenu = menuBar()->addMenu(tr("Advanced"));
1882 /* 1841
1883 advancedMenu -> addAction(hgUpdateToRevAct);
1884 advancedMenu -> addSeparator();
1885 advancedMenu -> addAction(hgAnnotateAct);
1886 advancedMenu -> addSeparator();
1887 advancedMenu -> addAction(hgRetryMergeAct);
1888 advancedMenu -> addAction(hgResolveListAct);
1889 advancedMenu -> addAction(hgResolveMarkAct);
1890 advancedMenu -> addSeparator();
1891 advancedMenu -> addAction(hgTagAct);
1892 advancedMenu -> addSeparator();
1893 */
1894 advancedMenu -> addAction(hgIgnoreAct); 1842 advancedMenu -> addAction(hgIgnoreAct);
1895 advancedMenu -> addSeparator(); 1843 advancedMenu -> addSeparator();
1896 advancedMenu -> addAction(hgServeAct); 1844 advancedMenu -> addAction(hgServeAct);
1897 1845
1898 helpMenu = menuBar()->addMenu(tr("Help")); 1846 helpMenu = menuBar()->addMenu(tr("Help"));
1899 helpMenu->addAction(aboutAct); 1847 helpMenu->addAction(aboutAct);
1900 //!!! helpMenu->addAction(aboutQtAct);
1901 } 1848 }
1902 1849
1903 void MainWindow::createToolBars() 1850 void MainWindow::createToolBars()
1904 { 1851 {
1905 fileToolBar = addToolBar(tr("File")); 1852 fileToolBar = addToolBar(tr("File"));
1906 fileToolBar -> setIconSize(QSize(MY_ICON_SIZE, MY_ICON_SIZE)); 1853 fileToolBar -> setIconSize(QSize(MY_ICON_SIZE, MY_ICON_SIZE));
1907 fileToolBar -> addAction(openAct); 1854 fileToolBar -> addAction(openAct);
1908 fileToolBar -> addAction(hgRefreshAct); 1855 fileToolBar -> addAction(hgRefreshAct);
1909 fileToolBar -> addSeparator(); 1856 fileToolBar -> addSeparator();
1910 // fileToolBar -> addAction(hgChgSetDiffAct);
1911 fileToolBar -> setMovable(false); 1857 fileToolBar -> setMovable(false);
1912 1858
1913 repoToolBar = addToolBar(tr(REPOMENU_TITLE)); 1859 repoToolBar = addToolBar(tr(REPOMENU_TITLE));
1914 repoToolBar -> setIconSize(QSize(MY_ICON_SIZE, MY_ICON_SIZE)); 1860 repoToolBar -> setIconSize(QSize(MY_ICON_SIZE, MY_ICON_SIZE));
1915 repoToolBar->addAction(hgIncomingAct); 1861 repoToolBar->addAction(hgIncomingAct);