diff --git a/src/qt/forms/helpmessagedialog.ui b/src/qt/forms/helpmessagedialog.ui index 37008f047e..dc7df9d6c8 100644 --- a/src/qt/forms/helpmessagedialog.ui +++ b/src/qt/forms/helpmessagedialog.ui @@ -1,110 +1,192 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>HelpMessageDialog</class> <widget class="QDialog" name="HelpMessageDialog"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>780</width> <height>400</height> </rect> </property> <property name="windowTitle"> <string notr="true">Bitcoin Core - Command-line options</string> </property> <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>12</number> + </property> + <property name="topMargin"> + <number>12</number> + </property> + <property name="rightMargin"> + <number>12</number> + </property> + <property name="bottomMargin"> + <number>12</number> + </property> + <item> + <layout class="QVBoxLayout" name="verticalLayoutLogo" stretch="0,0"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>4</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="aboutLogo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Ignored"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>100</height> + </size> + </property> + <property name="pixmap"> + <pixmap resource="../bitcoin.qrc">:/icons/bitcoin</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + <item> + <widget class="QFrame" name="frame"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + </layout> + </item> <item> <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QTextEdit" name="helpMessage"> <property name="readOnly"> <bool>true</bool> </property> </widget> </item> <item> <widget class="QScrollArea" name="scrollArea"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> <property name="verticalScrollBarPolicy"> <enum>Qt::ScrollBarAlwaysOn</enum> </property> <property name="widgetResizable"> <bool>true</bool> </property> <widget class="QWidget" name="scrollAreaWidgetContents"> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> <widget class="QLabel" name="aboutMessage"> <property name="cursor"> <cursorShape>IBeamCursor</cursorShape> </property> <property name="textFormat"> <enum>Qt::PlainText</enum> </property> <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> </property> <property name="openExternalLinks"> <bool>true</bool> </property> <property name="textInteractionFlags"> <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> </property> </widget> </item> </layout> </widget> </widget> </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>4</width> + <height>4</height> + </size> + </property> + </spacer> + </item> <item> <widget class="QDialogButtonBox" name="okButton"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="standardButtons"> <set>QDialogButtonBox::Ok</set> </property> </widget> </item> </layout> </item> </layout> </widget> <resources> <include location="../bitcoin.qrc"/> </resources> <connections> <connection> <sender>okButton</sender> <signal>accepted()</signal> <receiver>HelpMessageDialog</receiver> <slot>accept()</slot> <hints> <hint type="sourcelabel"> <x>20</x> <y>20</y> </hint> <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> </hints> </connection> <connection> <sender>okButton</sender> <signal>rejected()</signal> <receiver>HelpMessageDialog</receiver> <slot>reject()</slot> <hints> <hint type="sourcelabel"> <x>20</x> <y>20</y> </hint> <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> </hints> </connection> </connections> </ui> diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index 4ef42b927e..63dd6efb52 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -1,204 +1,205 @@ // Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "utilitydialog.h" #include "ui_helpmessagedialog.h" #include "bitcoingui.h" #include "clientmodel.h" #include "guiutil.h" #include "clientversion.h" #include "init.h" #include "util.h" #include <stdio.h> #include <QCloseEvent> #include <QLabel> #include <QRegExp> #include <QTextTable> #include <QTextCursor> #include <QVBoxLayout> /** "Help message" or "About" dialog box */ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) : QDialog(parent), ui(new Ui::HelpMessageDialog) { ui->setupUi(this); GUIUtil::restoreWindowGeometry("nHelpMessageDialogWindow", this->size(), this); QString version = tr("Bitcoin Core") + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion()); /* On x86 add a bit specifier to the version so that users can distinguish between * 32 and 64 bit builds. On other architectures, 32/64 bit may be more ambigious. */ #if defined(__x86_64__) version += " " + tr("(%1-bit)").arg(64); #elif defined(__i386__ ) version += " " + tr("(%1-bit)").arg(32); #endif if (about) { setWindowTitle(tr("About Bitcoin Core")); /// HTML-format the license message from the core QString licenseInfo = QString::fromStdString(LicenseInfo()); QString licenseInfoHTML = licenseInfo; // Make URLs clickable QRegExp uri("<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2); uri.setMinimal(true); // use non-greedy matching licenseInfoHTML.replace(uri, "<a href=\"\\1\">\\1</a>"); // Replace newlines with HTML breaks licenseInfoHTML.replace("\n\n", "<br><br>"); ui->aboutMessage->setTextFormat(Qt::RichText); ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); text = version + "\n" + licenseInfo; ui->aboutMessage->setText(version + "<br><br>" + licenseInfoHTML); ui->aboutMessage->setWordWrap(true); ui->helpMessage->setVisible(false); } else { setWindowTitle(tr("Command-line options")); QTextCursor cursor(ui->helpMessage->document()); cursor.insertText(version); cursor.insertBlock(); cursor.insertText(tr("Usage:") + '\n' + " bitcoin-qt [" + tr("command-line options") + "]\n"); cursor.insertBlock(); QTextTableFormat tf; tf.setBorderStyle(QTextFrameFormat::BorderStyle_None); tf.setCellPadding(2); QVector<QTextLength> widths; widths << QTextLength(QTextLength::PercentageLength, 35); widths << QTextLength(QTextLength::PercentageLength, 65); tf.setColumnWidthConstraints(widths); QTextTable *table = cursor.insertTable(2, 2, tf); QString coreOptions = QString::fromStdString(HelpMessage(HMM_BITCOIN_QT)); bool first = true; QTextCharFormat bold; bold.setFontWeight(QFont::Bold); // note that coreOptions is not translated. foreach (const QString &line, coreOptions.split('\n')) { if (!first) { table->appendRows(1); cursor.movePosition(QTextCursor::NextRow); } first = false; if (line.startsWith(" ")) { int index = line.indexOf(' ', 3); if (index > 0) { cursor.insertText(line.left(index).trimmed()); cursor.movePosition(QTextCursor::NextCell); cursor.insertText(line.mid(index).trimmed()); continue; } } cursor.movePosition(QTextCursor::NextCell, QTextCursor::KeepAnchor); table->mergeCells(cursor); cursor.insertText(line.trimmed(), bold); } table->appendRows(6); cursor.movePosition(QTextCursor::NextRow); cursor.insertText(tr("UI options") + ":", bold); cursor.movePosition(QTextCursor::NextRow); if (GetBoolArg("-help-debug", false)) { cursor.insertText("-allowselfsignedrootcertificates"); cursor.movePosition(QTextCursor::NextCell); cursor.insertText(tr("Allow self signed root certificates (default: 0)")); cursor.movePosition(QTextCursor::NextCell); } cursor.insertText("-choosedatadir"); cursor.movePosition(QTextCursor::NextCell); cursor.insertText(tr("Choose data directory on startup (default: 0)")); cursor.movePosition(QTextCursor::NextCell); cursor.insertText("-lang=<lang>"); cursor.movePosition(QTextCursor::NextCell); cursor.insertText(tr("Set language, for example \"de_DE\" (default: system locale)")); cursor.movePosition(QTextCursor::NextCell); cursor.insertText("-min"); cursor.movePosition(QTextCursor::NextCell); cursor.insertText(tr("Start minimized")); cursor.movePosition(QTextCursor::NextCell); cursor.insertText("-rootcertificates=<file>"); cursor.movePosition(QTextCursor::NextCell); cursor.insertText(tr("Set SSL root certificates for payment request (default: -system-)")); cursor.movePosition(QTextCursor::NextCell); cursor.insertText("-splash"); cursor.movePosition(QTextCursor::NextCell); cursor.insertText(tr("Show splash screen on startup (default: 1)")); ui->helpMessage->moveCursor(QTextCursor::Start); ui->scrollArea->setVisible(false); + ui->aboutLogo->setVisible(false); } } HelpMessageDialog::~HelpMessageDialog() { GUIUtil::saveWindowGeometry("nHelpMessageDialogWindow", this); delete ui; } void HelpMessageDialog::printToConsole() { // On other operating systems, the expected action is to print the message to the console. fprintf(stdout, "%s\n", qPrintable(text)); } void HelpMessageDialog::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 HelpMessageDialog::on_okButton_accepted() { close(); } /** "Shutdown" window */ ShutdownWindow::ShutdownWindow(QWidget *parent, Qt::WindowFlags f): QWidget(parent, f) { QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(new QLabel( tr("Bitcoin Core is shutting down...") + "<br /><br />" + tr("Do not shut down the computer until this window disappears."))); setLayout(layout); } void ShutdownWindow::showShutdownWindow(BitcoinGUI *window) { if (!window) return; // Show a simple window indicating shutdown status QWidget *shutdownWindow = new ShutdownWindow(); // We don't hold a direct pointer to the shutdown window after creation, so use // Qt::WA_DeleteOnClose to make sure that the window will be deleted eventually. shutdownWindow->setAttribute(Qt::WA_DeleteOnClose); shutdownWindow->setWindowTitle(window->windowTitle()); // Center shutdown window at where main window was const QPoint global = window->mapToGlobal(window->rect().center()); shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2); shutdownWindow->show(); } void ShutdownWindow::closeEvent(QCloseEvent *event) { event->ignore(); }