Mercurial > hg > easyhg
comparison mainwindow.cpp @ 291:2e34e7ee7baf more_information_dialog
Make several operations use the new more-information dialog
author | Chris Cannam |
---|---|
date | Mon, 21 Feb 2011 15:55:39 +0000 |
parents | c0c254f67346 |
children | 7b4f42cfc596 |
comparison
equal
deleted
inserted
replaced
290:c0c254f67346 | 291:2e34e7ee7baf |
---|---|
844 | 844 |
845 void MainWindow::hgPull() | 845 void MainWindow::hgPull() |
846 { | 846 { |
847 if (ConfirmCommentDialog::confirm | 847 if (ConfirmCommentDialog::confirm |
848 (this, tr("Confirm pull"), | 848 (this, tr("Confirm pull"), |
849 format3(tr("Confirm pull from remote repository"), | 849 format3(tr("Pull from remote repository?"), |
850 tr("You are about to pull changes from the following remote repository:"), | 850 tr("You are about to pull changes from the following remote repository:"), |
851 remoteRepoPath), | 851 remoteRepoPath), |
852 tr("Pull"))) { | 852 tr("Pull"))) { |
853 | 853 |
854 QStringList params; | 854 QStringList params; |
859 | 859 |
860 void MainWindow::hgPush() | 860 void MainWindow::hgPush() |
861 { | 861 { |
862 if (ConfirmCommentDialog::confirm | 862 if (ConfirmCommentDialog::confirm |
863 (this, tr("Confirm push"), | 863 (this, tr("Confirm push"), |
864 format3(tr("Confirm push to remote repository"), | 864 format3(tr("Push to remote repository?"), |
865 tr("You are about to push your changes to the following remote repository:"), | 865 tr("You are about to push your changes to the following remote repository:"), |
866 remoteRepoPath), | 866 remoteRepoPath), |
867 tr("Push"))) { | 867 tr("Push"))) { |
868 | 868 |
869 QStringList params; | 869 QStringList params; |
1575 } | 1575 } |
1576 } | 1576 } |
1577 | 1577 |
1578 void MainWindow::showPushResult(QString output) | 1578 void MainWindow::showPushResult(QString output) |
1579 { | 1579 { |
1580 QString head; | |
1580 QString report; | 1581 QString report; |
1581 int n = extractChangeCount(output); | 1582 int n = extractChangeCount(output); |
1582 if (n > 0) { | 1583 if (n > 0) { |
1583 report = tr("Pushed %n changeset(s)", "", n); | 1584 head = tr("Pushed %n changeset(s)", "", n); |
1584 } else if (n == 0) { | 1585 } else if (n == 0) { |
1585 report = tr("No changes to push"); | 1586 head = tr("No changes to push"); |
1587 report = tr("The remote repository already contains all changes that have been committed locally."); | |
1588 if (hgTabs->canCommit()) { | |
1589 report = tr("%1<p>You do have some uncommitted changes. If you wish to push those to the remote repository, commit them locally first.").arg(report); | |
1590 } | |
1586 } else { | 1591 } else { |
1587 report = tr("Push complete"); | 1592 head = tr("Push complete"); |
1588 } | 1593 } |
1589 report = format3(report, tr("The push command output was:"), output); | |
1590 runner->hide(); | 1594 runner->hide(); |
1591 QMessageBox::information(this, "Push complete", report); | 1595 |
1596 MoreInformationDialog::information(this, tr("Push complete"), | |
1597 head, report, output); | |
1592 } | 1598 } |
1593 | 1599 |
1594 void MainWindow::showPullResult(QString output) | 1600 void MainWindow::showPullResult(QString output) |
1595 { | 1601 { |
1602 QString head; | |
1596 QString report; | 1603 QString report; |
1597 int n = extractChangeCount(output); | 1604 int n = extractChangeCount(output); |
1598 if (n > 0) { | 1605 if (n > 0) { |
1599 report = tr("Pulled %n changeset(s)", "", n); | 1606 head = tr("Pulled %n changeset(s)", "", n); |
1607 report = tr("New changes will be highlighted in the history. Update to bring these changes into your working copy."); | |
1600 } else if (n == 0) { | 1608 } else if (n == 0) { |
1601 report = tr("No changes to pull"); | 1609 head = tr("No changes to pull"); |
1610 report = tr("Your local repository already contains all changes found in the remote repository."); | |
1602 } else { | 1611 } else { |
1603 report = tr("Pull complete"); | 1612 head = tr("Pull complete"); |
1604 } | 1613 } |
1605 | 1614 |
1606 runner->hide(); | 1615 runner->hide(); |
1607 | 1616 |
1608 MoreInformationDialog::information(this, tr("Pull complete"), | 1617 MoreInformationDialog::information(this, tr("Pull complete"), |
1609 report, "", output); | 1618 head, report, output); |
1610 | |
1611 /*!!! | |
1612 report = format3(report, tr("The pull command output was:"), output); | |
1613 | |
1614 //!!! and something about updating? | |
1615 | |
1616 QMessageBox::information(this, "Pull complete", report); | |
1617 */ | |
1618 } | 1619 } |
1619 | 1620 |
1620 void MainWindow::reportNewRemoteHeads(QString output) | 1621 void MainWindow::reportNewRemoteHeads(QString output) |
1621 { | 1622 { |
1622 bool headsAreLocal = false; | 1623 bool headsAreLocal = false; |
1637 headsAreLocal = true; | 1638 headsAreLocal = true; |
1638 } | 1639 } |
1639 } | 1640 } |
1640 | 1641 |
1641 if (headsAreLocal) { | 1642 if (headsAreLocal) { |
1642 QMessageBox::warning | 1643 MoreInformationDialog::warning |
1643 (this, tr("Push failed"), | 1644 (this, |
1644 format3(tr("Push failed"), | 1645 tr("Push failed"), |
1645 tr("Your local repository could not be pushed to the remote repository.<br><br>You may need to merge the changes locally first.<br><br>The output of the push command was:"), | 1646 tr("Push failed"), |
1646 output)); | 1647 tr("Your local repository could not be pushed to the remote repository.<br><br>You may need to merge the changes locally first."), |
1648 output); | |
1647 } else { | 1649 } else { |
1648 QMessageBox::warning | 1650 MoreInformationDialog::warning |
1649 (this, tr("Push failed"), | 1651 (this, |
1650 format3(tr("Push failed"), | 1652 tr("Push failed"), |
1651 tr("Your local repository could not be pushed to the remote repository.<br><br>The remote repository may have been changed by someone else since you last pushed. Try pulling and merging their changes into your local repository first.<br><br>The output of the push command was:"), | 1653 tr("Push failed"), |
1652 output)); | 1654 tr("Your local repository could not be pushed to the remote repository.<br><br>The remote repository may have been changed by someone else since you last pushed. Try pulling and merging their changes into your local repository first."), |
1655 output); | |
1653 } | 1656 } |
1654 } | 1657 } |
1655 | 1658 |
1656 void MainWindow::commandStarting(HgAction action) | 1659 void MainWindow::commandStarting(HgAction action) |
1657 { | 1660 { |
1683 switch(action.action) { | 1686 switch(action.action) { |
1684 case ACT_NONE: | 1687 case ACT_NONE: |
1685 // uh huh | 1688 // uh huh |
1686 return; | 1689 return; |
1687 case ACT_TEST_HG: | 1690 case ACT_TEST_HG: |
1688 QMessageBox::warning | 1691 MoreInformationDialog::warning |
1689 (this, tr("Failed to run Mercurial"), | 1692 (this, |
1690 format3(tr("Failed to run Mercurial"), | 1693 tr("Failed to run Mercurial"), |
1691 tr("The Mercurial program either could not be found or failed to run.<br>Check that the Mercurial program path is correct in %1.<br><br>%2").arg(setstr).arg(output == "" ? QString("") : tr("The test command said:")), | 1694 tr("Failed to run Mercurial"), |
1692 output)); | 1695 tr("The Mercurial program either could not be found or failed to run.<br>Check that the Mercurial program path is correct in %1.").arg(setstr), |
1696 output); | |
1693 settings(); | 1697 settings(); |
1694 return; | 1698 return; |
1695 case ACT_TEST_HG_EXT: | 1699 case ACT_TEST_HG_EXT: |
1696 QMessageBox::warning | 1700 QMessageBox::warning |
1697 (this, tr("Failed to run Mercurial"), | 1701 (this, |
1698 format3(tr("Failed to run Mercurial with extension enabled"), | 1702 tr("Failed to run Mercurial"), |
1699 tr("The Mercurial program failed to run with the EasyMercurial interaction extension enabled.<br>This may indicate an installation problem with EasyMercurial.<br><br>You may be able to continue working if you switch off “Use EasyHg Mercurial Extension” in %1. Note that remote repositories that require authentication may not work if you do this.<br><br>%2").arg(setstr).arg(output == "" ? QString("") : tr("The test command said:")), | 1703 tr("Failed to run Mercurial with extension enabled"), |
1700 output)); | 1704 tr("The Mercurial program failed to run with the EasyMercurial interaction extension enabled.<br>This may indicate an installation problem with EasyMercurial.<br><br>You may be able to continue working if you switch off “Use EasyHg Mercurial Extension” in %1. Note that remote repositories that require authentication may not work if you do this.").arg(setstr), |
1705 output); | |
1701 settings(); | 1706 settings(); |
1702 return; | 1707 return; |
1703 case ACT_CLONEFROMREMOTE: | 1708 case ACT_CLONEFROMREMOTE: |
1704 // if clone fails, we have no repo | 1709 // if clone fails, we have no repo |
1705 workFolderPath = ""; | 1710 workFolderPath = ""; |
1741 if (command == "") command = "hg"; | 1746 if (command == "") command = "hg"; |
1742 foreach (QString arg, action.params) { | 1747 foreach (QString arg, action.params) { |
1743 command += " " + arg; | 1748 command += " " + arg; |
1744 } | 1749 } |
1745 | 1750 |
1751 //!!! | |
1752 | |
1746 QString message = tr("<qt><h3>Command failed</h3>" | 1753 QString message = tr("<qt><h3>Command failed</h3>" |
1747 "<p>The following command failed:</p>" | 1754 "<p>The following command failed:</p>" |
1748 "<code>%1</code>" | 1755 "<code>%1</code>" |
1749 "%2</qt>") | 1756 "%2</qt>") |
1750 .arg(command) | 1757 .arg(command) |
1849 | 1856 |
1850 case ACT_CLONEFROMREMOTE: | 1857 case ACT_CLONEFROMREMOTE: |
1851 MultiChoiceDialog::addRecentArgument("local", workFolderPath); | 1858 MultiChoiceDialog::addRecentArgument("local", workFolderPath); |
1852 MultiChoiceDialog::addRecentArgument("remote", remoteRepoPath); | 1859 MultiChoiceDialog::addRecentArgument("remote", remoteRepoPath); |
1853 MultiChoiceDialog::addRecentArgument("remote", workFolderPath, true); | 1860 MultiChoiceDialog::addRecentArgument("remote", workFolderPath, true); |
1854 QMessageBox::information(this, tr("Clone"), tr("<qt><h3>Clone successful</h3><pre>%1</pre>").arg(xmlEncode(output))); | 1861 MoreInformationDialog::information |
1862 (this, | |
1863 tr("Clone"), | |
1864 tr("Clone successful"), | |
1865 tr("The remote repository <pre>%1</pre> was successfully cloned to the local folder <pre>%2</pre>.").arg(remoteRepoPath).arg(workFolderPath), | |
1866 output); | |
1855 enableDisableActions(); | 1867 enableDisableActions(); |
1856 shouldHgStat = true; | 1868 shouldHgStat = true; |
1857 break; | 1869 break; |
1858 | 1870 |
1859 case ACT_LOG: | 1871 case ACT_LOG: |