9 #include <qt/forms/ui_helpmessagedialog.h>
20 #include <QCloseEvent>
22 #include <QMainWindow>
23 #include <QRegularExpression>
25 #include <QTextCursor>
27 #include <QVBoxLayout>
44 QString licenseInfoHTML = QString::fromStdString(
LicenseInfo());
46 QRegularExpression uri(QStringLiteral(
"<(.*)>"), QRegularExpression::InvertedGreedinessOption);
47 licenseInfoHTML.replace(uri, QStringLiteral(
"<a href=\"\\1\">\\1</a>"));
49 licenseInfoHTML.replace(
"\n",
"<br>");
51 ui->aboutMessage->setTextFormat(Qt::RichText);
52 ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
54 ui->aboutMessage->setText(version +
"<br><br>" + licenseInfoHTML);
55 ui->aboutMessage->setWordWrap(
true);
56 ui->helpMessage->setVisible(
false);
58 setWindowTitle(tr(
"Command-line options"));
59 QString header =
"Usage: bitcoin-qt [command-line options] [URI]\n\n"
60 "Optional URI is a Bitcoin address in BIP21 URI format.\n";
61 QTextCursor cursor(
ui->helpMessage->document());
62 cursor.insertText(version);
64 cursor.insertText(header);
68 QString coreOptions = QString::fromStdString(strUsage);
69 text = version +
"\n\n" + header +
"\n" + coreOptions;
72 tf.setBorderStyle(QTextFrameFormat::BorderStyle_None);
74 QVector<QTextLength> widths;
75 widths << QTextLength(QTextLength::PercentageLength, 35);
76 widths << QTextLength(QTextLength::PercentageLength, 65);
77 tf.setColumnWidthConstraints(widths);
80 bold.setFontWeight(QFont::Bold);
82 for (
const QString &line : coreOptions.split(
"\n")) {
83 if (line.startsWith(
" -"))
85 cursor.currentTable()->appendRows(1);
86 cursor.movePosition(QTextCursor::PreviousCell);
87 cursor.movePosition(QTextCursor::NextRow);
88 cursor.insertText(line.trimmed());
89 cursor.movePosition(QTextCursor::NextCell);
90 }
else if (line.startsWith(
" ")) {
91 cursor.insertText(line.trimmed()+
' ');
92 }
else if (line.size() > 0) {
94 if (cursor.currentTable())
95 cursor.currentTable()->appendRows(1);
96 cursor.movePosition(QTextCursor::Down);
97 cursor.insertText(line.trimmed(), bold);
98 cursor.insertTable(1, 2, tf);
102 ui->helpMessage->moveCursor(QTextCursor::Start);
103 ui->scrollArea->setVisible(
false);
104 ui->aboutLogo->setVisible(
false);
142 QVBoxLayout *layout =
new QVBoxLayout();
143 layout->addWidget(
new QLabel(
144 tr(
"%1 is shutting down…").arg(
PACKAGE_NAME) +
"<br /><br />" +
145 tr(
"Do not shut down the computer until this window disappears.")));
153 assert(window !=
nullptr);
157 shutdownWindow->setWindowTitle(window->windowTitle());
160 const QPoint global = window->mapToGlobal(window->rect().center());
161 shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2);
162 shutdownWindow->show();
163 return shutdownWindow;
std::string GetHelpMessage() const
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.