Skip to content

Commit 027fdb8

Browse files
committed
When/if the copyright line does not mention Bitcoin Core developers, add a second line to copyrights in -version, About dialog, and splash screen
1 parent cc2095e commit 027fdb8

File tree

6 files changed

+25
-16
lines changed

6 files changed

+25
-16
lines changed

src/bitcoind.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "httpserver.h"
1818
#include "httprpc.h"
1919
#include "rpcserver.h"
20+
#include "utilstrencodings.h"
2021

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

8384
if (mapArgs.count("-version"))
8485
{
85-
strUsage += LicenseInfo();
86+
strUsage += FormatParagraph(LicenseInfo());
8687
}
8788
else
8889
{

src/init.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "ui_interface.h"
3434
#include "util.h"
3535
#include "utilmoneystr.h"
36-
#include "utilstrencodings.h"
3736
#include "validationinterface.h"
3837
#ifdef ENABLE_WALLET
3938
#include "wallet/db.h"
@@ -513,13 +512,13 @@ std::string HelpMessage(HelpMessageMode mode)
513512
std::string LicenseInfo()
514513
{
515514
// todo: remove urls from translations on next change
516-
return FormatParagraph(strprintf(_("Copyright (C) %i-%i %s"), 2009, COPYRIGHT_YEAR, CopyrightHolders())) + "\n" +
515+
return CopyrightHolders(strprintf(_("Copyright (C) %i-%i"), 2009, COPYRIGHT_YEAR) + " ") + "\n" +
517516
"\n" +
518-
FormatParagraph(_("This is experimental software.")) + "\n" +
517+
_("This is experimental software.") + "\n" +
519518
"\n" +
520-
FormatParagraph(_("Distributed under the MIT software license, see the accompanying file COPYING or <http://www.opensource.org/licenses/mit-license.php>.")) + "\n" +
519+
_("Distributed under the MIT software license, see the accompanying file COPYING or <http://www.opensource.org/licenses/mit-license.php>.") + "\n" +
521520
"\n" +
522-
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.")) +
521+
_("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.") +
523522
"\n";
524523
}
525524

src/qt/splashscreen.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle)
4444
// define text to place
4545
QString titleText = tr(PACKAGE_NAME);
4646
QString versionText = QString("Version %1").arg(QString::fromStdString(FormatFullVersion()));
47-
QString copyrightText = QChar(0xA9)+QString(" %1-%2 ").arg(2009).arg(COPYRIGHT_YEAR) + QString::fromStdString(CopyrightHolders());
47+
QString copyrightText = QString::fromUtf8(CopyrightHolders(strprintf("\xc2\xA9 %u-%u ", 2009, COPYRIGHT_YEAR)).c_str());
4848
QString titleAddText = networkStyle->getTitleAddText();
4949

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

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

107112
// draw additional text if special network
108113
if(!titleAddText.isEmpty()) {

src/qt/utilitydialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
5656
uri.setMinimal(true); // use non-greedy matching
5757
licenseInfoHTML.replace(uri, "<a href=\"\\1\">\\1</a>");
5858
// Replace newlines with HTML breaks
59-
licenseInfoHTML.replace("\n\n", "<br><br>");
59+
licenseInfoHTML.replace("\n", "<br>");
6060

6161
ui->aboutMessage->setTextFormat(Qt::RichText);
6262
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

src/util.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,14 @@ int GetNumCores()
834834
#endif
835835
}
836836

837-
std::string CopyrightHolders()
837+
std::string CopyrightHolders(const std::string& strPrefix)
838838
{
839-
std::string strCopyrightHolders = _(COPYRIGHT_HOLDERS);
840-
if (strCopyrightHolders.find("%s") == strCopyrightHolders.npos)
841-
return strCopyrightHolders;
842-
return strprintf(strCopyrightHolders, _(COPYRIGHT_HOLDERS_SUBSTITUTION));
839+
std::string strCopyrightHolders = strPrefix + _(COPYRIGHT_HOLDERS);
840+
if (strCopyrightHolders.find("%s") != strCopyrightHolders.npos) {
841+
strCopyrightHolders = strprintf(strCopyrightHolders, _(COPYRIGHT_HOLDERS_SUBSTITUTION));
842+
}
843+
if (strCopyrightHolders.find("Bitcoin Core developers") == strCopyrightHolders.npos) {
844+
strCopyrightHolders += "\n" + strPrefix + "The Bitcoin Core developers";
845+
}
846+
return strCopyrightHolders;
843847
}

src/util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,6 @@ template <typename Callable> void TraceThread(const char* name, Callable func)
242242
}
243243
}
244244

245-
std::string CopyrightHolders();
245+
std::string CopyrightHolders(const std::string& strPrefix);
246246

247247
#endif // BITCOIN_UTIL_H

0 commit comments

Comments
 (0)