5 #if defined(HAVE_CONFIG_H) 26 #include <QCloseEvent> 30 #include <QTextCursor> 31 #include <QVBoxLayout> 44 #if defined(__x86_64__) 45 version +=
" " + tr(
"(%1-bit)").arg(64);
46 #elif defined(__i386__ ) 47 version +=
" " + tr(
"(%1-bit)").arg(32);
55 QString licenseInfo = QString::fromStdString(
LicenseInfo());
56 QString licenseInfoHTML = licenseInfo;
58 QRegExp uri(
"<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2);
60 licenseInfoHTML.replace(uri,
"<a href=\"\\1\">\\1</a>");
62 licenseInfoHTML.replace(
"\n",
"<br>");
65 ui->
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
66 text = version +
"\n" + licenseInfo;
71 setWindowTitle(tr(
"Command-line options"));
72 QString header = tr(
"Usage:") +
"\n" +
73 " fabcoin-qt [" + tr(
"command-line options") +
"] " +
"\n";
75 cursor.insertText(version);
77 cursor.insertText(header);
84 strUsage +=
HelpMessageOpt(
"-allowselfsignedrootcertificates",
strprintf(
"Allow self signed root certificates (default: %u)", DEFAULT_SELFSIGNED_ROOTCERTS));
86 strUsage +=
HelpMessageOpt(
"-choosedatadir",
strprintf(tr(
"Choose data directory on startup (default: %u)").toStdString(), DEFAULT_CHOOSE_DATADIR));
87 strUsage +=
HelpMessageOpt(
"-lang=<lang>", tr(
"Set language, for example \"de_DE\" (default: system locale)").toStdString());
88 strUsage +=
HelpMessageOpt(
"-min", tr(
"Start minimized").toStdString());
89 strUsage +=
HelpMessageOpt(
"-rootcertificates=<file>", tr(
"Set SSL root certificates for payment request (default: -system-)").toStdString());
90 strUsage +=
HelpMessageOpt(
"-splash",
strprintf(tr(
"Show splash screen on startup (default: %u)").toStdString(), DEFAULT_SPLASHSCREEN));
91 strUsage +=
HelpMessageOpt(
"-resetguisettings", tr(
"Reset all settings changed in the GUI").toStdString());
95 QString coreOptions = QString::fromStdString(strUsage);
96 text = version +
"\n" + header +
"\n" + coreOptions;
99 tf.setBorderStyle(QTextFrameFormat::BorderStyle_None);
100 tf.setCellPadding(2);
101 QVector<QTextLength> widths;
102 widths << QTextLength(QTextLength::PercentageLength, 35);
103 widths << QTextLength(QTextLength::PercentageLength, 65);
104 tf.setColumnWidthConstraints(widths);
106 QTextCharFormat bold;
107 bold.setFontWeight(QFont::Bold);
109 for (
const QString &line : coreOptions.split(
"\n")) {
110 if (line.startsWith(
" -"))
112 cursor.currentTable()->appendRows(1);
113 cursor.movePosition(QTextCursor::PreviousCell);
114 cursor.movePosition(QTextCursor::NextRow);
115 cursor.insertText(line.trimmed());
116 cursor.movePosition(QTextCursor::NextCell);
117 }
else if (line.startsWith(
" ")) {
118 cursor.insertText(line.trimmed()+
' ');
119 }
else if (line.size() > 0) {
121 if (cursor.currentTable())
122 cursor.currentTable()->appendRows(1);
123 cursor.movePosition(QTextCursor::Down);
124 cursor.insertText(line.trimmed(), bold);
125 cursor.insertTable(1, 2, tf);
143 fprintf(stdout,
"%s\n", qPrintable(
text));
167 QVBoxLayout *layout =
new QVBoxLayout();
168 layout->addWidget(
new QLabel(
169 tr(
"%1 is shutting down...").arg(tr(
PACKAGE_NAME)) +
"<br /><br />" +
170 tr(
"Do not shut down the computer until this window disappears.")));
181 shutdownWindow->setObjectName(
"shutdownWindow");
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()
static const std::string DEFAULT_UIPLATFORM
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)
Return boolean argument or default value.
std::string LicenseInfo()
Returns licensing information (for -version)
void closeEvent(QCloseEvent *event)
void setupUi(QDialog *HelpMessageDialog)
std::string HelpMessage(HelpMessageMode mode)
Help for options shared between UI and daemon (for -help)
static QWidget * showShutdownWindow(FabcoinGUI *window)
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.