[Qt] add utilitydialog.cpp/h and helpmessage class
- adds a nice and well formated dialog, which displays our -? help message (all options/paramaters) - moves aboutdialog.cpp/h to the new utilitydialog - move GUI shutdown window to utilitydialog
This commit is contained in:
@@ -591,47 +591,6 @@ void restoreWindowGeometry(const QString& strSetting, const QSize& defaultSize,
|
||||
parent->move(pos);
|
||||
}
|
||||
|
||||
HelpMessageBox::HelpMessageBox(QWidget *parent) :
|
||||
QMessageBox(parent)
|
||||
{
|
||||
header = tr("Bitcoin Core") + " " + tr("version") + " " +
|
||||
QString::fromStdString(FormatFullVersion()) + "\n\n" +
|
||||
tr("Usage:") + "\n" +
|
||||
" bitcoin-qt [" + tr("command-line options") + "] " + "\n";
|
||||
|
||||
coreOptions = QString::fromStdString(HelpMessage(HMM_BITCOIN_QT));
|
||||
|
||||
uiOptions = tr("UI options") + ":\n" +
|
||||
" -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" +
|
||||
" -min " + tr("Start minimized") + "\n" +
|
||||
" -splash " + tr("Show splash screen on startup (default: 1)") + "\n" +
|
||||
" -choosedatadir " + tr("Choose data directory on startup (default: 0)") + "\n";
|
||||
|
||||
setWindowTitle(tr("Bitcoin Core"));
|
||||
setTextFormat(Qt::PlainText);
|
||||
// setMinimumWidth is ignored for QMessageBox so put in non-breaking spaces to make it wider.
|
||||
setText(header + QString(QChar(0x2003)).repeated(50));
|
||||
setDetailedText(coreOptions + "\n" + uiOptions);
|
||||
}
|
||||
|
||||
void HelpMessageBox::printToConsole()
|
||||
{
|
||||
// On other operating systems, the expected action is to print the message to the console.
|
||||
QString strUsage = header + "\n" + coreOptions + "\n" + uiOptions;
|
||||
fprintf(stdout, "%s", strUsage.toStdString().c_str());
|
||||
}
|
||||
|
||||
void HelpMessageBox::showOrPrint()
|
||||
{
|
||||
#if defined(WIN32)
|
||||
// On Windows, show a message box, as there is no stderr/stdout in windowed applications
|
||||
exec();
|
||||
#else
|
||||
// On other operating systems, print help text to console
|
||||
printToConsole();
|
||||
#endif
|
||||
}
|
||||
|
||||
void setClipboard(const QString& str)
|
||||
{
|
||||
QApplication::clipboard()->setText(str, QClipboard::Clipboard);
|
||||
|
||||
Reference in New Issue
Block a user