dynamic coin name

This commit is contained in:
Andre Jochems
2016-04-06 14:56:42 +02:00
parent 2e0aaa5022
commit 56bf480259
28 changed files with 180 additions and 171 deletions

View File

@@ -3,6 +3,7 @@
#include "guiconstants.h"
#include "walletmodel.h"
#include "version.h"
#include <QMessageBox>
#include <QPushButton>
@@ -98,7 +99,8 @@ void AskPassphraseDialog::accept()
break;
}
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm wallet encryption"),
tr("Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR CASINOCOINS</b>!") + "<br><br>" + tr("Are you sure you wish to encrypt your wallet?"),
tr((std::string("Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR ")
+ COIN_NAME_DISPLAY + "</b>!").c_str()) + "<br><br>" + tr("Are you sure you wish to encrypt your wallet?"),
QMessageBox::Yes|QMessageBox::Cancel,
QMessageBox::Cancel);
if(retval == QMessageBox::Yes)
@@ -109,9 +111,9 @@ void AskPassphraseDialog::accept()
{
QMessageBox::warning(this, tr("Wallet encrypted"),
"<qt>" +
tr("CasinoCoin will close now to finish the encryption process. "
tr((std::string("")+ COIN_NAME_DISPLAY + " will close now to finish the encryption process. "
"Remember that encrypting your wallet cannot fully protect "
"your casinocoins from being stolen by malware infecting your computer.") +
"your "+ COIN_NAME + " from being stolen by malware infecting your computer.").c_str()) +
"<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. "

View File

@@ -110,7 +110,7 @@ static std::string Translate(const char* psz)
static void handleRunawayException(std::exception *e)
{
PrintExceptionContinue(e, "Runaway exception");
QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. CasinoCoin can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning));
QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr(("A fatal error occurred. "+ COIN_NAME_DISPLAY + " can no longer continue safely and will quit.").c_str()) + QString("\n\n") + QString::fromStdString(strMiscWarning));
exit(1);
}
@@ -146,7 +146,7 @@ int main(int argc, char *argv[])
{
// This message can not be translated, as translation is not initialized yet
// (which not yet possible because lang=XX can be overridden in bitcoin.conf in the data directory)
QMessageBox::critical(0, "CasinoCoin",
QMessageBox::critical(0, COIN_NAME_DISPLAY.c_str(),
QString("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"])));
return 1;
}
@@ -154,12 +154,12 @@ int main(int argc, char *argv[])
// Application identification (must be set before OptionsModel is initialized,
// as it is used to locate QSettings)
QApplication::setOrganizationName("CasinoCoin");
QApplication::setOrganizationName(COIN_NAME_DISPLAY.c_str());
QApplication::setOrganizationDomain("casinocoin.org");
if(GetBoolArg("-testnet")) // Separate UI settings for testnet
QApplication::setApplicationName("CasinoCoin-Qt-testnet");
QApplication::setApplicationName((""+ COIN_NAME_DISPLAY + "-Qt-testnet").c_str());
else
QApplication::setApplicationName("CasinoCoin-Qt");
QApplication::setApplicationName((""+ COIN_NAME_DISPLAY + "-Qt").c_str());
// ... then GUI settings:
OptionsModel optionsModel;

View File

@@ -1,4 +1,5 @@
#include <QtGlobal>
#include "version.h"
// Automatically generated by extract_strings.py
#ifdef __GNUC__
#define UNUSED __attribute__((unused))
@@ -6,18 +7,19 @@
#define UNUSED
#endif
static const char UNUSED *bitcoin_strings[] = {
QT_TRANSLATE_NOOP("bitcoin-core", ""
"%s, you must set a rpcpassword in the configuration file:\n"
"%s\n"
"It is recommended you use the following random password:\n"
"rpcuser=casinocoinrpc\n"
"rpcpassword=%s\n"
"(you do not need to remember this password)\n"
"The username and password MUST NOT be the same.\n"
"If the file does not exist, create it with owner-readable-only file "
"permissions.\n"
"It is also recommended to set alertnotify so you are notified of problems;\n"
"for example: alertnotify=echo %%s | mail -s \"CasinoCoin Alert\" admin@foo.com\n"),
QT_TRANSLATE_NOOP("bitcoin-core", (std::string("") +
"%s, you must set a rpcpassword in the configuration file:\n" +
"%s\n" +
"It is recommended you use the following random password:\n" +
"rpcuser=" + COIN_NAME +"rpc\n" +
"rpcpassword=%s\n" +
"(you do not need to remember this password)\n" +
"The username and password MUST NOT be the same.\n" +
"If the file does not exist, create it with owner-readable-only file " +
"permissions.\n" +
"It is also recommended to set alertnotify so you are notified of problems;\n" +
"for example: alertnotify=echo %%s | mail -s \"" + COIN_NAME_DISPLAY +
" Alert\" admin@foo.com\n").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:"
"@STRENGTH)"),
@@ -29,9 +31,9 @@ QT_TRANSLATE_NOOP("bitcoin-core", ""
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Bind to given address and always listen on it. Use [host]:port notation for "
"IPv6"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Cannot obtain a lock on data directory %s. CasinoCoin is probably already "
"running."),
QT_TRANSLATE_NOOP("bitcoin-core", (std::string("") +
"Cannot obtain a lock on data directory %s. "+ COIN_NAME_DISPLAY + " is probably already "
"running.").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Error: The transaction was rejected! This might happen if some of the coins "
"in your wallet were already spent, such as if you used a copy of wallet.dat "
@@ -62,17 +64,17 @@ QT_TRANSLATE_NOOP("bitcoin-core", ""
QT_TRANSLATE_NOOP("bitcoin-core", ""
"This is a pre-release test build - use at your own risk - do not use for "
"mining or merchant applications"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Unable to bind to %s on this computer. CasinoCoin is probably already running."),
QT_TRANSLATE_NOOP("bitcoin-core", (std::string("") +
"Unable to bind to %s on this computer. "+ COIN_NAME_DISPLAY + " is probably already running.").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: -paytxfee is set very high! This is the transaction fee you will "
"pay if you send a transaction."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: Displayed transactions may not be correct! You may need to upgrade, "
"or other nodes may need to upgrade."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
QT_TRANSLATE_NOOP("bitcoin-core", (std::string("") +
"Warning: Please check that your computer's date and time are correct! If "
"your clock is wrong CasinoCoin will not work properly."),
"your clock is wrong "+ COIN_NAME_DISPLAY + " will not work properly.").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: error reading wallet.dat! All keys read correctly, but transaction "
"data or address book entries might be missing or incorrect."),
@@ -91,7 +93,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Add a node to connect to and attempt to keep
QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for -addnode, -seednode and -connect"),
QT_TRANSLATE_NOOP("bitcoin-core", "Allow JSON-RPC connections from specified IP address"),
QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to recover private keys from a corrupt wallet.dat"),
QT_TRANSLATE_NOOP("bitcoin-core", "CasinoCoin version"),
QT_TRANSLATE_NOOP("bitcoin-core", (COIN_NAME_DISPLAY + " version").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Block creation options:"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -bind address: '%s'"),
@@ -109,7 +111,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing wallet database environmen
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading block database"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet corrupted"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet requires newer version of CasinoCoin"),
QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Error loading wallet.dat: Wallet requires newer version of ")+ COIN_NAME_DISPLAY + "").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Error opening block database"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low!"),
@@ -162,9 +164,9 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Rebuild block chain index from current blk000
QT_TRANSLATE_NOOP("bitcoin-core", "Rescan the block chain for missing wallet transactions"),
QT_TRANSLATE_NOOP("bitcoin-core", "Rescanning..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Run in the background as a daemon and accept commands"),
QT_TRANSLATE_NOOP("bitcoin-core", "SSL options: (see the CasinoCoin Wiki for SSL setup instructions)"),
QT_TRANSLATE_NOOP("bitcoin-core", (std::string("SSL options: (see the ") + COIN_NAME_DISPLAY + " Wiki for SSL setup instructions)").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Select the version of socks proxy to use (4-5, default: 5)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send command to -server or casinocoind"),
QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Send command to -server or ") + COIN_NAME + "d").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Send commands to node running on <ip> (default: 127.0.0.1)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to console instead of debug.log file"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to debugger"),
@@ -177,10 +179,10 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Set minimum block size in bytes (default: 0)"
QT_TRANSLATE_NOOP("bitcoin-core", "Set the number of threads to service RPC calls (default: 4)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Signing transaction failed"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify configuration file (default: casinocoin.conf)"),
QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Specify configuration file (default: ") + COIN_NAME + ".conf)").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify connection timeout in milliseconds (default: 5000)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify data directory"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify pid file (default: casinocoind.pid)"),
QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Specify pid file (default: ") + COIN_NAME + "d.pid)").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify your own public address"),
QT_TRANSLATE_NOOP("bitcoin-core", "System error: "),
QT_TRANSLATE_NOOP("bitcoin-core", "This help message"),
@@ -202,7 +204,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Use the test network"),
QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"),
QT_TRANSLATE_NOOP("bitcoin-core", "Verifying blocks..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Verifying wallet..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart CasinoCoin to complete"),
QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Wallet needed to be rewritten: restart ")+ COIN_NAME_DISPLAY + " to complete").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Warning"),
QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete, upgrade required!"),
QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the database using -reindex to change -txindex"),

View File

@@ -84,7 +84,7 @@ void setupAmountWidget(QLineEdit *widget, QWidget *parent)
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
{
// return if URI is not valid or is no bitcoin URI
if(!uri.isValid() || uri.scheme() != QString("casinocoin"))
if(!uri.isValid() || uri.scheme() != QString(COIN_NAME.c_str()))
return false;
SendCoinsRecipient rv;
@@ -139,9 +139,9 @@ bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
//
// Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host,
// which will lower-case it (and thus invalidate the address).
if(uri.startsWith("casinocoin://"))
if(uri.startsWith(QString((COIN_NAME + "://").c_str())))
{
uri.replace(0, 11, "casinocoin:");
uri.replace(0, (COIN_NAME.length()+1), QString((COIN_NAME + ":").c_str()));
}
QUrl uriInstance(uri);
return parseBitcoinURI(uriInstance, out);
@@ -301,7 +301,7 @@ bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt)
#ifdef WIN32
boost::filesystem::path static StartupShortcutPath()
{
return GetSpecialFolderPath(CSIDL_STARTUP) / "CasinoCoin.lnk";
return GetSpecialFolderPath(CSIDL_STARTUP) / (COIN_NAME_DISPLAY + ".lnk").c_str();
}
bool GetStartOnSystemStartup()
@@ -383,7 +383,7 @@ boost::filesystem::path static GetAutostartDir()
boost::filesystem::path static GetAutostartFilePath()
{
return GetAutostartDir() / "casinocoin.desktop";
return GetAutostartDir() / ""+ COIN_NAME + ".desktop";
}
bool GetStartOnSystemStartup()
@@ -424,7 +424,7 @@ bool SetStartOnSystemStartup(bool fAutoStart)
// Write a bitcoin.desktop file to the autostart directory:
optionFile << "[Desktop Entry]\n";
optionFile << "Type=Application\n";
optionFile << "Name=CasinoCoin\n";
optionFile << "Name="+ COIN_NAME_DISPLAY + "\n";
optionFile << "Exec=" << pszExePath << " -min\n";
optionFile << "Terminal=false\n";
optionFile << "Hidden=false\n";
@@ -495,10 +495,10 @@ bool SetStartOnSystemStartup(bool fAutoStart) { return false; }
HelpMessageBox::HelpMessageBox(QWidget *parent) :
QMessageBox(parent)
{
header = tr("CasinoCoin-Qt") + " " + tr("version") + " " +
header = tr((COIN_NAME_DISPLAY + "-Qt").c_str()) + " " + tr("version") + " " +
QString::fromStdString(FormatFullVersion()) + "\n\n" +
tr("Usage:") + "\n" +
" casinocoin-qt [" + tr("command-line options") + "] " + "\n";
QString::fromStdString(" "+ COIN_NAME + "-qt [") + tr("command-line options") + "] " + "\n";
coreOptions = QString::fromStdString(HelpMessage());
@@ -507,7 +507,7 @@ HelpMessageBox::HelpMessageBox(QWidget *parent) :
" -min " + tr("Start minimized") + "\n" +
" -splash " + tr("Show splash screen on startup (default: 1)") + "\n";
setWindowTitle(tr("CasinoCoin-Qt"));
setWindowTitle(tr((COIN_NAME_DISPLAY + "-Qt").c_str()));
setTextFormat(Qt::PlainText);
// setMinimumWidth is ignored for QMessageBox so put in non-breaking spaces to make it wider.
setText(header + QString(QChar(0x2003)).repeated(50));

View File

@@ -106,7 +106,7 @@ PaymentServer::PaymentServer(QApplication* parent) : QObject(parent), saveURIs(t
uriServer = new QLocalServer(this);
if (!uriServer->listen(name))
qDebug() << tr("Cannot start casinocoin: click-to-pay handler");
qDebug() << tr((std::string("Cannot start ")+ COIN_NAME + ": click-to-pay handler").c_str());
else
connect(uriServer, SIGNAL(newConnection()), this, SLOT(handleURIConnection()));
}

View File

@@ -5,6 +5,7 @@
#include "guiconstants.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "version.h"
#include <QPixmap>
#if QT_VERSION < 0x050000
@@ -85,7 +86,7 @@ void QRCodeDialog::genCode()
QString QRCodeDialog::getURI()
{
QString ret = QString("casinocoin:%1").arg(address);
QString ret = QString((COIN_NAME + ":%1").c_str()).arg(address);
int paramCount = 0;
ui->outUri->clear();