aboutsummaryrefslogtreecommitdiff
path: root/src/qt/paymentserver.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-07-14 13:59:05 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-07-15 07:30:23 +0200
commitd29ec6c2301e593d577126d1ca85b93307b32bf1 (patch)
tree4e9690da4c97a9da761147c834412b3057439728 /src/qt/paymentserver.cpp
parentfd5dfda9396968346edcf1f5ddf946d63e797554 (diff)
downloadbitcoin-d29ec6c2301e593d577126d1ca85b93307b32bf1.tar.xz
qt: define QT_NO_KEYWORDS
QT_NO_KEYWORDS prevents Qt from defining the `foreach`, `signals`, `slots` and `emit` macros. Avoid overlap between Qt macros and boost - for example #undef hackiness in #6421.
Diffstat (limited to 'src/qt/paymentserver.cpp')
-rw-r--r--src/qt/paymentserver.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp
index 09e9949b10..654292903b 100644
--- a/src/qt/paymentserver.cpp
+++ b/src/qt/paymentserver.cpp
@@ -148,7 +148,7 @@ void PaymentServer::LoadRootCAs(X509_STORE* _store)
int nRootCerts = 0;
const QDateTime currentTime = QDateTime::currentDateTime();
- foreach (const QSslCertificate& cert, certList) {
+ Q_FOREACH (const QSslCertificate& cert, certList) {
// Don't log NULL certificates
if (cert.isNull())
continue;
@@ -201,7 +201,7 @@ void PaymentServer::LoadRootCAs(X509_STORE* _store)
// when uiReady() is called.
//
// Warning: ipcSendCommandLine() is called early in init,
-// so don't use "emit message()", but "QMessageBox::"!
+// so don't use "Q_EMIT message()", but "QMessageBox::"!
//
void PaymentServer::ipcParseCommandLine(int argc, char* argv[])
{
@@ -269,7 +269,7 @@ void PaymentServer::ipcParseCommandLine(int argc, char* argv[])
bool PaymentServer::ipcSendCommandLine()
{
bool fResult = false;
- foreach (const QString& r, savedPaymentRequests)
+ Q_FOREACH (const QString& r, savedPaymentRequests)
{
QLocalSocket* socket = new QLocalSocket();
socket->connectToServer(ipcServerName(), QIODevice::WriteOnly);
@@ -326,7 +326,7 @@ PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) :
uriServer = new QLocalServer(this);
if (!uriServer->listen(name)) {
- // constructor is called early in init, so don't use "emit message()" here
+ // constructor is called early in init, so don't use "Q_EMIT message()" here
QMessageBox::critical(0, tr("Payment request error"),
tr("Cannot start bitcoin: click-to-pay handler"));
}
@@ -394,7 +394,7 @@ void PaymentServer::uiReady()
initNetManager();
saveURIs = false;
- foreach (const QString& s, savedPaymentRequests)
+ Q_FOREACH (const QString& s, savedPaymentRequests)
{
handleURIOrFile(s);
}
@@ -431,7 +431,7 @@ void PaymentServer::handleURIOrFile(const QString& s)
else
{
qWarning() << "PaymentServer::handleURIOrFile: Invalid URL: " << fetchUrl;
- emit message(tr("URI handling"),
+ Q_EMIT message(tr("URI handling"),
tr("Payment request fetch URL is invalid: %1").arg(fetchUrl.toString()),
CClientUIInterface::ICON_WARNING);
}
@@ -445,14 +445,14 @@ void PaymentServer::handleURIOrFile(const QString& s)
{
CBitcoinAddress address(recipient.address.toStdString());
if (!address.IsValid()) {
- emit message(tr("URI handling"), tr("Invalid payment address %1").arg(recipient.address),
+ Q_EMIT message(tr("URI handling"), tr("Invalid payment address %1").arg(recipient.address),
CClientUIInterface::MSG_ERROR);
}
else
- emit receivedPaymentRequest(recipient);
+ Q_EMIT receivedPaymentRequest(recipient);
}
else
- emit message(tr("URI handling"),
+ Q_EMIT message(tr("URI handling"),
tr("URI cannot be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters."),
CClientUIInterface::ICON_WARNING);
@@ -466,12 +466,12 @@ void PaymentServer::handleURIOrFile(const QString& s)
SendCoinsRecipient recipient;
if (!readPaymentRequestFromFile(s, request))
{
- emit message(tr("Payment request file handling"),
+ Q_EMIT message(tr("Payment request file handling"),
tr("Payment request file cannot be read! This can be caused by an invalid payment request file."),
CClientUIInterface::ICON_WARNING);
}
else if (processPaymentRequest(request, recipient))
- emit receivedPaymentRequest(recipient);
+ Q_EMIT receivedPaymentRequest(recipient);
return;
}
@@ -500,7 +500,7 @@ void PaymentServer::handleURIConnection()
//
// Warning: readPaymentRequestFromFile() is used in ipcSendCommandLine()
-// so don't use "emit message()", but "QMessageBox::"!
+// so don't use "Q_EMIT message()", but "QMessageBox::"!
//
bool PaymentServer::readPaymentRequestFromFile(const QString& filename, PaymentRequestPlus& request)
{
@@ -533,7 +533,7 @@ bool PaymentServer::processPaymentRequest(const PaymentRequestPlus& request, Sen
if (request.IsInitialized()) {
// Payment request network matches client network?
if (!verifyNetwork(request.getDetails())) {
- emit message(tr("Payment request rejected"), tr("Payment request network doesn't match client network."),
+ Q_EMIT message(tr("Payment request rejected"), tr("Payment request network doesn't match client network."),
CClientUIInterface::MSG_ERROR);
return false;
@@ -542,13 +542,13 @@ bool PaymentServer::processPaymentRequest(const PaymentRequestPlus& request, Sen
// Make sure any payment requests involved are still valid.
// This is re-checked just before sending coins in WalletModel::sendCoins().
if (verifyExpired(request.getDetails())) {
- emit message(tr("Payment request rejected"), tr("Payment request expired."),
+ Q_EMIT message(tr("Payment request rejected"), tr("Payment request expired."),
CClientUIInterface::MSG_ERROR);
return false;
}
} else {
- emit message(tr("Payment request error"), tr("Payment request is not initialized."),
+ Q_EMIT message(tr("Payment request error"), tr("Payment request is not initialized."),
CClientUIInterface::MSG_ERROR);
return false;
@@ -562,7 +562,7 @@ bool PaymentServer::processPaymentRequest(const PaymentRequestPlus& request, Sen
QList<std::pair<CScript, CAmount> > sendingTos = request.getPayTo();
QStringList addresses;
- foreach(const PAIRTYPE(CScript, CAmount)& sendingTo, sendingTos) {
+ Q_FOREACH(const PAIRTYPE(CScript, CAmount)& sendingTo, sendingTos) {
// Extract and check destination addresses
CTxDestination dest;
if (ExtractDestination(sendingTo.first, dest)) {
@@ -573,7 +573,7 @@ bool PaymentServer::processPaymentRequest(const PaymentRequestPlus& request, Sen
// Unauthenticated payment requests to custom bitcoin addresses are not supported
// (there is no good way to tell the user where they are paying in a way they'd
// have a chance of understanding).
- emit message(tr("Payment request rejected"),
+ Q_EMIT message(tr("Payment request rejected"),
tr("Unverified payment requests to custom payment scripts are unsupported."),
CClientUIInterface::MSG_ERROR);
return false;
@@ -583,14 +583,14 @@ bool PaymentServer::processPaymentRequest(const PaymentRequestPlus& request, Sen
// but CAmount is defined as int64_t. Because of that we need to verify that amounts are in a valid range
// and no overflow has happened.
if (!verifyAmount(sendingTo.second)) {
- emit message(tr("Payment request rejected"), tr("Invalid payment request."), CClientUIInterface::MSG_ERROR);
+ Q_EMIT message(tr("Payment request rejected"), tr("Invalid payment request."), CClientUIInterface::MSG_ERROR);
return false;
}
// Extract and check amounts
CTxOut txOut(sendingTo.second, sendingTo.first);
if (txOut.IsDust(::minRelayTxFee)) {
- emit message(tr("Payment request error"), tr("Requested payment amount of %1 is too small (considered dust).")
+ Q_EMIT message(tr("Payment request error"), tr("Requested payment amount of %1 is too small (considered dust).")
.arg(BitcoinUnits::formatWithUnit(optionsModel->getDisplayUnit(), sendingTo.second)),
CClientUIInterface::MSG_ERROR);
@@ -600,7 +600,7 @@ bool PaymentServer::processPaymentRequest(const PaymentRequestPlus& request, Sen
recipient.amount += sendingTo.second;
// Also verify that the final amount is still in a valid range after adding additional amounts.
if (!verifyAmount(recipient.amount)) {
- emit message(tr("Payment request rejected"), tr("Invalid payment request."), CClientUIInterface::MSG_ERROR);
+ Q_EMIT message(tr("Payment request rejected"), tr("Invalid payment request."), CClientUIInterface::MSG_ERROR);
return false;
}
}
@@ -694,7 +694,7 @@ void PaymentServer::netRequestFinished(QNetworkReply* reply)
.arg(BIP70_MAX_PAYMENTREQUEST_SIZE);
qWarning() << QString("PaymentServer::%1:").arg(__func__) << msg;
- emit message(tr("Payment request DoS protection"), msg, CClientUIInterface::MSG_ERROR);
+ Q_EMIT message(tr("Payment request DoS protection"), msg, CClientUIInterface::MSG_ERROR);
return;
}
@@ -704,7 +704,7 @@ void PaymentServer::netRequestFinished(QNetworkReply* reply)
.arg(reply->errorString());
qWarning() << "PaymentServer::netRequestFinished: " << msg;
- emit message(tr("Payment request error"), msg, CClientUIInterface::MSG_ERROR);
+ Q_EMIT message(tr("Payment request error"), msg, CClientUIInterface::MSG_ERROR);
return;
}
@@ -718,12 +718,12 @@ void PaymentServer::netRequestFinished(QNetworkReply* reply)
if (!request.parse(data))
{
qWarning() << "PaymentServer::netRequestFinished: Error parsing payment request";
- emit message(tr("Payment request error"),
+ Q_EMIT message(tr("Payment request error"),
tr("Payment request cannot be parsed!"),
CClientUIInterface::MSG_ERROR);
}
else if (processPaymentRequest(request, recipient))
- emit receivedPaymentRequest(recipient);
+ Q_EMIT receivedPaymentRequest(recipient);
return;
}
@@ -736,11 +736,11 @@ void PaymentServer::netRequestFinished(QNetworkReply* reply)
.arg(reply->request().url().toString());
qWarning() << "PaymentServer::netRequestFinished: " << msg;
- emit message(tr("Payment request error"), msg, CClientUIInterface::MSG_ERROR);
+ Q_EMIT message(tr("Payment request error"), msg, CClientUIInterface::MSG_ERROR);
}
else
{
- emit receivedPaymentACK(GUIUtil::HtmlEscape(paymentACK.memo()));
+ Q_EMIT receivedPaymentACK(GUIUtil::HtmlEscape(paymentACK.memo()));
}
}
}
@@ -750,11 +750,11 @@ void PaymentServer::reportSslErrors(QNetworkReply* reply, const QList<QSslError>
Q_UNUSED(reply);
QString errString;
- foreach (const QSslError& err, errs) {
+ Q_FOREACH (const QSslError& err, errs) {
qWarning() << "PaymentServer::reportSslErrors: " << err;
errString += err.errorString() + "\n";
}
- emit message(tr("Network request error"), errString, CClientUIInterface::MSG_ERROR);
+ Q_EMIT message(tr("Network request error"), errString, CClientUIInterface::MSG_ERROR);
}
void PaymentServer::setOptionsModel(OptionsModel *optionsModel)
@@ -765,7 +765,7 @@ void PaymentServer::setOptionsModel(OptionsModel *optionsModel)
void PaymentServer::handlePaymentACK(const QString& paymentACKMsg)
{
// currently we don't futher process or store the paymentACK message
- emit message(tr("Payment acknowledged"), paymentACKMsg, CClientUIInterface::ICON_INFORMATION | CClientUIInterface::MODAL);
+ Q_EMIT message(tr("Payment acknowledged"), paymentACKMsg, CClientUIInterface::ICON_INFORMATION | CClientUIInterface::MODAL);
}
bool PaymentServer::verifyNetwork(const payments::PaymentDetails& requestDetails)