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