aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2012-06-17 12:24:35 -0700
committerWladimir J. van der Laan <laanwj@gmail.com>2012-06-17 12:24:35 -0700
commit6062de265af38f271ddc8bf42f62f36e31bf5068 (patch)
treea0634f686e92071e38bc4300a5a5b2ee5a78821f
parentfab7858a350d4650686b3aa07bd6277ce7c9685f (diff)
parent7d72a8c36a872113583e6db85707a8f17f3d3927 (diff)
Merge pull request #1461 from laanwj/2012_06_helpmessage
Show command line options as dialog when opened from debug window
-rw-r--r--src/qt/bitcoin.cpp2
-rw-r--r--src/qt/guiutil.cpp16
-rw-r--r--src/qt/guiutil.h6
3 files changed, 17 insertions, 7 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 8c8c73f065..b4e751077e 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -212,7 +212,7 @@ int main(int argc, char *argv[])
if (mapArgs.count("-?") || mapArgs.count("--help"))
{
GUIUtil::HelpMessageBox help;
- help.exec();
+ help.showOrPrint();
return 1;
}
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index a8c2328853..50ed2eed04 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -441,15 +441,21 @@ HelpMessageBox::HelpMessageBox(QWidget *parent) :
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
}
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index ca06348519..0240695505 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -103,7 +103,11 @@ namespace GUIUtil
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;