|
29 | 29 | #include <QVBoxLayout> |
30 | 30 |
|
31 | 31 | /** "Help message" or "About" dialog box */ |
32 | | -HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) : |
| 32 | +HelpMessageDialog::HelpMessageDialog(QWidget *parent, Mode _mode) : |
33 | 33 | QDialog(parent, GUIUtil::dialog_flags), |
34 | | - ui(new Ui::HelpMessageDialog) |
| 34 | + ui(new Ui::HelpMessageDialog), |
| 35 | + mode(_mode) |
35 | 36 | { |
36 | 37 | ui->setupUi(this); |
37 | 38 |
|
38 | 39 | QString version = QString{PACKAGE_NAME} + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion()); |
39 | 40 |
|
40 | | - if (about) |
| 41 | + switch(mode) |
41 | 42 | { |
42 | | - setWindowTitle(tr("About %1").arg(PACKAGE_NAME)); |
43 | | - |
44 | | - std::string licenseInfo = LicenseInfo(); |
45 | | - /// HTML-format the license message from the core |
46 | | - QString licenseInfoHTML = QString::fromStdString(LicenseInfo()); |
47 | | - // Make URLs clickable |
48 | | - QRegularExpression uri(QStringLiteral("<(.*)>"), QRegularExpression::InvertedGreedinessOption); |
49 | | - licenseInfoHTML.replace(uri, QStringLiteral("<a href=\"\\1\">\\1</a>")); |
50 | | - // Replace newlines with HTML breaks |
51 | | - licenseInfoHTML.replace("\n", "<br>"); |
52 | | - |
53 | | - ui->aboutMessage->setTextFormat(Qt::RichText); |
54 | | - ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
55 | | - text = version + "\n" + QString::fromStdString(FormatParagraph(licenseInfo)); |
56 | | - ui->aboutMessage->setText(version + "<br><br>" + licenseInfoHTML); |
57 | | - ui->aboutMessage->setWordWrap(true); |
58 | | - ui->helpMessage->setVisible(false); |
59 | | - } else { |
| 43 | + case AboutMode: |
| 44 | + { |
| 45 | + setWindowTitle(tr("About %1").arg(PACKAGE_NAME)); |
| 46 | + |
| 47 | + std::string licenseInfo = LicenseInfo(); |
| 48 | + /// HTML-format the license message from the core |
| 49 | + QString licenseInfoHTML = QString::fromStdString(LicenseInfo()); |
| 50 | + // Make URLs clickable |
| 51 | + QRegularExpression uri(QStringLiteral("<(.*)>"), QRegularExpression::InvertedGreedinessOption); |
| 52 | + licenseInfoHTML.replace(uri, QStringLiteral("<a href=\"\\1\">\\1</a>")); |
| 53 | + // Replace newlines with HTML breaks |
| 54 | + licenseInfoHTML.replace("\n", "<br>"); |
| 55 | + |
| 56 | + ui->aboutMessage->setTextFormat(Qt::RichText); |
| 57 | + ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
| 58 | + text = version + "\n" + QString::fromStdString(FormatParagraph(licenseInfo)); |
| 59 | + ui->aboutMessage->setText(version + "<br><br>" + licenseInfoHTML); |
| 60 | + ui->aboutMessage->setWordWrap(true); |
| 61 | + ui->helpMessage->setVisible(false); |
| 62 | + break; |
| 63 | + } |
| 64 | + case CommandLineOptionsMode: |
60 | 65 | setWindowTitle(tr("Command-line options")); |
61 | 66 | QString header = "Usage: bitcoin-qt [command-line options] \n"; |
62 | 67 | QTextCursor cursor(ui->helpMessage->document()); |
@@ -103,6 +108,7 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) : |
103 | 108 | ui->helpMessage->moveCursor(QTextCursor::Start); |
104 | 109 | ui->scrollArea->setVisible(false); |
105 | 110 | ui->aboutLogo->setVisible(false); |
| 111 | + break; |
106 | 112 | } |
107 | 113 |
|
108 | 114 | GUIUtil::handleCloseWindowShortcut(this); |
|
0 commit comments