MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / HelpMessageDialog

Method HelpMessageDialog

src/qt/utilitydialog.cpp:31–112  ·  view source on GitHub ↗

"Help message" or "About" dialog box */

Source from the content-addressed store, hash-verified

29
30/** "Help message" or "About" dialog box */
31HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
32 QDialog(parent, GUIUtil::dialog_flags),
33 ui(new Ui::HelpMessageDialog)
34{
35 ui->setupUi(this);
36
37 QString version = QString{CLIENT_NAME} + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion());
38
39 if (about)
40 {
41 setWindowTitle(tr("About %1").arg(CLIENT_NAME));
42
43 std::string licenseInfo = LicenseInfo();
44 /// HTML-format the license message from the core
45 QString licenseInfoHTML = QString::fromStdString(LicenseInfo());
46 // Make URLs clickable
47 QRegularExpression uri(QStringLiteral("<(.*)>"), QRegularExpression::InvertedGreedinessOption);
48 licenseInfoHTML.replace(uri, QStringLiteral("<a href=\"\\1\">\\1</a>"));
49 // Replace newlines with HTML breaks
50 licenseInfoHTML.replace("\n", "<br>");
51
52 ui->aboutMessage->setTextFormat(Qt::RichText);
53 ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
54 text = version + "\n" + QString::fromStdString(FormatParagraph(licenseInfo));
55 ui->aboutMessage->setText(version + "<br><br>" + licenseInfoHTML);
56 ui->aboutMessage->setWordWrap(true);
57 ui->helpMessage->setVisible(false);
58 } else {
59 setWindowTitle(tr("Command-line options"));
60 QString header = "The bitcoin-qt application provides a graphical interface for interacting with " CLIENT_NAME ".\n\n"
61 "It combines the core functionalities of bitcoind with a user-friendly interface for wallet management, transaction history, and network statistics.\n\n"
62 "It is suitable for users who prefer a graphical over a command-line interface.\n\n"
63 "You can optionally specify a payment [URI], in e.g. the BIP21 URI format.\n\n"
64 "Usage: bitcoin-qt [options] [URI]\n\n";
65 QTextCursor cursor(ui->helpMessage->document());
66 cursor.insertText(version);
67 cursor.insertBlock();
68 cursor.insertText(header);
69 cursor.insertBlock();
70
71 std::string strUsage = gArgs.GetHelpMessage();
72 QString coreOptions = QString::fromStdString(strUsage);
73 text = version + "\n\n" + header + "\n" + coreOptions;
74
75 QTextTableFormat tf;
76 tf.setBorderStyle(QTextFrameFormat::BorderStyle_None);
77 tf.setCellPadding(2);
78 QVector<QTextLength> widths;
79 widths << QTextLength(QTextLength::PercentageLength, 35);
80 widths << QTextLength(QTextLength::PercentageLength, 65);
81 tf.setColumnWidthConstraints(widths);
82
83 QTextCharFormat bold;
84 bold.setFontWeight(QFont::Bold);
85
86 for (const QString &line : coreOptions.split("\n")) {
87 if (line.startsWith(" -"))
88 {

Callers

nothing calls this directly

Calls 7

FormatFullVersionFunction · 0.85
LicenseInfoFunction · 0.85
FormatParagraphFunction · 0.85
setTextMethod · 0.80
GetHelpMessageMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected