Skip to content

Commit

Permalink
When/if the copyright line does not mention Bitcoin Core developers, …
Browse files Browse the repository at this point in the history
…add a second line to copyrights in -version, About dialog, and splash screen
  • Loading branch information
luke-jr committed Feb 3, 2016
1 parent cc2095e commit 027fdb8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/bitcoind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "httpserver.h"
#include "httprpc.h"
#include "rpcserver.h"
#include "utilstrencodings.h"

#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp>
Expand Down Expand Up @@ -82,7 +83,7 @@ bool AppInit(int argc, char* argv[])

if (mapArgs.count("-version"))
{
strUsage += LicenseInfo();
strUsage += FormatParagraph(LicenseInfo());
}
else
{
Expand Down
9 changes: 4 additions & 5 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "ui_interface.h"
#include "util.h"
#include "utilmoneystr.h"
#include "utilstrencodings.h"
#include "validationinterface.h"
#ifdef ENABLE_WALLET
#include "wallet/db.h"
Expand Down Expand Up @@ -513,13 +512,13 @@ std::string HelpMessage(HelpMessageMode mode)
std::string LicenseInfo()
{
// todo: remove urls from translations on next change
return FormatParagraph(strprintf(_("Copyright (C) %i-%i %s"), 2009, COPYRIGHT_YEAR, CopyrightHolders())) + "\n" +
return CopyrightHolders(strprintf(_("Copyright (C) %i-%i"), 2009, COPYRIGHT_YEAR) + " ") + "\n" +
"\n" +
FormatParagraph(_("This is experimental software.")) + "\n" +
_("This is experimental software.") + "\n" +
"\n" +
FormatParagraph(_("Distributed under the MIT software license, see the accompanying file COPYING or <http://www.opensource.org/licenses/mit-license.php>.")) + "\n" +
_("Distributed under the MIT software license, see the accompanying file COPYING or <http://www.opensource.org/licenses/mit-license.php>.") + "\n" +
"\n" +
FormatParagraph(_("This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit <https://www.openssl.org/> and cryptographic software written by Eric Young and UPnP software written by Thomas Bernard.")) +
_("This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit <https://www.openssl.org/> and cryptographic software written by Eric Young and UPnP software written by Thomas Bernard.") +
"\n";
}

Expand Down
11 changes: 8 additions & 3 deletions src/qt/splashscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle)
// define text to place
QString titleText = tr(PACKAGE_NAME);
QString versionText = QString("Version %1").arg(QString::fromStdString(FormatFullVersion()));
QString copyrightText = QChar(0xA9)+QString(" %1-%2 ").arg(2009).arg(COPYRIGHT_YEAR) + QString::fromStdString(CopyrightHolders());
QString copyrightText = QString::fromUtf8(CopyrightHolders(strprintf("\xc2\xA9 %u-%u ", 2009, COPYRIGHT_YEAR)).c_str());
QString titleAddText = networkStyle->getTitleAddText();

QString font = QApplication::font().toString();
Expand Down Expand Up @@ -101,8 +101,13 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle)
pixPaint.drawText(pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight+2,paddingTop+titleVersionVSpace,versionText);

// draw copyright stuff
pixPaint.setFont(QFont(font, 10*fontFactor));
pixPaint.drawText(pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText);
{
pixPaint.setFont(QFont(font, 10*fontFactor));
const int x = pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight;
const int y = paddingTop+titleCopyrightVSpace;
QRect copyrightRect(x, y, pixmap.width() - x - paddingRight, pixmap.height() - y);
pixPaint.drawText(copyrightRect, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, copyrightText);
}

// draw additional text if special network
if(!titleAddText.isEmpty()) {
Expand Down
2 changes: 1 addition & 1 deletion src/qt/utilitydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
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>");
licenseInfoHTML.replace("\n", "<br>");

ui->aboutMessage->setTextFormat(Qt::RichText);
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
Expand Down
14 changes: 9 additions & 5 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,10 +834,14 @@ int GetNumCores()
#endif
}

std::string CopyrightHolders()
std::string CopyrightHolders(const std::string& strPrefix)
{
std::string strCopyrightHolders = _(COPYRIGHT_HOLDERS);
if (strCopyrightHolders.find("%s") == strCopyrightHolders.npos)
return strCopyrightHolders;
return strprintf(strCopyrightHolders, _(COPYRIGHT_HOLDERS_SUBSTITUTION));
std::string strCopyrightHolders = strPrefix + _(COPYRIGHT_HOLDERS);
if (strCopyrightHolders.find("%s") != strCopyrightHolders.npos) {
strCopyrightHolders = strprintf(strCopyrightHolders, _(COPYRIGHT_HOLDERS_SUBSTITUTION));
}
if (strCopyrightHolders.find("Bitcoin Core developers") == strCopyrightHolders.npos) {
strCopyrightHolders += "\n" + strPrefix + "The Bitcoin Core developers";
}
return strCopyrightHolders;
}
2 changes: 1 addition & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,6 @@ template <typename Callable> void TraceThread(const char* name, Callable func)
}
}

std::string CopyrightHolders();
std::string CopyrightHolders(const std::string& strPrefix);

#endif // BITCOIN_UTIL_H

0 comments on commit 027fdb8

Please sign in to comment.