# HG changeset patch # User Chris Cannam # Date 1298303739 0 # Node ID 2e34e7ee7bafd33863fb95c8631cf18d2b02125a # Parent c0c254f67346b89b3768b5c74675e3406e7c61ee Make several operations use the new more-information dialog diff -r c0c254f67346 -r 2e34e7ee7baf mainwindow.cpp --- a/mainwindow.cpp Mon Feb 21 14:23:02 2011 +0000 +++ b/mainwindow.cpp Mon Feb 21 15:55:39 2011 +0000 @@ -846,7 +846,7 @@ { if (ConfirmCommentDialog::confirm (this, tr("Confirm pull"), - format3(tr("Confirm pull from remote repository"), + format3(tr("Pull from remote repository?"), tr("You are about to pull changes from the following remote repository:"), remoteRepoPath), tr("Pull"))) { @@ -861,7 +861,7 @@ { if (ConfirmCommentDialog::confirm (this, tr("Confirm push"), - format3(tr("Confirm push to remote repository"), + format3(tr("Push to remote repository?"), tr("You are about to push your changes to the following remote repository:"), remoteRepoPath), tr("Push"))) { @@ -1577,44 +1577,45 @@ void MainWindow::showPushResult(QString output) { + QString head; QString report; int n = extractChangeCount(output); if (n > 0) { - report = tr("Pushed %n changeset(s)", "", n); + head = tr("Pushed %n changeset(s)", "", n); } else if (n == 0) { - report = tr("No changes to push"); + head = tr("No changes to push"); + report = tr("The remote repository already contains all changes that have been committed locally."); + if (hgTabs->canCommit()) { + report = tr("%1

You do have some uncommitted changes. If you wish to push those to the remote repository, commit them locally first.").arg(report); + } } else { - report = tr("Push complete"); + head = tr("Push complete"); } - report = format3(report, tr("The push command output was:"), output); runner->hide(); - QMessageBox::information(this, "Push complete", report); + + MoreInformationDialog::information(this, tr("Push complete"), + head, report, output); } void MainWindow::showPullResult(QString output) { + QString head; QString report; int n = extractChangeCount(output); if (n > 0) { - report = tr("Pulled %n changeset(s)", "", n); + head = tr("Pulled %n changeset(s)", "", n); + report = tr("New changes will be highlighted in the history. Update to bring these changes into your working copy."); } else if (n == 0) { - report = tr("No changes to pull"); + head = tr("No changes to pull"); + report = tr("Your local repository already contains all changes found in the remote repository."); } else { - report = tr("Pull complete"); + head = tr("Pull complete"); } runner->hide(); MoreInformationDialog::information(this, tr("Pull complete"), - report, "", output); - -/*!!! - report = format3(report, tr("The pull command output was:"), output); - - //!!! and something about updating? - - QMessageBox::information(this, "Pull complete", report); -*/ + head, report, output); } void MainWindow::reportNewRemoteHeads(QString output) @@ -1639,17 +1640,19 @@ } if (headsAreLocal) { - QMessageBox::warning - (this, tr("Push failed"), - format3(tr("Push failed"), - tr("Your local repository could not be pushed to the remote repository.

You may need to merge the changes locally first.

The output of the push command was:"), - output)); + MoreInformationDialog::warning + (this, + tr("Push failed"), + tr("Push failed"), + tr("Your local repository could not be pushed to the remote repository.

You may need to merge the changes locally first."), + output); } else { - QMessageBox::warning - (this, tr("Push failed"), - format3(tr("Push failed"), - tr("Your local repository could not be pushed to the remote repository.

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.

The output of the push command was:"), - output)); + MoreInformationDialog::warning + (this, + tr("Push failed"), + tr("Push failed"), + tr("Your local repository could not be pushed to the remote repository.

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."), + output); } } @@ -1685,19 +1688,21 @@ // uh huh return; case ACT_TEST_HG: - QMessageBox::warning - (this, tr("Failed to run Mercurial"), - format3(tr("Failed to run Mercurial"), - tr("The Mercurial program either could not be found or failed to run.
Check that the Mercurial program path is correct in %1.

%2").arg(setstr).arg(output == "" ? QString("") : tr("The test command said:")), - output)); + MoreInformationDialog::warning + (this, + tr("Failed to run Mercurial"), + tr("Failed to run Mercurial"), + tr("The Mercurial program either could not be found or failed to run.
Check that the Mercurial program path is correct in %1.").arg(setstr), + output); settings(); return; case ACT_TEST_HG_EXT: QMessageBox::warning - (this, tr("Failed to run Mercurial"), - format3(tr("Failed to run Mercurial with extension enabled"), - tr("The Mercurial program failed to run with the EasyMercurial interaction extension enabled.
This may indicate an installation problem with EasyMercurial.

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.

%2").arg(setstr).arg(output == "" ? QString("") : tr("The test command said:")), - output)); + (this, + tr("Failed to run Mercurial"), + tr("Failed to run Mercurial with extension enabled"), + tr("The Mercurial program failed to run with the EasyMercurial interaction extension enabled.
This may indicate an installation problem with EasyMercurial.

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), + output); settings(); return; case ACT_CLONEFROMREMOTE: @@ -1743,6 +1748,8 @@ command += " " + arg; } + //!!! + QString message = tr("

Command failed

" "

The following command failed:

" "%1" @@ -1851,7 +1858,12 @@ MultiChoiceDialog::addRecentArgument("local", workFolderPath); MultiChoiceDialog::addRecentArgument("remote", remoteRepoPath); MultiChoiceDialog::addRecentArgument("remote", workFolderPath, true); - QMessageBox::information(this, tr("Clone"), tr("

Clone successful

%1
").arg(xmlEncode(output))); + MoreInformationDialog::information + (this, + tr("Clone"), + tr("Clone successful"), + tr("The remote repository
%1
was successfully cloned to the local folder
%2
.").arg(remoteRepoPath).arg(workFolderPath), + output); enableDisableActions(); shouldHgStat = true; break; diff -r c0c254f67346 -r 2e34e7ee7baf moreinformationdialog.cpp --- a/moreinformationdialog.cpp Mon Feb 21 14:23:02 2011 +0000 +++ b/moreinformationdialog.cpp Mon Feb 21 15:55:39 2011 +0000 @@ -40,14 +40,15 @@ setLayout(layout); m_iconLabel = new QLabel; - layout->addWidget(m_iconLabel, 0, 0); + layout->addWidget(m_iconLabel, 0, 0, 2, 1, Qt::AlignTop); QLabel *headLabel = new QLabel(QString("

%1

").arg(head)); layout->addWidget(headLabel, 0, 1); QLabel *textLabel = new QLabel(text); textLabel->setTextFormat(Qt::RichText); - layout->addWidget(textLabel, 1, 1); + textLabel->setWordWrap(true); + layout->addWidget(textLabel, 1, 1, Qt::AlignTop); QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok); connect(bb, SIGNAL(accepted()), this, SLOT(accept())); @@ -55,9 +56,12 @@ m_moreButton = bb->addButton(tr("More Details..."), QDialogButtonBox::ActionRole); + m_moreButton->setDefault(false); connect(m_moreButton, SIGNAL(clicked()), this, SLOT(moreClicked())); + bb->button(QDialogButtonBox::Ok)->setDefault(true); + m_moreText = new QTextEdit(); m_moreText->setAcceptRichText(false); m_moreText->document()->setPlainText(more); @@ -72,7 +76,9 @@ layout->addWidget(m_moreText, 3, 0, 1, 2); m_moreText->hide(); + if (more == "") m_moreButton->hide(); + layout->setRowStretch(1, 20); layout->setColumnStretch(1, 20); setMinimumWidth(400); }