10 #include "ui_helpmessagedialog.h"
24 #include <QCloseEvent>
28 #include <QTextCursor>
29 #include <QVBoxLayout>
38 QString version = tr(
"PRCY") +
" " + tr(
"version") +
" " + QString::fromStdString(
FormatFullVersion());
42 #if defined(__x86_64__)
43 version +=
" " + tr(
"(%1-bit)").arg(64);
44 #elif defined(__i386__)
45 version +=
" " + tr(
"(%1-bit)").arg(32);
49 setWindowTitle(tr(
"About PRCY"));
52 QString licenseInfo = QString::fromStdString(
LicenseInfo());
53 QString licenseInfoHTML = licenseInfo;
56 QRegExp uri(
"<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2);
58 licenseInfoHTML.replace(uri,
"<a href=\"\\1\">\\1</a>");
60 licenseInfoHTML.replace(
"\n\n",
"<br><br>");
62 ui->aboutMessage->setTextFormat(Qt::RichText);
63 ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
64 text = version +
"\n" + licenseInfo;
65 ui->aboutMessage->setText(version +
"<br><br>" + licenseInfoHTML);
66 ui->aboutMessage->setWordWrap(
true);
67 ui->helpMessage->setVisible(
false);
69 setWindowTitle(tr(
"Command-line options"));
70 QString header = tr(
"Usage:") +
"\n" +
71 " prcycoin-qt [" + tr(
"command-line options") +
"] " +
"\n";
72 QTextCursor cursor(
ui->helpMessage->document());
73 cursor.insertText(version);
75 cursor.insertText(header);
80 strUsage +=
HelpMessageOpt(
"-choosedatadir",
strprintf(tr(
"Choose data directory on startup (default: %u)").toStdString(), DEFAULT_CHOOSE_DATADIR));
81 strUsage +=
HelpMessageOpt(
"-lang=<lang>", tr(
"Set language, for example \"de_DE\" (default: system locale)").toStdString());
82 strUsage +=
HelpMessageOpt(
"-min", tr(
"Start minimized").toStdString());
83 strUsage +=
HelpMessageOpt(
"-splash",
strprintf(tr(
"Show splash screen on startup (default: %u)").toStdString(), DEFAULT_SPLASHSCREEN));
84 QString coreOptions = QString::fromStdString(strUsage);
85 text = version +
"\n" + header +
"\n" + coreOptions;
88 tf.setBorderStyle(QTextFrameFormat::BorderStyle_None);
90 QVector<QTextLength> widths;
91 widths << QTextLength(QTextLength::PercentageLength, 35);
92 widths << QTextLength(QTextLength::PercentageLength, 65);
93 tf.setColumnWidthConstraints(widths);
96 bold.setFontWeight(QFont::Bold);
98 Q_FOREACH (
const QString &line, coreOptions.split(
"\n")) {
99 if (line.startsWith(
" -"))
101 cursor.currentTable()->appendRows(1);
102 cursor.movePosition(QTextCursor::PreviousCell);
103 cursor.movePosition(QTextCursor::NextRow);
104 cursor.insertText(line.trimmed());
105 cursor.movePosition(QTextCursor::NextCell);
106 }
else if (line.startsWith(
" ")) {
107 cursor.insertText(line.trimmed()+
' ');
108 }
else if (line.size() > 0) {
110 if (cursor.currentTable())
111 cursor.currentTable()->appendRows(1);
112 cursor.movePosition(QTextCursor::Down);
113 cursor.insertText(line.trimmed(), bold);
114 cursor.insertTable(1, 2, tf);
118 ui->helpMessage->moveCursor(QTextCursor::Start);
119 ui->scrollArea->setVisible(
false);
132 fprintf(stdout,
"%s\n", qPrintable(
text));
155 QVBoxLayout* layout =
new QVBoxLayout();
156 layout->addWidget(
new QLabel(
157 tr(
"PRCY is shutting down...") +
"<br /><br />" +
158 tr(
"Do not shut down the computer until this window disappears.")));
171 shutdownWindow->setAttribute(Qt::WA_DeleteOnClose);
172 shutdownWindow->setWindowTitle(window->windowTitle());
175 const QPoint global = window->mapToGlobal(window->rect().center());
176 shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2);
177 shutdownWindow->show();