6 #if defined(HAVE_CONFIG_H) 12 #include "ui_helpmessagedialog.h" 27 #include <QCloseEvent> 31 #include <QTextCursor> 32 #include <QVBoxLayout> 45 #if defined(__x86_64__) 46 version +=
" " + tr(
"(%1-bit)").arg(64);
47 #elif defined(__i386__ ) 48 version +=
" " + tr(
"(%1-bit)").arg(32);
56 QString licenseInfo = QString::fromStdString(
LicenseInfo());
57 QString licenseInfoHTML = licenseInfo;
59 QRegExp uri(
"<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2);
61 licenseInfoHTML.replace(uri,
"<a href=\"\\1\">\\1</a>");
63 licenseInfoHTML.replace(
"\n",
"<br>");
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);
72 setWindowTitle(tr(
"Command-line options"));
73 QString header = tr(
"Usage:") +
"\n" +
74 " raven-qt [" + tr(
"command-line options") +
"] " +
"\n";
75 QTextCursor cursor(
ui->helpMessage->document());
76 cursor.insertText(version);
78 cursor.insertText(header);
85 strUsage +=
HelpMessageOpt(
"-allowselfsignedrootcertificates",
strprintf(
"Allow self signed root certificates (default: %u)", DEFAULT_SELFSIGNED_ROOTCERTS));
87 strUsage +=
HelpMessageOpt(
"-choosedatadir",
strprintf(tr(
"Choose data directory on startup (default: %u)").toStdString(), DEFAULT_CHOOSE_DATADIR));
88 strUsage +=
HelpMessageOpt(
"-lang=<lang>", tr(
"Set language, for example \"de_DE\" (default: system locale)").toStdString());
89 strUsage +=
HelpMessageOpt(
"-min", tr(
"Start minimized").toStdString());
90 strUsage +=
HelpMessageOpt(
"-rootcertificates=<file>", tr(
"Set SSL root certificates for payment request (default: -system-)").toStdString());
91 strUsage +=
HelpMessageOpt(
"-splash",
strprintf(tr(
"Show splash screen on startup (default: %u)").toStdString(), DEFAULT_SPLASHSCREEN));
92 strUsage +=
HelpMessageOpt(
"-resetguisettings", tr(
"Reset all settings changed in the GUI").toStdString());
96 QString coreOptions = QString::fromStdString(strUsage);
97 text = version +
"\n" + header +
"\n" + coreOptions;
100 tf.setBorderStyle(QTextFrameFormat::BorderStyle_None);
101 tf.setCellPadding(2);
102 QVector<QTextLength> widths;
103 widths << QTextLength(QTextLength::PercentageLength, 35);
104 widths << QTextLength(QTextLength::PercentageLength, 65);
105 tf.setColumnWidthConstraints(widths);
107 QTextCharFormat bold;
108 bold.setFontWeight(QFont::Bold);
110 for (
const QString &line : coreOptions.split(
"\n")) {
111 if (line.startsWith(
" -"))
113 cursor.currentTable()->appendRows(1);
114 cursor.movePosition(QTextCursor::PreviousCell);
115 cursor.movePosition(QTextCursor::NextRow);
116 cursor.insertText(line.trimmed());
117 cursor.movePosition(QTextCursor::NextCell);
118 }
else if (line.startsWith(
" ")) {
119 cursor.insertText(line.trimmed()+
' ');
120 }
else if (line.size() > 0) {
122 if (cursor.currentTable())
123 cursor.currentTable()->appendRows(1);
124 cursor.movePosition(QTextCursor::Down);
125 cursor.insertText(line.trimmed(), bold);
126 cursor.insertTable(1, 2, tf);
130 ui->helpMessage->moveCursor(QTextCursor::Start);
131 ui->scrollArea->setVisible(
false);
132 ui->aboutLogo->setVisible(
false);
144 fprintf(stdout,
"%s\n", qPrintable(
text));
168 QVBoxLayout *layout =
new QVBoxLayout();
169 layout->addWidget(
new QLabel(
170 tr(
"%1 is shutting down...").arg(tr(
PACKAGE_NAME)) +
"<br /><br />" +
171 tr(
"Do not shut down the computer until this window disappears.")));
182 shutdownWindow->setWindowTitle(window->windowTitle());
185 const QPoint global = window->mapToGlobal(window->rect().center());
186 shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2);
187 shutdownWindow->show();
188 return shutdownWindow;
std::string HelpMessageOpt(const std::string &option, const std::string &message)
Format a string to be used as option description in help messages.
void on_okButton_accepted()
ShutdownWindow(QWidget *parent=0, Qt::WindowFlags f=0)
"Shutdown" window
HelpMessageDialog(QWidget *parent, bool about)
"Help message" or "About" dialog box
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
std::string LicenseInfo()
Returns licensing information (for -version)
void closeEvent(QCloseEvent *event)
std::string HelpMessage(HelpMessageMode mode)
Help for options shared between UI and daemon (for -help)
static QWidget * showShutdownWindow(RavenGUI *window)
static const std::string DEFAULT_UIPLATFORM
std::string FormatFullVersion()
Ui::HelpMessageDialog * ui
"Help message" dialog box
std::string HelpMessageGroup(const std::string &message)
Format a string to be used as group of options in help messages.