comparison mainwindow.cpp @ 193:ef5feb0d648f

* Give all of the substantial confirmation dialogs meaningful labels for their OK buttons
author Chris Cannam
date Mon, 20 Dec 2010 22:37:42 +0000
parents 702ca6dafcbe
children 5ca49523892f
comparison
equal deleted inserted replaced
192:702ca6dafcbe 193:ef5feb0d648f
328 tr("<h3>%1</h3><p>%2").arg(cf) 328 tr("<h3>%1</h3><p>%2").arg(cf)
329 .arg(tr("You are about to commit the following files:")), 329 .arg(tr("You are about to commit the following files:")),
330 tr("<h3>%1</h3><p>%2").arg(cf) 330 tr("<h3>%1</h3><p>%2").arg(cf)
331 .arg(tr("You are about to commit %n file(s).", "", reportFiles.size())), 331 .arg(tr("You are about to commit %n file(s).", "", reportFiles.size())),
332 reportFiles, 332 reportFiles,
333 comment)) { 333 comment,
334 tr("Commit"))) {
334 335
335 if (!justMerged && !files.empty()) { 336 if (!justMerged && !files.empty()) {
336 // User wants to commit selected file(s) (and this is not 337 // User wants to commit selected file(s) (and this is not
337 // merge commit, which would fail if we selected files) 338 // merge commit, which would fail if we selected files)
338 params << "commit" << "--message" << comment 339 params << "commit" << "--message" << comment
372 373
373 if (ConfirmCommentDialog::confirmAndGetShortComment 374 if (ConfirmCommentDialog::confirmAndGetShortComment
374 (this, 375 (this,
375 tr("Tag"), 376 tr("Tag"),
376 tr("Enter tag:"), 377 tr("Enter tag:"),
377 tag)) { 378 tag,
379 tr("Add Tag"))) {
378 if (!tag.isEmpty()) {//!!! do something better if it is empty 380 if (!tag.isEmpty()) {//!!! do something better if it is empty
379 381
380 params << "tag" << "--user" << getUserInfo(); 382 params << "tag" << "--user" << getUserInfo();
381 params << "--rev" << Changeset::hashOf(id) << filterTag(tag); 383 params << "--rev" << Changeset::hashOf(id) << filterTag(tag);
382 384
592 rf, 594 rf,
593 tr("<h3>%1</h3><p>%2").arg(rf) 595 tr("<h3>%1</h3><p>%2").arg(rf)
594 .arg(tr("You are about to <b>revert</b> the following files to their previous committed state.<br><br>This will <b>throw away any changes</b> that you have made to these files but have not committed:")), 596 .arg(tr("You are about to <b>revert</b> the following files to their previous committed state.<br><br>This will <b>throw away any changes</b> that you have made to these files but have not committed:")),
595 tr("<h3>%1</h3><p>%2").arg(rf) 597 tr("<h3>%1</h3><p>%2").arg(rf)
596 .arg(tr("You are about to <b>revert</b> %n file(s).<br><br>This will <b>throw away any changes</b> that you have made to these files but have not committed.", "", files.size())), 598 .arg(tr("You are about to <b>revert</b> %n file(s).<br><br>This will <b>throw away any changes</b> that you have made to these files but have not committed.", "", files.size())),
597 files)) { 599 files,
600 tr("Revert"))) {
598 601
599 lastRevertedFiles = files; 602 lastRevertedFiles = files;
600 603
601 if (files.empty()) { 604 if (files.empty()) {
602 params << "revert" << "--no-backup"; 605 params << "revert" << "--no-backup";
760 params << "--template" << Changeset::getLogTemplate(); 763 params << "--template" << Changeset::getLogTemplate();
761 764
762 runner->requestAction(HgAction(ACT_INCOMING, workFolderPath, params)); 765 runner->requestAction(HgAction(ACT_INCOMING, workFolderPath, params));
763 } 766 }
764 767
765 static QMessageBox::StandardButton confirm(QWidget *parent,
766 QString title,
767 QString text,
768 QString okButtonText)
769 {
770 QMessageBox box(QMessageBox::Question,
771 title,
772 text,
773 QMessageBox::Cancel,
774 parent);
775
776 QPushButton *ok = box.addButton(QMessageBox::Ok);
777 ok->setText(okButtonText);
778 if (box.exec() == -1) return QMessageBox::Cancel;
779 return box.standardButton(box.clickedButton());
780 }
781
782 void MainWindow::hgPull() 768 void MainWindow::hgPull()
783 { 769 {
784 if (confirm 770 if (ConfirmCommentDialog::confirm
785 (this, tr("Confirm pull"), 771 (this, tr("Confirm pull"),
786 format3(tr("Confirm pull from remote repository"), 772 format3(tr("Confirm pull from remote repository"),
787 tr("You are about to pull changes from the following remote repository:"), 773 tr("You are about to pull changes from the following remote repository:"),
788 remoteRepoPath), 774 remoteRepoPath),
789 tr("Pull")) == QMessageBox::Ok) { 775 tr("Pull")) == QMessageBox::Ok) {
794 } 780 }
795 } 781 }
796 782
797 void MainWindow::hgPush() 783 void MainWindow::hgPush()
798 { 784 {
799 if (confirm 785 if (ConfirmCommentDialog::confirm
800 (this, tr("Confirm push"), 786 (this, tr("Confirm push"),
801 format3(tr("Confirm push to remote repository"), 787 format3(tr("Confirm push to remote repository"),
802 tr("You are about to push your changes to the following remote repository:"), 788 tr("You are about to push your changes to the following remote repository:"),
803 remoteRepoPath), 789 remoteRepoPath),
804 tr("Push")) == QMessageBox::Ok) { 790 tr("Push")) == QMessageBox::Ok) {