5 #if defined(HAVE_CONFIG_H) 6 #include <config/bitcoin-config.h> 14 #include <qt/forms/ui_helpmessagedialog.h> 21 #include <QCloseEvent> 23 #include <QMainWindow> 25 #include <QTextCursor> 27 #include <QVBoxLayout> 36 QString version = QString{PACKAGE_NAME} +
" " + tr(
"version") +
" " +
41 setWindowTitle(tr(
"About %1").arg(PACKAGE_NAME));
45 QString licenseInfoHTML = QString::fromStdString(
LicenseInfo());
47 QRegExp uri(
"<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2);
49 licenseInfoHTML.replace(uri,
"<a href=\"\\1\">\\1</a>");
51 licenseInfoHTML.replace(
"\n",
"<br>");
53 ui->aboutMessage->setTextFormat(Qt::RichText);
54 ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
55 text = version +
"\n" +
57 ui->aboutMessage->setText(version +
"<br><br>" + licenseInfoHTML);
58 ui->aboutMessage->setWordWrap(
true);
59 ui->helpMessage->setVisible(
false);
61 setWindowTitle(tr(
"Command-line options"));
63 "Usage: bitcoin-qt [command-line options] \n";
64 QTextCursor cursor(
ui->helpMessage->document());
65 cursor.insertText(version);
67 cursor.insertText(header);
71 QString coreOptions = QString::fromStdString(strUsage);
72 text = version +
"\n\n" + header +
"\n" + coreOptions;
75 tf.setBorderStyle(QTextFrameFormat::BorderStyle_None);
77 QVector<QTextLength> widths;
78 widths << QTextLength(QTextLength::PercentageLength, 35);
79 widths << QTextLength(QTextLength::PercentageLength, 65);
80 tf.setColumnWidthConstraints(widths);
83 bold.setFontWeight(QFont::Bold);
85 for (
const QString &line : coreOptions.split(
"\n")) {
86 if (line.startsWith(
" -")) {
87 cursor.currentTable()->appendRows(1);
88 cursor.movePosition(QTextCursor::PreviousCell);
89 cursor.movePosition(QTextCursor::NextRow);
90 cursor.insertText(line.trimmed());
91 cursor.movePosition(QTextCursor::NextCell);
92 }
else if (line.startsWith(
" ")) {
93 cursor.insertText(line.trimmed() +
' ');
94 }
else if (line.size() > 0) {
96 if (cursor.currentTable()) {
97 cursor.currentTable()->appendRows(1);
99 cursor.movePosition(QTextCursor::Down);
100 cursor.insertText(line.trimmed(), bold);
101 cursor.insertTable(1, 2, tf);
105 ui->helpMessage->moveCursor(QTextCursor::Start);
106 ui->scrollArea->setVisible(
false);
107 ui->aboutLogo->setVisible(
false);
138 QVBoxLayout *layout =
new QVBoxLayout();
139 layout->addWidget(
new QLabel(
140 tr(
"%1 is shutting down...").arg(PACKAGE_NAME) +
"<br /><br />" +
141 tr(
"Do not shut down the computer until this window disappears.")));
146 assert(window !=
nullptr);
150 shutdownWindow->setWindowTitle(window->windowTitle());
153 const QPoint global = window->mapToGlobal(window->rect().center());
154 shutdownWindow->move(global.x() - shutdownWindow->width() / 2,
155 global.y() - shutdownWindow->height() / 2);
156 shutdownWindow->show();
157 return shutdownWindow;
std::string FormatParagraph(const std::string &in, size_t width, size_t indent)
Format a paragraph of text to a fixed width, adding spaces for indentation to any added line...
const std::string NETWORK_NAME
void on_okButton_accepted()
HelpMessageDialog(QWidget *parent, bool about)
"Help message" or "About" dialog box
std::string LicenseInfo()
Returns licensing information (for -version)
std::string GetHelpMessage() const
Get the help string.
static QWidget * showShutdownWindow(QMainWindow *window)
ShutdownWindow(QWidget *parent=nullptr)
"Shutdown" window
std::string FormatFullVersion()
Ui::HelpMessageDialog * ui
"Help message" dialog box
void closeEvent(QCloseEvent *event) override