5 #if defined(HAVE_CONFIG_H)
11 #include <qt/forms/ui_helpmessagedialog.h>
22 #include <QCloseEvent>
24 #include <QMainWindow>
25 #include <QRegularExpression>
27 #include <QTextCursor>
29 #include <QVBoxLayout>
46 QString licenseInfoHTML = QString::fromStdString(
LicenseInfo());
48 QRegularExpression uri(QStringLiteral(
"<(.*)>"), QRegularExpression::InvertedGreedinessOption);
49 licenseInfoHTML.replace(uri, QStringLiteral(
"<a href=\"\\1\">\\1</a>"));
51 licenseInfoHTML.replace(
"\n",
"<br>");
53 ui->aboutMessage->setTextFormat(Qt::RichText);
54 ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
56 ui->aboutMessage->setText(version +
"<br><br>" + licenseInfoHTML);
57 ui->aboutMessage->setWordWrap(
true);
58 ui->helpMessage->setVisible(
false);
60 setWindowTitle(tr(
"Command-line options"));
61 QString header =
"Usage: bitcoin-qt [command-line options] \n";
62 QTextCursor cursor(
ui->helpMessage->document());
63 cursor.insertText(version);
65 cursor.insertText(header);
69 QString coreOptions = QString::fromStdString(strUsage);
70 text = version +
"\n\n" + header +
"\n" + coreOptions;
73 tf.setBorderStyle(QTextFrameFormat::BorderStyle_None);
75 QVector<QTextLength> widths;
76 widths << QTextLength(QTextLength::PercentageLength, 35);
77 widths << QTextLength(QTextLength::PercentageLength, 65);
78 tf.setColumnWidthConstraints(widths);
81 bold.setFontWeight(QFont::Bold);
83 for (
const QString &line : coreOptions.split(
"\n")) {
84 if (line.startsWith(
" -"))
86 cursor.currentTable()->appendRows(1);
87 cursor.movePosition(QTextCursor::PreviousCell);
88 cursor.movePosition(QTextCursor::NextRow);
89 cursor.insertText(line.trimmed());
90 cursor.movePosition(QTextCursor::NextCell);
91 }
else if (line.startsWith(
" ")) {
92 cursor.insertText(line.trimmed()+
' ');
93 }
else if (line.size() > 0) {
95 if (cursor.currentTable())
96 cursor.currentTable()->appendRows(1);
97 cursor.movePosition(QTextCursor::Down);
98 cursor.insertText(line.trimmed(), bold);
99 cursor.insertTable(1, 2, tf);
103 ui->helpMessage->moveCursor(QTextCursor::Start);
104 ui->scrollArea->setVisible(
false);
105 ui->aboutLogo->setVisible(
false);
143 QVBoxLayout *layout =
new QVBoxLayout();
144 layout->addWidget(
new QLabel(
145 tr(
"%1 is shutting down…").arg(
PACKAGE_NAME) +
"<br /><br />" +
146 tr(
"Do not shut down the computer until this window disappears.")));
154 assert(window !=
nullptr);
158 shutdownWindow->setWindowTitle(window->windowTitle());
161 const QPoint global = window->mapToGlobal(window->rect().center());
162 shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2);
163 shutdownWindow->show();
164 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.