5 #if defined(HAVE_CONFIG_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>");
54 ui->
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
60 setWindowTitle(tr(
"Command-line options"));
61 QString header =
"Usage: bitcoin-qt [command-line options] [URI]\n\n" 62 "Optional URI is a Bitcoin address in BIP21 URI format.\n";
64 cursor.insertText(version);
66 cursor.insertText(header);
70 QString coreOptions = QString::fromStdString(strUsage);
71 text = version +
"\n\n" + header +
"\n" + coreOptions;
74 tf.setBorderStyle(QTextFrameFormat::BorderStyle_None);
76 QVector<QTextLength> widths;
77 widths << QTextLength(QTextLength::PercentageLength, 35);
78 widths << QTextLength(QTextLength::PercentageLength, 65);
79 tf.setColumnWidthConstraints(widths);
82 bold.setFontWeight(QFont::Bold);
84 for (
const QString &line : coreOptions.split(
"\n")) {
85 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);
98 cursor.movePosition(QTextCursor::Down);
99 cursor.insertText(line.trimmed(), bold);
100 cursor.insertTable(1, 2, tf);
144 QVBoxLayout *layout =
new QVBoxLayout();
145 layout->addWidget(
new QLabel(
146 tr(
"%1 is shutting down…").arg(
PACKAGE_NAME) +
"<br /><br />" +
147 tr(
"Do not shut down the computer until this window disappears.")));
155 assert(window !=
nullptr);
159 shutdownWindow->setWindowTitle(window->windowTitle());
162 const QPoint global = window->mapToGlobal(window->rect().center());
163 shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2);
164 shutdownWindow->show();
165 return shutdownWindow;
Utility functions used by the Bitcoin Qt UI.
void on_okButton_accepted()
HelpMessageDialog(QWidget *parent, bool about)
"Help message" or "About" dialog box
std::string LicenseInfo()
Returns licensing information (for -version)
void setupUi(QDialog *HelpMessageDialog)
std::string GetHelpMessage() const
Get the help string.
constexpr auto dialog_flags
static QWidget * showShutdownWindow(QMainWindow *window)
void handleCloseWindowShortcut(QWidget *w)
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...
std::string FormatFullVersion()
Ui::HelpMessageDialog * ui
ShutdownWindow(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::Widget)
"Shutdown" window
"Help message" dialog box
void closeEvent(QCloseEvent *event) override