diff options
| author | Wladimir J. van der Laan <[email protected]> | 2012-06-02 02:32:19 -0700 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2012-06-02 02:32:19 -0700 |
| commit | 1c85a7f3eb6c5a7c83e7749a285e33c5ad6997fb (patch) | |
| tree | 6a70be58bc4215333ee9736f616a3867d1941f0a /src/qt/guiutil.cpp | |
| parent | Use ConvertTo to simplify sendmany/addmultisigaddress argument handling (diff) | |
| parent | move class HelpMessageBox to guiutil.cpp/.h / add button to show Bitcoin comm... (diff) | |
| download | discoin-1c85a7f3eb6c5a7c83e7749a285e33c5ad6997fb.tar.xz discoin-1c85a7f3eb6c5a7c83e7749a285e33c5ad6997fb.zip | |
Merge pull request #1364 from Diapolo/move_HelpMessage_GUIUtil_add_RPCCon_Button
GUI: move class HelpMessageBox to guiutil.cpp/.h
Diffstat (limited to 'src/qt/guiutil.cpp')
| -rw-r--r-- | src/qt/guiutil.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 22c0bfeeb..3f2fc2ffa 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -3,6 +3,7 @@ #include "walletmodel.h" #include "bitcoinunits.h" #include "util.h" +#include "init.h" #include <QString> #include <QDateTime> @@ -413,5 +414,39 @@ bool SetStartOnSystemStartup(bool fAutoStart) { return false; } #endif +HelpMessageBox::HelpMessageBox(QWidget *parent) : + QMessageBox(parent) +{ + header = tr("Bitcoin-Qt") + " " + tr("version") + " " + + QString::fromStdString(FormatFullVersion()) + "\n\n" + + tr("Usage:") + "\n" + + " bitcoin-qt [" + tr("command-line options") + "] " + "\n"; + + coreOptions = QString::fromStdString(HelpMessage()); + + uiOptions = tr("UI options") + ":\n" + + " -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" + + " -min " + tr("Start minimized") + "\n" + + " -splash " + tr("Show splash screen on startup (default: 1)") + "\n"; + + setWindowTitle(tr("Bitcoin-Qt")); + setTextFormat(Qt::PlainText); + // setMinimumWidth is ignored for QMessageBox so put in nonbreaking spaces to make it wider. + setText(header + QString(QChar(0x2003)).repeated(50)); + setDetailedText(coreOptions + "\n" + uiOptions); +} + +void HelpMessageBox::exec() +{ +#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()); +#endif +} + } // namespace GUIUtil |