"Help message" or "About" dialog box */
| 33 | |
| 34 | /** "Help message" or "About" dialog box */ |
| 35 | HelpMessageDialog::HelpMessageDialog(interfaces::Node& node, QWidget *parent, bool about) : |
| 36 | QDialog(parent), |
| 37 | ui(new Ui::HelpMessageDialog) |
| 38 | { |
| 39 | ui->setupUi(this); |
| 40 | |
| 41 | QString version = tr(PACKAGE_NAME) + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion()); |
| 42 | /* On x86 add a bit specifier to the version so that users can distinguish between |
| 43 | * 32 and 64 bit builds. On other architectures, 32/64 bit may be more ambiguous. |
| 44 | */ |
| 45 | #if defined(__x86_64__) |
| 46 | version += " " + tr("(%1-bit)").arg(64); |
| 47 | #elif defined(__i386__ ) |
| 48 | version += " " + tr("(%1-bit)").arg(32); |
| 49 | #endif |
| 50 | |
| 51 | if (about) |
| 52 | { |
| 53 | setWindowTitle(tr("About %1").arg(tr(PACKAGE_NAME))); |
| 54 | |
| 55 | /// HTML-format the license message from the core |
| 56 | QString licenseInfo = QString::fromStdString(LicenseInfo()); |
| 57 | QString licenseInfoHTML = licenseInfo; |
| 58 | // Make URLs clickable |
| 59 | QRegExp uri("<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2); |
| 60 | uri.setMinimal(true); // use non-greedy matching |
| 61 | licenseInfoHTML.replace(uri, "<a href=\"\\1\">\\1</a>"); |
| 62 | // Replace newlines with HTML breaks |
| 63 | licenseInfoHTML.replace("\n", "<br>"); |
| 64 | |
| 65 | ui->aboutMessage->setTextFormat(Qt::RichText); |
| 66 | ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
| 67 | text = version + "\n" + licenseInfo; |
| 68 | ui->aboutMessage->setText(version + "<br><br>" + licenseInfoHTML); |
| 69 | ui->aboutMessage->setWordWrap(true); |
| 70 | ui->helpMessage->setVisible(false); |
| 71 | } else { |
| 72 | setWindowTitle(tr("Command-line options")); |
| 73 | QString header = "Usage: bitcoin-qt [command-line options] \n"; |
| 74 | QTextCursor cursor(ui->helpMessage->document()); |
| 75 | cursor.insertText(version); |
| 76 | cursor.insertBlock(); |
| 77 | cursor.insertText(header); |
| 78 | cursor.insertBlock(); |
| 79 | |
| 80 | std::string strUsage = gArgs.GetHelpMessage(); |
| 81 | QString coreOptions = QString::fromStdString(strUsage); |
| 82 | text = version + "\n\n" + header + "\n" + coreOptions; |
| 83 | |
| 84 | QTextTableFormat tf; |
| 85 | tf.setBorderStyle(QTextFrameFormat::BorderStyle_None); |
| 86 | tf.setCellPadding(2); |
| 87 | QVector<QTextLength> widths; |
| 88 | widths << QTextLength(QTextLength::PercentageLength, 35); |
| 89 | widths << QTextLength(QTextLength::PercentageLength, 65); |
| 90 | tf.setColumnWidthConstraints(widths); |
| 91 | |
| 92 | QTextCharFormat bold; |
nothing calls this directly
no test coverage detected