changeset 298:fd9dc5a457d8

* Make "More Details" button non-auto-default in more-info dialog * Make Incoming dialog show same message as in Pull dialog when no changes are pending * Try to make the confirm-push/pull dialogs look more in-keeping on OS/X... but mostly we end up making their text too small. Hmm.
author Chris Cannam
date Tue, 22 Feb 2011 15:12:56 +0000
parents 01a471e9cbe3
children fd6abd505f31
files confirmcommentdialog.cpp confirmcommentdialog.h incomingdialog.cpp mainwindow.cpp moreinformationdialog.cpp
diffstat 5 files changed, 28 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/confirmcommentdialog.cpp	Mon Feb 21 19:22:29 2011 +0000
+++ b/confirmcommentdialog.cpp	Tue Feb 22 15:12:56 2011 +0000
@@ -73,26 +73,33 @@
 QString ConfirmCommentDialog::buildFilesText(QString intro, QStringList files)
 {
     QString text;
-    text = "<qt>" + intro;
-    text += "<p><code>";
+
+    if (intro == "") text = "<qt>";
+    else text = "<qt>" + intro + "<p>";
+
+    text += "<code>";
     foreach (QString file, files) {
         text += "&nbsp;&nbsp;&nbsp;" + xmlEncode(file) + "<br>";
     }
     text += "</code></qt>";
+
     return text;
 }
 
 bool ConfirmCommentDialog::confirm(QWidget *parent,
                                    QString title,
+                                   QString head,
                                    QString text,
                                    QString okButtonText)
 {
     QMessageBox box(QMessageBox::Question,
                     title,
-                    text,
+                    head,
                     QMessageBox::Cancel,
                     parent);
 
+    box.setInformativeText(text);
+
     QPushButton *ok = box.addButton(QMessageBox::Ok);
     ok->setText(okButtonText);
     box.setDefaultButton(QMessageBox::Ok);
@@ -102,15 +109,18 @@
 
 bool ConfirmCommentDialog::confirmDangerous(QWidget *parent,
                                             QString title,
+                                            QString head,
                                             QString text,
                                             QString okButtonText)
 {
     QMessageBox box(QMessageBox::Warning,
                     title,
-                    text,
+                    head,
                     QMessageBox::Cancel,
                     parent);
 
+    box.setInformativeText(text);
+
     QPushButton *ok = box.addButton(QMessageBox::Ok);
     ok->setText(okButtonText);
     box.setDefaultButton(QMessageBox::Cancel);
@@ -131,7 +141,7 @@
     } else {
         text = "<qt>" + introTextWithCount + "</qt>";
     }
-    return confirm(parent, title, text, okButtonText);
+    return confirm(parent, title, text, "", okButtonText);
 }
 
 bool ConfirmCommentDialog::confirmDangerousFilesAction(QWidget *parent,
@@ -147,7 +157,7 @@
     } else {
         text = "<qt>" + introTextWithCount + "</qt>";
     }
-    return confirmDangerous(parent, title, text, okButtonText);
+    return confirmDangerous(parent, title, text, "", okButtonText);
 }
 
 bool ConfirmCommentDialog::confirmAndGetShortComment(QWidget *parent,
--- a/confirmcommentdialog.h	Mon Feb 21 19:22:29 2011 +0000
+++ b/confirmcommentdialog.h	Tue Feb 22 15:12:56 2011 +0000
@@ -32,11 +32,13 @@
 public:
     static bool confirm(QWidget *parent,
                         QString title,
+                        QString head,
                         QString text,
                         QString okButtonText);
     
     static bool confirmDangerous(QWidget *parent,
                                  QString title,
+                                 QString head,
                                  QString text,
                                  QString okButtonText);
     
--- a/incomingdialog.cpp	Mon Feb 21 19:22:29 2011 +0000
+++ b/incomingdialog.cpp	Tue Feb 22 15:12:56 2011 +0000
@@ -40,7 +40,9 @@
 	    body = QString("<p>%1</p><code>%2</code>")
 		.arg(tr("The command output was:"))
 		.arg(xmlEncode(text).replace("\n", "<br>"));
-	}
+	} else {
+            body = tr("<qt>Your local repository already contains all changes found in the remote repository.</qt>");
+        }
 	scroll = false;
     } else {
         head = tr("There are %n change(s) ready to pull", "", csets.size());
@@ -59,12 +61,13 @@
     int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, this);
     info->setPixmap(style->standardIcon(QStyle::SP_MessageBoxInformation, 0, this)
 		    .pixmap(iconSize, iconSize));
-    layout->addWidget(info, 0, 0);
+    layout->addWidget(info, 0, 0, 2, 1);
 
     QLabel *headLabel = new QLabel(QString("<qt><h3>%1</h3></qt>").arg(head));
     layout->addWidget(headLabel, 0, 1);
 
     QLabel *textLabel = new QLabel(body);
+    if (csets.empty()) textLabel->setWordWrap(true);
 
     if (scroll) {
 	QScrollArea *sa = new QScrollArea;
--- a/mainwindow.cpp	Mon Feb 21 19:22:29 2011 +0000
+++ b/mainwindow.cpp	Tue Feb 22 15:12:56 2011 +0000
@@ -860,9 +860,8 @@
 {
     if (ConfirmCommentDialog::confirm
         (this, tr("Confirm pull"),
-         format3(tr("Pull from remote repository?"),
-                 tr("You are about to pull changes from the following remote repository:"),
-                 m_remoteRepoPath),
+         tr("Pull from remote repository?"),
+         tr("<qt>You are about to pull changes from the repository at <code>%1</code></qt>").arg(xmlEncode(m_remoteRepoPath)),
          tr("Pull"))) {
 
         QStringList params;
@@ -875,9 +874,8 @@
 {
     if (ConfirmCommentDialog::confirm
         (this, tr("Confirm push"),
-         format3(tr("Push to remote repository?"),
-                 tr("You are about to push your changes to the following remote repository:"),
-                 m_remoteRepoPath),
+         tr("Push to remote repository?"),
+         tr("<qt>You are about to push your changes to the repository at <code>%1</code>").arg(xmlEncode(m_remoteRepoPath)),
          tr("Push"))) {
 
         QStringList params;
--- a/moreinformationdialog.cpp	Mon Feb 21 19:22:29 2011 +0000
+++ b/moreinformationdialog.cpp	Tue Feb 22 15:12:56 2011 +0000
@@ -56,6 +56,7 @@
 
     m_moreButton = bb->addButton(tr("More Details..."),
                                  QDialogButtonBox::ActionRole);
+    m_moreButton->setAutoDefault(false);
     m_moreButton->setDefault(false);
 
     connect(m_moreButton, SIGNAL(clicked()), this, SLOT(moreClicked()));