diff options
author | Luca Venturini <luca@yepa.com> | 2015-03-09 00:29:59 -0700 |
---|---|---|
committer | Luca Venturini <luca@yepa.com> | 2015-03-10 22:07:17 -0700 |
commit | f75470794bd344ec25e1a540637c675e7f2ad6b0 (patch) | |
tree | ca9e7f1fb147418585caad636358e9abf731ebbd | |
parent | 1fdb9fa3f905df956ed61dbf6ae086c963fd1793 (diff) |
Fix - bitcoin-qt usage message
. Closes the bug from commit e179eb3d9bfec7e67908242c71c87b716a41c97c
("bitcoin-qt -help" did not show any message)
. Move all the options in init.cpp (there were already some
options related to bitcoin-qt)
-rw-r--r-- | src/init.cpp | 13 | ||||
-rw-r--r-- | src/qt/utilitydialog.cpp | 78 |
2 files changed, 37 insertions, 54 deletions
diff --git a/src/init.cpp b/src/init.cpp index eea02dc242..1e3cc1d899 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -412,6 +412,19 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-rpcsslprivatekeyfile=<file.pem>", strprintf(_("Server private key (default: %s)"), "server.pem")); strUsage += HelpMessageOpt("-rpcsslciphers=<ciphers>", strprintf(_("Acceptable ciphers (default: %s)"), "TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH")); + if (mode == HMM_BITCOIN_QT) + { + strUsage += HelpMessageGroup(_("UI Options:")); + if (GetBoolArg("-help-debug", false)) { + strUsage += HelpMessageOpt("-allowselfsignedrootcertificates", _("Allow self signed root certificates (default: 0)")); + } + strUsage += HelpMessageOpt("-choosedatadir", _("Choose data directory on startup (default: 0)")); + strUsage += HelpMessageOpt("-lang=<lang>", _("Set language, for example \"de_DE\" (default: system locale)")); + strUsage += HelpMessageOpt("-min", _("Start minimized")); + strUsage += HelpMessageOpt("-rootcertificates=<file>", _("Set SSL root certificates for payment request (default: -system-)")); + strUsage += HelpMessageOpt("-splash", _("Show splash screen on startup (default: 1)")); + } + return strUsage; } diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index 4e7b70efe6..386cf31d73 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -62,13 +62,17 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) : ui->helpMessage->setVisible(false); } else { setWindowTitle(tr("Command-line options")); + QString header = tr("Usage:") + "\n" + + " bitcoin-qt [" + tr("command-line options") + "] " + "\n"; QTextCursor cursor(ui->helpMessage->document()); cursor.insertText(version); cursor.insertBlock(); - cursor.insertText(tr("Usage:") + '\n' + - " bitcoin-qt [" + tr("command-line options") + "]\n"); - + cursor.insertText(header); cursor.insertBlock(); + + QString coreOptions = QString::fromStdString(HelpMessage(HMM_BITCOIN_QT)); + text = version + "\n" + header + "\n" + coreOptions; + QTextTableFormat tf; tf.setBorderStyle(QTextFrameFormat::BorderStyle_None); tf.setCellPadding(2); @@ -76,63 +80,29 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) : widths << QTextLength(QTextLength::PercentageLength, 35); widths << QTextLength(QTextLength::PercentageLength, 65); tf.setColumnWidthConstraints(widths); - QTextTable *table = cursor.insertTable(2, 2, tf); - QString coreOptions = QString::fromStdString(HelpMessage(HMM_BITCOIN_QT)); - bool first = true; QTextCharFormat bold; bold.setFontWeight(QFont::Bold); - // note that coreOptions is not translated. - foreach (const QString &line, coreOptions.split('\n')) { - if (!first) { - table->appendRows(1); + + foreach (const QString &line, coreOptions.split("\n")) { + if (line.startsWith(" -")) + { + cursor.currentTable()->appendRows(1); + cursor.movePosition(QTextCursor::PreviousCell); cursor.movePosition(QTextCursor::NextRow); + cursor.insertText(line.trimmed()); + cursor.movePosition(QTextCursor::NextCell); + } else if (line.startsWith(" ")) { + cursor.insertText(line.trimmed()+' '); + } else if (line.size() > 0) { + //Title of a group + if (cursor.currentTable()) + cursor.currentTable()->appendRows(1); + cursor.movePosition(QTextCursor::Down); + cursor.insertText(line.trimmed(), bold); + cursor.insertTable(1, 2, tf); } - first = false; - - if (line.startsWith(" ")) { - int index = line.indexOf(' ', 3); - if (index > 0) { - cursor.insertText(line.left(index).trimmed()); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(line.mid(index).trimmed()); - continue; - } - } - cursor.movePosition(QTextCursor::NextCell, QTextCursor::KeepAnchor); - table->mergeCells(cursor); - cursor.insertText(line.trimmed(), bold); - } - - table->appendRows(6); - cursor.movePosition(QTextCursor::NextRow); - cursor.insertText(tr("UI options") + ":", bold); - cursor.movePosition(QTextCursor::NextRow); - if (GetBoolArg("-help-debug", false)) { - cursor.insertText("-allowselfsignedrootcertificates"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(tr("Allow self signed root certificates (default: 0)")); - cursor.movePosition(QTextCursor::NextCell); } - cursor.insertText("-choosedatadir"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(tr("Choose data directory on startup (default: 0)")); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("-lang=<lang>"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(tr("Set language, for example \"de_DE\" (default: system locale)")); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("-min"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(tr("Start minimized")); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("-rootcertificates=<file>"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(tr("Set SSL root certificates for payment request (default: -system-)")); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("-splash"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(tr("Show splash screen on startup (default: 1)")); ui->helpMessage->moveCursor(QTextCursor::Start); ui->scrollArea->setVisible(false); |