git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Abdelrazak Younes <younes@lyx.org>
To: Git Mailing List <git@vger.kernel.org>
Subject: [QGIT PATCH] Rework the commit confirmation box a bit
Date: Mon, 06 Oct 2008 11:11:53 +0200	[thread overview]
Message-ID: <48E9D659.1090503@lyx.org> (raw)

The problem was that the dialog was too big for my whenever too many files
were changed. Now, the list of changed files is only shown whenever they are
less than 20; otherwise it is shown in the detailed text accessible though
the 'Show Detail' button.
---
  src/commitimpl.cpp |   25 ++++++++++++++++++++-----
  1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/commitimpl.cpp b/src/commitimpl.cpp
index 1540947..def5209 100644
--- a/src/commitimpl.cpp
+++ b/src/commitimpl.cpp
@@ -236,17 +236,32 @@ bool CommitImpl::checkConfirm(SCRef msg, SCRef 
patchName, SCList selFiles, bool
          (git->isStGITStack() ? "refresh top patch with" :
                          "amend last commit with") :
          (git->isStGITStack() ? "create a new patch with" : "commit");
-    QString text("Do you want to " + whatToDo + " the following 
file(s)?\n\n" +
-                 selFiles.join("\n") + "\n\nwith the message:\n\n");
+    QString text("Do you want to " + whatToDo);
+
+    bool const fullList = selFiles.size() < 20;
+    if (fullList) {
+        text.append(" the following file(s)?\n\n" + selFiles.join("\n")
+            + "\n\nwith the message:\n\n");
+    } else {
+        text.append(" those " + QString::number(selFiles.size())
+            + " files the with the message:\n\n");
+    }
+
      text.append(msg);
      if (git->isStGITStack())
          text.append("\n\nAnd patch name: " + patchName);

      QTextCodec::setCodecForCStrings(tc);

-    int but = QMessageBox::question(this, "Commit changes - QGit",
-                                    text, "&Yes", "&No", QString(), 0, 1);
-    return (but != 1);
+    QMessageBox msgBox(this);
+    msgBox.setWindowTitle("Commit changes - QGit");
+    msgBox.setText(text);
+    if (!fullList)
+        msgBox.setDetailedText(selFiles.join("\n"));
+    msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+    msgBox.setDefaultButton(QMessageBox::Yes);
+
+    return msgBox.exec() != QMessageBox::No;
  }

  void CommitImpl::pushButtonSettings_clicked() {
-- 
1.6.0.2.1172.ga5ed0

             reply	other threads:[~2008-10-06  9:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-06  9:11 Abdelrazak Younes [this message]
2008-10-06 19:03 ` [QGIT PATCH] Rework the commit confirmation box a bit Marco Costalba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48E9D659.1090503@lyx.org \
    --to=younes@lyx.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).