|
|
@ -18,6 +18,8 @@ |
|
|
|
#include <QCloseEvent> |
|
|
|
#include <QCloseEvent> |
|
|
|
#include <QLabel> |
|
|
|
#include <QLabel> |
|
|
|
#include <QRegExp> |
|
|
|
#include <QRegExp> |
|
|
|
|
|
|
|
#include <QTextTable> |
|
|
|
|
|
|
|
#include <QTextCursor> |
|
|
|
#include <QVBoxLayout> |
|
|
|
#include <QVBoxLayout> |
|
|
|
|
|
|
|
|
|
|
|
/** "Help message" or "About" dialog box */ |
|
|
|
/** "Help message" or "About" dialog box */ |
|
|
@ -52,28 +54,82 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) : |
|
|
|
// Replace newlines with HTML breaks
|
|
|
|
// Replace newlines with HTML breaks
|
|
|
|
licenseInfoHTML.replace("\n\n", "<br><br>"); |
|
|
|
licenseInfoHTML.replace("\n\n", "<br><br>"); |
|
|
|
|
|
|
|
|
|
|
|
ui->helpMessageLabel->setTextFormat(Qt::RichText); |
|
|
|
ui->aboutMessage->setTextFormat(Qt::RichText); |
|
|
|
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
|
|
|
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
|
|
|
text = version + "\n" + licenseInfo; |
|
|
|
text = version + "\n" + licenseInfo; |
|
|
|
ui->helpMessageLabel->setText(version + "<br><br>" + licenseInfoHTML); |
|
|
|
ui->aboutMessage->setText(version + "<br><br>" + licenseInfoHTML); |
|
|
|
ui->helpMessageLabel->setWordWrap(true); |
|
|
|
ui->aboutMessage->setWordWrap(true); |
|
|
|
|
|
|
|
ui->helpMessage->setVisible(false); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setWindowTitle(tr("Command-line options")); |
|
|
|
setWindowTitle(tr("Command-line options")); |
|
|
|
QString header = tr("Usage:") + "\n" + |
|
|
|
QTextCursor cursor(ui->helpMessage->document()); |
|
|
|
" bitcoin-qt [" + tr("command-line options") + "] " + "\n"; |
|
|
|
cursor.insertText(version); |
|
|
|
|
|
|
|
cursor.insertBlock(); |
|
|
|
|
|
|
|
cursor.insertText(tr("Usage:") + '\n' + |
|
|
|
|
|
|
|
" bitcoin-qt [" + tr("command-line options") + "]\n"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cursor.insertBlock(); |
|
|
|
|
|
|
|
QTextTableFormat tf; |
|
|
|
|
|
|
|
tf.setBorderStyle(QTextFrameFormat::BorderStyle_None); |
|
|
|
|
|
|
|
tf.setCellPadding(2); |
|
|
|
|
|
|
|
QVector<QTextLength> widths; |
|
|
|
|
|
|
|
widths << QTextLength(QTextLength::PercentageLength, 20); |
|
|
|
|
|
|
|
widths << QTextLength(QTextLength::PercentageLength, 80); |
|
|
|
|
|
|
|
tf.setColumnWidthConstraints(widths); |
|
|
|
|
|
|
|
QTextTable *table = cursor.insertTable(2, 2, tf); |
|
|
|
|
|
|
|
|
|
|
|
QString coreOptions = QString::fromStdString(HelpMessage(HMM_BITCOIN_QT)); |
|
|
|
QString coreOptions = QString::fromStdString(HelpMessage(HMM_BITCOIN_QT)); |
|
|
|
|
|
|
|
bool first = true; |
|
|
|
QString uiOptions = tr("UI options") + ":\n" + |
|
|
|
QTextCharFormat bold; |
|
|
|
" -choosedatadir " + tr("Choose data directory on startup (default: 0)") + "\n" + |
|
|
|
bold.setFontWeight(QFont::Bold); |
|
|
|
" -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" + |
|
|
|
// note that coreOptions is not translated.
|
|
|
|
" -min " + tr("Start minimized") + "\n" + |
|
|
|
foreach (const QString &line, coreOptions.split('\n')) { |
|
|
|
" -rootcertificates=<file> " + tr("Set SSL root certificates for payment request (default: -system-)") + "\n" + |
|
|
|
if (!first) { |
|
|
|
" -splash " + tr("Show splash screen on startup (default: 1)"); |
|
|
|
table->appendRows(1); |
|
|
|
|
|
|
|
cursor.movePosition(QTextCursor::NextRow); |
|
|
|
ui->helpMessageLabel->setFont(GUIUtil::bitcoinAddressFont()); |
|
|
|
} |
|
|
|
text = version + "\n" + header + "\n" + coreOptions + "\n" + uiOptions; |
|
|
|
first = false; |
|
|
|
ui->helpMessageLabel->setText(text); |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|