changeset 2774:8cd0ce2963e4 draft

Show command line options as dialog when opened from debug window On Linux/Mac the command-line options were printed to stderr when the button was pressed in the debug window, resulting in confusion. This is fixed in this commit by adding a separate method.
author Wladimir J. van der Laan <laanwj@gmail.com>
date Thu, 14 Jun 2012 15:06:23 +0200
parents 75f615d120ef
children a63707c2a68b
files src/qt/bitcoin.cpp src/qt/guiutil.cpp src/qt/guiutil.h
diffstat 3 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -212,7 +212,7 @@
     if (mapArgs.count("-?") || mapArgs.count("--help"))
     {
         GUIUtil::HelpMessageBox help;
-        help.exec();
+        help.showOrPrint();
         return 1;
     }
 
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -441,15 +441,21 @@
     setDetailedText(coreOptions + "\n" + uiOptions);
 }
 
-void HelpMessageBox::exec()
+void HelpMessageBox::printToConsole()
 {
-#if defined(WIN32)
-    // On windows, show a message box, as there is no stderr in windowed applications
-    QMessageBox::exec();
-#else
     // On other operating systems, the expected action is to print the message to the console.
     QString strUsage = header + "\n" + coreOptions + "\n" + uiOptions;
     fprintf(stderr, "%s", strUsage.toStdString().c_str());
+}
+
+void HelpMessageBox::showOrPrint()
+{
+#if defined(WIN32)
+        // On windows, show a message box, as there is no stderr/stdout in windowed applications
+        exec();
+#else
+        // On other operating systems, print help text to console
+        printToConsole();
 #endif
 }
 
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -103,7 +103,11 @@
     public:
         HelpMessageBox(QWidget *parent = 0);
 
-        void exec();
+        /** Show message box or print help message to standard output, based on operating system. */
+        void showOrPrint();
+
+        /** Print help message to console */
+        void printToConsole();
 
     private:
         QString header;