diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-06-10 16:02:46 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-06-12 16:11:56 +0200 |
commit | 45615af26fe374fa996c116984a05f0a632a0e79 (patch) | |
tree | 8d291f3ddb4b0781e47bdf63e145640bad3b5592 /src/qt | |
parent | 97789d374c40f4f7fc8feb19c1235ca09ad2e06e (diff) |
Add 'about' information to `-version` output
Adds a copyright and attribution message to the `-version` output
(the same as shown in the About dialog in the GUI).
Move the message to a function LicenseInfo in init.cpp.
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/forms/aboutdialog.ui | 70 | ||||
-rw-r--r-- | src/qt/utilitydialog.cpp | 20 |
2 files changed, 18 insertions, 72 deletions
diff --git a/src/qt/forms/aboutdialog.ui b/src/qt/forms/aboutdialog.ui index fec63f737a..51dabf2c30 100644 --- a/src/qt/forms/aboutdialog.ui +++ b/src/qt/forms/aboutdialog.ui @@ -43,76 +43,14 @@ </spacer> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="label"> - <property name="cursor"> - <cursorShape>IBeamCursor</cursorShape> - </property> - <property name="text"> - <string><b>Bitcoin Core</b> version</string> - </property> - <property name="textInteractionFlags"> - <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="versionLabel"> - <property name="cursor"> - <cursorShape>IBeamCursor</cursorShape> - </property> - <property name="text"> - <string notr="true">0.3.666-beta</string> - </property> - <property name="textInteractionFlags"> - <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="QLabel" name="copyrightLabel"> - <property name="cursor"> - <cursorShape>IBeamCursor</cursorShape> - </property> - <property name="text"> - <string notr="true">Copyright &copy; 2009-YYYY The Bitcoin Core developers</string> - </property> - <property name="textFormat"> - <enum>Qt::RichText</enum> - </property> - <property name="textInteractionFlags"> - <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_2"> + <widget class="QLabel" name="versionLabel"> <property name="cursor"> <cursorShape>IBeamCursor</cursorShape> </property> <property name="text"> - <string> -This is experimental software. - -Distributed under the MIT/X11 software license, see the accompanying file COPYING or <a href="http://www.opensource.org/licenses/mit-license.php">http://www.opensource.org/licenses/mit-license.php</a>. - -This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (<a href="https://www.openssl.org/">https://www.openssl.org/</a>) and cryptographic software written by Eric Young (<a href="mailto:eay@cryptsoft.com">eay@cryptsoft.com</a>) and UPnP software written by Thomas Bernard.</string> + <string notr="true"> +(placeholder for version message) + </string> </property> <property name="textFormat"> <enum>Qt::RichText</enum> diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index 435c6a4368..a34ebd3a37 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -16,6 +16,7 @@ #include "util.h" #include <QLabel> +#include <QRegExp> #include <QVBoxLayout> /** "About" dialog box */ @@ -24,16 +25,13 @@ AboutDialog::AboutDialog(QWidget *parent) : ui(new Ui::AboutDialog) { ui->setupUi(this); - - // Set current copyright year - ui->copyrightLabel->setText(tr("Copyright") + QString(" © 2009-%1 ").arg(COPYRIGHT_YEAR) + tr("The Bitcoin Core developers")); } void AboutDialog::setModel(ClientModel *model) { if(model) { - QString version = model->formatFullVersion(); + QString version = tr("Bitcoin Core") + " " + tr("version") + " " + model->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. */ @@ -42,7 +40,17 @@ void AboutDialog::setModel(ClientModel *model) #elif defined(__i386__ ) version += " " + tr("(%1-bit)").arg(32); #endif - ui->versionLabel->setText(version); + + /// HTML-format the license message from the core + QString licenseInfo = QString::fromStdString(LicenseInfo()); + // Make URLs clickable + QRegExp uri("<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2); + uri.setMinimal(true); // use non-greedy matching + licenseInfo = licenseInfo.replace(uri, "<a href=\"\\1\">\\1</a>"); + // Replace newlines with HTML breaks + licenseInfo = licenseInfo.replace("\n\n", "<br><br>"); + + ui->versionLabel->setText(version + "<br><br>" + licenseInfo); } } @@ -81,7 +89,7 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool versionOnly) : // Set help message text if(versionOnly) - ui->helpMessageLabel->setText(version); + ui->helpMessageLabel->setText(version + "\n" + QString::fromStdString(LicenseInfo())); else ui->helpMessageLabel->setText(version + "\n" + header + "\n" + coreOptions + "\n" + uiOptions); } |