Skip to content

Commit

Permalink
Unify product name to as few places as possible
Browse files Browse the repository at this point in the history
Replace the string literal "PIVX Core" with the `PACKAGE_NAME` macro
where appropriate and don't pass the macro to translation.

Github-Pull: #2491
Rebased-From: 03a002a
  • Loading branch information
Fuzzbawls authored and furszy committed Sep 19, 2021
1 parent 4fe9030 commit 67e7938
Show file tree
Hide file tree
Showing 26 changed files with 99 additions and 54 deletions.
2 changes: 1 addition & 1 deletion share/qt/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<string>APPL</string>

<key>CFBundleGetInfoString</key>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@.@CLIENT_VERSION_BUILD@, Copyright © 2009-@COPYRIGHT_YEAR@ The Bitcoin Core developers, 2014-@COPYRIGHT_YEAR@ The Dash Core developers, 2015-@COPYRIGHT_YEAR@ The PIVX Core developers</string>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@.@CLIENT_VERSION_BUILD@, Copyright © 2009-@COPYRIGHT_YEAR@ The Bitcoin Core developers, 2014-@COPYRIGHT_YEAR@ The Dash Core developers, 2015-@COPYRIGHT_YEAR@ The @PACKAGE_NAME@ developers</string>

<key>CFBundleShortVersionString</key>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@</string>
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ SECONDARY: $(QT_QM)

$(srcdir)/qt/pivxstrings.cpp: $(libbitcoin_server_a_SOURCES) $(libbitcoin_wallet_a_SOURCES) $(libbitcoin_common_a_SOURCES) $(libbitcoin_zmq_a_SOURCES) $(libbitcoin_util_a_SOURCES)
@test -n $(XGETTEXT) || echo "xgettext is required for updating translations"
$(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) PACKAGE_NAME="$(PACKAGE_NAME)" $(PYTHON) ../share/qt/extract_strings_qt.py $^
$(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) $(PYTHON) ../share/qt/extract_strings_qt.py $^

translate: $(srcdir)/qt/pivxstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_BASE_CPP) qt/pivx.cpp $(BITCOIN_QT_WINDOWS_CPP) $(BITCOIN_QT_WALLET_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM)
@test -n $(LUPDATE) || echo "lupdate is required for updating translations"
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* for both pivxd and pivx-qt, to make it harder for attackers to
* target servers or GUI users specifically.
*/
const std::string CLIENT_NAME("PIVX Core");
const std::string CLIENT_NAME(PACKAGE_NAME);

/**
* Client version number
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define DO_STRINGIZE(X) #X

//! Copyright string used in Windows .rc files
#define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin Core Developers, 2014-" STRINGIZE(COPYRIGHT_YEAR) " The Dash Core Developers, 2015-" STRINGIZE(COPYRIGHT_YEAR) " The PIVX Core Developers"
#define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin Core Developers, 2014-" STRINGIZE(COPYRIGHT_YEAR) " The Dash Core Developers, 2015-" STRINGIZE(COPYRIGHT_YEAR) " The " PACKAGE_NAME " Developers"

/**
* pivxd-res.rc includes this file, but it cannot cope with real c++ code.
Expand Down
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ std::string LicenseInfo()
"\n" +
FormatParagraph(strprintf(_("Copyright (C) 2014-%i The Dash Core Developers"), COPYRIGHT_YEAR)) + "\n" +
"\n" +
FormatParagraph(strprintf(_("Copyright (C) 2015-%i The PIVX Core Developers"), COPYRIGHT_YEAR)) + "\n" +
FormatParagraph(strprintf(_("Copyright (C) 2015-%i The %s Developers"), COPYRIGHT_YEAR, PACKAGE_NAME)) + "\n" +
"\n" +
FormatParagraph(_("This is experimental software.")) + "\n" +
"\n" +
Expand Down
4 changes: 2 additions & 2 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ void CheckOffsetDisconnectedPeers(const CNetAddr& ip)
setOffsetDisconnectedPeers.clear();
// Trigger the warning
std::string strWarn1 = _("Peers are being disconnected due time differences.");
std::string strWarn2 = _("Please check that your computer's date and time are correct! If your clock is wrong PIVX Core will not work properly.");
std::string strWarn2 = strprintf(_("Please check that your computer's date and time are correct! If your clock is wrong %s will not work properly."), PACKAGE_NAME);

LogPrintf("*** Warning: %s %s\n", strWarn1, strWarn2);

Expand Down Expand Up @@ -1824,7 +1824,7 @@ bool CConnman::BindListenPort(const CService& addrBind, std::string& strError, b
if (::bind(hListenSocket, (struct sockaddr*)&sockaddr, len) == SOCKET_ERROR) {
int nErr = WSAGetLastError();
if (nErr == WSAEADDRINUSE)
strError = strprintf(_("Unable to bind to %s on this computer. PIVX Core is probably already running."), addrBind.ToString());
strError = strprintf(_("Unable to bind to %s on this computer. %s is probably already running."), addrBind.ToString(), PACKAGE_NAME);
else
strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %s)"), addrBind.ToString(), NetworkErrorString(nErr));
LogPrintf("%s\n", strError);
Expand Down
6 changes: 3 additions & 3 deletions src/pivx-cli-res.rc
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ BEGIN
BEGIN
BLOCK "040904E4" // U.S. English - multilingual (hex)
BEGIN
VALUE "CompanyName", "Pivx"
VALUE "FileDescription", "Pivx-cli (OSS RPC client for Pivx)"
VALUE "CompanyName", "PIVX"
VALUE "FileDescription", "pivx-cli (OSS RPC client for " PACKAGE_NAME ")"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "pivx-cli"
VALUE "LegalCopyright", COPYRIGHT_STR
VALUE "LegalTrademarks1", "Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
VALUE "OriginalFilename", "pivx-cli.exe"
VALUE "ProductName", "Pivx-cli"
VALUE "ProductName", "pivx-cli"
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END
Expand Down
10 changes: 7 additions & 3 deletions src/pivx-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#if defined(HAVE_CONFIG_H)
#include "config/pivx-config.h"
#endif

#include "chainparamsbase.h"
#include "clientversion.h"
#include "fs.h"
Expand Down Expand Up @@ -73,11 +77,11 @@ static bool AppInitRPC(int argc, char* argv[])
//
gArgs.ParseParameters(argc, argv);
if (argc < 2 || gArgs.IsArgSet("-?") || gArgs.IsArgSet("-h") || gArgs.IsArgSet("-help") || gArgs.IsArgSet("-version")) {
std::string strUsage = _("PIVX Core RPC client version") + " " + FormatFullVersion() + "\n";
std::string strUsage = strprintf(_("%s RPC client version"), PACKAGE_NAME) + " " + FormatFullVersion() + "\n";
if (!gArgs.IsArgSet("-version")) {
strUsage += "\n" + _("Usage:") + "\n" +
" pivx-cli [options] <command> [params] " + _("Send command to PIVX Core") + "\n" +
" pivx-cli [options] -named <command> [name=value] ... " + _("Send command to PIVX Core (with named arguments)") + "\n" +
" pivx-cli [options] <command> [params] " + strprintf(_("Send command to %s"), PACKAGE_NAME) + "\n" +
" pivx-cli [options] -named <command> [name=value] ... " + strprintf(_("Send command to %s (with named arguments)"), PACKAGE_NAME) + "\n" +
" pivx-cli [options] help " + _("List commands") + "\n" +
" pivx-cli [options] help <command> " + _("Get help for a command") + "\n";

Expand Down
6 changes: 5 additions & 1 deletion src/pivx-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#if defined(HAVE_CONFIG_H)
#include "config/pivx-config.h"
#endif

#include "clientversion.h"
#include "coins.h"
#include "core_io.h"
Expand Down Expand Up @@ -43,7 +47,7 @@ static bool AppInitRawTx(int argc, char* argv[])

if (argc < 2 || gArgs.IsArgSet("-?") || gArgs.IsArgSet("-h") || gArgs.IsArgSet("-help")) {
// First part of help message is specific to this utility
std::string strUsage = _("Pivx Core pivx-tx utility version") + " " + FormatFullVersion() + "\n\n" +
std::string strUsage = strprintf(_("%s pivx-tx utility version"), PACKAGE_NAME) + " " + FormatFullVersion() + "\n\n" +
_("Usage:") + "\n" +
" pivx-tx [options] <hex-tx> [commands] " + _("Update hex-encoded pivx transaction") + "\n" +
" pivx-tx [options] -create [commands] " + _("Create hex-encoded pivx transaction") + "\n" +
Expand Down
2 changes: 1 addition & 1 deletion src/pivxd-res.rc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ BEGIN
BLOCK "040904E4" // U.S. English - multilingual (hex)
BEGIN
VALUE "CompanyName", "PIVX"
VALUE "FileDescription", "pivxd (OSS daemon/client for PIVX)"
VALUE "FileDescription", "pivxd (PIVX node with a JSON-RPC server)"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "pivxd"
VALUE "LegalCopyright", COPYRIGHT_STR
Expand Down
8 changes: 6 additions & 2 deletions src/pivxd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php.

#if defined(HAVE_CONFIG_H)
#include "config/pivx-config.h"
#endif

#include "chainparams.h"
#include "clientversion.h"
#include "fs.h"
Expand Down Expand Up @@ -57,13 +61,13 @@ bool AppInit(int argc, char* argv[])

// Process help and version before taking care about datadir
if (gArgs.IsArgSet("-?") || gArgs.IsArgSet("-h") || gArgs.IsArgSet("-help") || gArgs.IsArgSet("-version")) {
std::string strUsage = _("Pivx Core Daemon") + " " + _("version") + " " + FormatFullVersion() + "\n";
std::string strUsage = strprintf(_("%s Daemon"), PACKAGE_NAME) + " " + _("version") + " " + FormatFullVersion() + "\n";

if (gArgs.IsArgSet("-version")) {
strUsage += LicenseInfo();
} else {
strUsage += "\n" + _("Usage:") + "\n" +
" pivxd [options] " + _("Start Pivx Core Daemon") + "\n";
" pivxd [options] " + strprintf(_("Start %s Daemon"), PACKAGE_NAME) + "\n";

strUsage += "\n" + HelpMessage(HMM_BITCOIND);
}
Expand Down
8 changes: 6 additions & 2 deletions src/qt/askpassphrasedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#if defined(HAVE_CONFIG_H)
#include "config/pivx-config.h"
#endif

#include "askpassphrasedialog.h"
#include "ui_askpassphrasedialog.h"
#include <QGraphicsDropShadowEffect>
Expand Down Expand Up @@ -347,9 +351,9 @@ void AskPassphraseDialog::warningMessage()
openStandardDialog(
tr("Wallet encrypted"),
"<qt>" +
tr("PIVX will close now to finish the encryption process. "
tr("%1 will close now to finish the encryption process. "
"Remember that encrypting your wallet cannot fully protect "
"your PIVs from being stolen by malware infecting your computer.") +
"your PIVs from being stolen by malware infecting your computer.").arg(PACKAGE_NAME) +
"<br><br><b>" +
tr("IMPORTANT: Any previous backups you have made of your wallet file "
"should be replaced with the newly generated, encrypted wallet file. "
Expand Down
3 changes: 0 additions & 3 deletions src/qt/forms/helpmessagedialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string notr="true">PIVX Core - Command-line options</string>
</property>
<property name="styleSheet">
<string notr="true">#HelpMessageDialog {
background-color:#FFFFFF;
Expand Down
10 changes: 5 additions & 5 deletions src/qt/forms/intro.ui
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@
<number>30</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="welcomeLabel">
<property name="styleSheet">
<string notr="true">QLabel { font-style:italic; }</string>
</property>
<property name="text">
<string>Welcome to PIVX Core.</string>
<string>Welcome to %1.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
Expand All @@ -128,15 +128,15 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="storageLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>As this is the first time the program is launched, you can choose where PIVX Core will store its data.</string>
<string>As this is the first time the program is launched, you can choose where %1 will store its data.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
Expand All @@ -154,7 +154,7 @@
}</string>
</property>
<property name="text">
<string>PIVX Core will download and store a copy of the PIVX block chain. At least %1GB of data will be stored in this directory, and it will grow over time. The wallet will also be stored in this directory.</string>
<string>%1 will download and store a copy of the PIVX block chain. At least %2GB of data will be stored in this directory, and it will grow over time. The wallet will also be stored in this directory.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
Expand Down
14 changes: 10 additions & 4 deletions src/qt/intro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#if defined(HAVE_CONFIG_H)
#include "config/pivx-config.h"
#endif

#include "intro.h"
#include "ui_intro.h"

Expand Down Expand Up @@ -113,8 +117,8 @@ Intro::Intro(QWidget* parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::W
setCssProperty(ui->frame, "container-welcome-step2");
setCssProperty(ui->container, "container-welcome-stack");
setCssProperty(ui->frame_2, "container-welcome");
setCssProperty(ui->label_2, "text-title-welcome");
setCssProperty(ui->label_4, "text-intro-white");
setCssProperty(ui->welcomeLabel, "text-title-welcome");
setCssProperty(ui->storageLabel, "text-intro-white");
setCssProperty(ui->sizeWarningLabel, "text-intro-white");
setCssProperty(ui->freeSpace, "text-intro-white");
setCssProperty(ui->errorMessage, "text-intro-white");
Expand All @@ -129,7 +133,9 @@ Intro::Intro(QWidget* parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::W
connect(ui->pushButtonOk, &QPushButton::clicked, this, &Intro::accept);
connect(ui->pushButtonCancel, &QPushButton::clicked, this, &Intro::close);

ui->sizeWarningLabel->setText(ui->sizeWarningLabel->text().arg(BLOCK_CHAIN_SIZE / GB_BYTES));
ui->welcomeLabel->setText(ui->welcomeLabel->text().arg(PACKAGE_NAME));
ui->storageLabel->setText(ui->storageLabel->text().arg(PACKAGE_NAME));
ui->sizeWarningLabel->setText(ui->sizeWarningLabel->text().arg(PACKAGE_NAME).arg(BLOCK_CHAIN_SIZE / GB_BYTES));
startThread();
}

Expand Down Expand Up @@ -199,7 +205,7 @@ bool Intro::pickDataDirectory()
}
break;
} catch (const fs::filesystem_error& e) {
QMessageBox::critical(0, tr("PIVX Core"),
QMessageBox::critical(nullptr, PACKAGE_NAME,
tr("Error: Specified data directory \"%1\" cannot be created.").arg(dataDir));
// fall through, back to choosing screen
}
Expand Down
12 changes: 6 additions & 6 deletions src/qt/pivx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,14 +608,14 @@ int main(int argc, char* argv[])
/// 6. Determine availability of data and blocks directory and parse pivx.conf
/// - Do not call GetDataDir(true) before this step finishes
if (!fs::is_directory(GetDataDir(false))) {
QMessageBox::critical(0, QObject::tr("PIVX Core"),
QMessageBox::critical(nullptr, PACKAGE_NAME,
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", ""))));
return 1;
}
try {
gArgs.ReadConfigFile(gArgs.GetArg("-conf", PIVX_CONF_FILENAME));
} catch (const std::exception& e) {
QMessageBox::critical(0, QObject::tr("PIVX Core"),
QMessageBox::critical(nullptr, PACKAGE_NAME,
QObject::tr("Error: Cannot parse configuration file: %1. Only use key=value syntax.").arg(e.what()));
return 0;
}
Expand All @@ -630,7 +630,7 @@ int main(int argc, char* argv[])
try {
SelectParams(gArgs.GetChainName());
} catch(const std::exception& e) {
QMessageBox::critical(0, QObject::tr("PIVX Core"), QObject::tr("Error: %1").arg(e.what()));
QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error: %1").arg(e.what()));
return 1;
}
#ifdef ENABLE_WALLET
Expand All @@ -649,7 +649,7 @@ int main(int argc, char* argv[])
/// 7a. parse masternode.conf
std::string strErr;
if (!masternodeConfig.read(strErr)) {
QMessageBox::critical(0, QObject::tr("PIVX Core"),
QMessageBox::critical(nullptr, PACKAGE_NAME,
QObject::tr("Error reading masternode configuration file: %1").arg(strErr.c_str()));
return 0;
}
Expand Down Expand Up @@ -719,7 +719,7 @@ int main(int argc, char* argv[])
app.createWindow(networkStyle.data());
app.requestInitialize();
#if defined(Q_OS_WIN)
WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("%1 didn't yet exit safely...").arg(QObject::tr(PACKAGE_NAME)), (HWND)app.getMainWinId());
WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("%1 didn't yet exit safely...").arg(PACKAGE_NAME), (HWND)app.getMainWinId());
#endif
app.exec();
app.requestShutdown();
Expand All @@ -728,7 +728,7 @@ int main(int argc, char* argv[])
PrintExceptionContinue(&e, "Runaway exception");
app.handleRunawayException(QString::fromStdString(GetWarnings("gui")));
} catch (...) {
PrintExceptionContinue(NULL, "Runaway exception");
PrintExceptionContinue(nullptr, "Runaway exception");
app.handleRunawayException(QString::fromStdString(GetWarnings("gui")));
}
return app.getReturnValue();
Expand Down
2 changes: 1 addition & 1 deletion src/qt/pivx/forms/welcomecontentwidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@
</property>
<property name="text">
<string>Welcome to
PIVX Core Wallet</string>
%1 Wallet</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
Expand Down
8 changes: 4 additions & 4 deletions src/qt/pivx/pivxgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ PIVXGUI::PIVXGUI(const NetworkStyle* networkStyle, QWidget* parent) :

QString windowTitle = QString::fromStdString(gArgs.GetArg("-windowtitle", ""));
if (windowTitle.isEmpty()) {
windowTitle = tr("PIVX Core") + " - ";
windowTitle = QString{PACKAGE_NAME} + " - ";
windowTitle += ((enableWallet) ? tr("Wallet") : tr("Node"));
}
windowTitle += " " + networkStyle->getTitleAddText();
Expand Down Expand Up @@ -210,7 +210,7 @@ void PIVXGUI::createTrayIcon(const NetworkStyle* networkStyle)
{
#ifndef Q_OS_MAC
trayIcon = new QSystemTrayIcon(this);
QString toolTip = tr("PIVX Core client") + " " + networkStyle->getTitleAddText();
QString toolTip = tr("%1 client").arg(PACKAGE_NAME) + " " + networkStyle->getTitleAddText();
trayIcon->setToolTip(toolTip);
trayIcon->setIcon(networkStyle->getAppIcon());
trayIcon->hide();
Expand Down Expand Up @@ -375,7 +375,7 @@ void PIVXGUI::messageInfo(const QString& text)

void PIVXGUI::message(const QString& title, const QString& message, unsigned int style, bool* ret)
{
QString strTitle = tr("PIVX Core"); // default title
QString strTitle = QString{PACKAGE_NAME}; // default title
// Default to information icon
int nNotifyIcon = Notificator::Information;

Expand Down Expand Up @@ -444,7 +444,7 @@ bool PIVXGUI::openStandardDialog(QString title, QString body, QString okBtn, QSt
} else {
dialog = new DefaultDialog();
dialog->setText(title, body, okBtn);
dialog->setWindowTitle(tr("PIVX Core"));
dialog->setWindowTitle(PACKAGE_NAME);
dialog->adjustSize();
dialog->raise();
dialog->exec();
Expand Down
Loading

0 comments on commit 67e7938

Please sign in to comment.