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.
This commit is contained in:
Wladimir J. van der Laan
2014-06-10 16:02:46 +02:00
parent 97789d374c
commit 45615af26f
5 changed files with 38 additions and 74 deletions

View File

@@ -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(" &copy; 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);
}