5#include <bitcoin-build-config.h>
9#include <qt/forms/ui_helpmessagedialog.h>
24#include <QRegularExpression>
37 QString version = QString{CLIENT_NAME} +
" " + tr(
"version") +
" " + QString::fromStdString(
FormatFullVersion());
41 setWindowTitle(tr(
"About %1").arg(CLIENT_NAME));
45 QString licenseInfoHTML = QString::fromStdString(
LicenseInfo());
47 QRegularExpression uri(QStringLiteral(
"<(.*)>"), QRegularExpression::InvertedGreedinessOption);
48 licenseInfoHTML.replace(uri, QStringLiteral(
"<a href=\"\\1\">\\1</a>"));
50 licenseInfoHTML.replace(
"\n",
"<br>");
52 ui->aboutMessage->setTextFormat(Qt::RichText);
53 ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
55 ui->aboutMessage->setText(version +
"<br><br>" + licenseInfoHTML);
56 ui->aboutMessage->setWordWrap(
true);
57 ui->helpMessage->setVisible(
false);
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);
68 cursor.insertText(header);
72 QString coreOptions = QString::fromStdString(strUsage);
73 text = version +
"\n\n" + header +
"\n" + coreOptions;
76 tf.setBorderStyle(QTextFrameFormat::BorderStyle_None);
78 QVector<QTextLength> widths;
79 widths << QTextLength(QTextLength::PercentageLength, 35);
80 widths << QTextLength(QTextLength::PercentageLength, 65);
81 tf.setColumnWidthConstraints(widths);
84 bold.setFontWeight(QFont::Bold);
86 for (
const QString &line : coreOptions.split(
"\n")) {
87 if (line.startsWith(
" -"))
89 cursor.currentTable()->appendRows(1);
90 cursor.movePosition(QTextCursor::PreviousCell);
91 cursor.movePosition(QTextCursor::NextRow);
92 cursor.insertText(line.trimmed());
93 cursor.movePosition(QTextCursor::NextCell);
94 }
else if (line.startsWith(
" ")) {
95 cursor.insertText(line.trimmed()+
' ');
96 }
else if (line.size() > 0) {
98 if (cursor.currentTable())
99 cursor.currentTable()->appendRows(1);
100 cursor.movePosition(QTextCursor::Down);
101 cursor.insertText(line.trimmed(), bold);
102 cursor.insertTable(1, 2, tf);
106 ui->helpMessage->moveCursor(QTextCursor::Start);
107 ui->scrollArea->setVisible(
false);
108 ui->aboutLogo->setVisible(
false);
146 QVBoxLayout *layout =
new QVBoxLayout();
147 layout->addWidget(
new QLabel(
148 tr(
"%1 is shutting down…").arg(CLIENT_NAME) +
"<br /><br />" +
149 tr(
"Do not shut down the computer until this window disappears.")));
157 assert(window !=
nullptr);
161 shutdownWindow->setWindowTitle(window->windowTitle());
164 const QPoint global = window->mapToGlobal(window->rect().center());
165 shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2);
166 shutdownWindow->show();
167 return shutdownWindow;
std::string GetHelpMessage() const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
Get the help string.
"Help message" dialog box
void on_okButton_accepted()
HelpMessageDialog(QWidget *parent, bool about)
"Help message" or "About" dialog box
Ui::HelpMessageDialog * ui
ShutdownWindow(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::Widget)
"Shutdown" window
void closeEvent(QCloseEvent *event) override
static QWidget * showShutdownWindow(QMainWindow *window)
std::string FormatFullVersion()
std::string LicenseInfo()
Returns licensing information (for -version)
Utility functions used by the Bitcoin Qt UI.
void handleCloseWindowShortcut(QWidget *w)
constexpr auto dialog_flags
std::string FormatParagraph(std::string_view in, size_t width, size_t indent)
Format a paragraph of text to a fixed width, adding spaces for indentation to any added line.