Browse Source

Merge pull request #2961 from Diapolo/cosmetic

fix some cosmetic glitches in the codebase
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
2bc004c658
  1. 2
      src/init.cpp
  2. 4
      src/main.cpp
  3. 1
      src/qt/askpassphrasedialog.cpp
  4. 1
      src/qt/csvmodelwriter.cpp
  5. 2
      src/qt/forms/optionsdialog.ui
  6. 2
      src/qt/forms/qrcodedialog.ui
  7. 4
      src/qt/paymentrequestplus.cpp
  8. 39
      src/qt/paymentserver.cpp
  9. 9
      src/qt/paymentserver.h
  10. 2
      src/util.h

2
src/init.cpp

@ -778,7 +778,7 @@ bool AppInit2(boost::thread_group& threadGroup)
uiInterface.InitMessage(_("Verifying blocks...")); uiInterface.InitMessage(_("Verifying blocks..."));
if (!VerifyDB(GetArg("-checklevel", 3), if (!VerifyDB(GetArg("-checklevel", 3),
GetArg( "-checkblocks", 288))) { GetArg("-checkblocks", 288))) {
strLoadError = _("Corrupted block database detected"); strLoadError = _("Corrupted block database detected");
break; break;
} }

4
src/main.cpp

@ -2047,8 +2047,8 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
reverse(vConnect.begin(), vConnect.end()); reverse(vConnect.begin(), vConnect.end());
if (vDisconnect.size() > 0) { if (vDisconnect.size() > 0) {
printf("REORGANIZE: Disconnect %"PRIszu" blocks; %s..\n", vDisconnect.size(), pfork->GetBlockHash().ToString().c_str()); printf("REORGANIZE: Disconnect %"PRIszu" blocks; %s...\n", vDisconnect.size(), pfork->GetBlockHash().ToString().c_str());
printf("REORGANIZE: Connect %"PRIszu" blocks; ..%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString().c_str()); printf("REORGANIZE: Connect %"PRIszu" blocks; ...%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString().c_str());
} }
// Disconnect shorter branch // Disconnect shorter branch

1
src/qt/askpassphrasedialog.cpp

@ -16,6 +16,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget *parent) :
fCapsLock(false) fCapsLock(false)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->passEdit1->setMaxLength(MAX_PASSPHRASE_SIZE); ui->passEdit1->setMaxLength(MAX_PASSPHRASE_SIZE);
ui->passEdit2->setMaxLength(MAX_PASSPHRASE_SIZE); ui->passEdit2->setMaxLength(MAX_PASSPHRASE_SIZE);
ui->passEdit3->setMaxLength(MAX_PASSPHRASE_SIZE); ui->passEdit3->setMaxLength(MAX_PASSPHRASE_SIZE);

1
src/qt/csvmodelwriter.cpp

@ -85,4 +85,3 @@ bool CSVModelWriter::write()
return file.error() == QFile::NoError; return file.error() == QFile::NoError;
} }

2
src/qt/forms/optionsdialog.ui

@ -461,7 +461,7 @@
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>BitcoinAmountField</class> <class>BitcoinAmountField</class>
<extends>QSpinBox</extends> <extends>QLineEdit</extends>
<header>bitcoinamountfield.h</header> <header>bitcoinamountfield.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>

2
src/qt/forms/qrcodedialog.ui

@ -186,7 +186,7 @@
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>BitcoinAmountField</class> <class>BitcoinAmountField</class>
<extends>QSpinBox</extends> <extends>QLineEdit</extends>
<header>bitcoinamountfield.h</header> <header>bitcoinamountfield.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>

4
src/qt/paymentrequestplus.cpp

@ -80,7 +80,7 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
return false; return false;
} }
else { else {
qDebug() << "PaymentRequestPlus::getMerchant : Payment request: unknown pki_type " << paymentRequest.pki_type().c_str(); qDebug() << "PaymentRequestPlus::getMerchant : Payment request: unknown pki_type " << QString::fromStdString(paymentRequest.pki_type());
return false; return false;
} }
@ -152,7 +152,7 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
// Valid cert; check signature: // Valid cert; check signature:
payments::PaymentRequest rcopy(paymentRequest); // Copy payments::PaymentRequest rcopy(paymentRequest); // Copy
rcopy.set_signature(std::string("")); rcopy.set_signature(std::string(""));
std::string data_to_verify; // Everything but the signature std::string data_to_verify; // Everything but the signature
rcopy.SerializeToString(&data_to_verify); rcopy.SerializeToString(&data_to_verify);
EVP_MD_CTX ctx; EVP_MD_CTX ctx;

39
src/qt/paymentserver.cpp

@ -44,8 +44,6 @@
#include "wallet.h" #include "wallet.h"
#include "walletmodel.h" #include "walletmodel.h"
using namespace boost;
const int BITCOIN_IPC_CONNECT_TIMEOUT = 1000; // milliseconds const int BITCOIN_IPC_CONNECT_TIMEOUT = 1000; // milliseconds
const QString BITCOIN_IPC_PREFIX("bitcoin:"); const QString BITCOIN_IPC_PREFIX("bitcoin:");
const char* BITCOIN_REQUEST_MIMETYPE = "application/bitcoin-paymentrequest"; const char* BITCOIN_REQUEST_MIMETYPE = "application/bitcoin-paymentrequest";
@ -73,14 +71,14 @@ static QString ipcServerName()
// Append a simple hash of the datadir // Append a simple hash of the datadir
// Note that GetDataDir(true) returns a different path // Note that GetDataDir(true) returns a different path
// for -testnet versus main net // for -testnet versus main net
QString ddir(GetDataDir(true).string().c_str()); QString ddir(QString::fromStdString(GetDataDir(true).string()));
name.append(QString::number(qHash(ddir))); name.append(QString::number(qHash(ddir)));
return name; return name;
} }
// //
// We store payment URLs and requests received before // We store payment URIs and requests received before
// the main GUI window is up and ready to ask the user // the main GUI window is up and ready to ask the user
// to send payment. // to send payment.
@ -250,8 +248,7 @@ bool PaymentServer::ipcSendCommandLine(int argc, char* argv[])
return fResult; return fResult;
} }
PaymentServer::PaymentServer(QObject* parent, PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) : QObject(parent), saveURIs(true)
bool startLocalServer) : QObject(parent), saveURIs(true)
{ {
// Verify that the version of the library that we linked against is // Verify that the version of the library that we linked against is
// compatible with the version of the headers we compiled against. // compatible with the version of the headers we compiled against.
@ -286,12 +283,12 @@ PaymentServer::~PaymentServer()
} }
// //
// OSX-specific way of handling bitcoin uris and // OSX-specific way of handling bitcoin: URIs and
// PaymentRequest mime types // PaymentRequest mime types
// //
bool PaymentServer::eventFilter(QObject *, QEvent *event) bool PaymentServer::eventFilter(QObject *, QEvent *event)
{ {
// clicking on bitcoin: URLs creates FileOpen events on the Mac: // clicking on bitcoin: URIs creates FileOpen events on the Mac:
if (event->type() == QEvent::FileOpen) if (event->type() == QEvent::FileOpen)
{ {
QFileOpenEvent* fileEvent = static_cast<QFileOpenEvent*>(event); QFileOpenEvent* fileEvent = static_cast<QFileOpenEvent*>(event);
@ -356,13 +353,13 @@ void PaymentServer::handleURIOrFile(const QString& s)
if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin:
{ {
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
QUrlQuery url((QUrl(s))); QUrlQuery uri((QUrl(s)));
#else #else
QUrl url(s); QUrl uri(s);
#endif #endif
if (url.hasQueryItem("request")) if (uri.hasQueryItem("request"))
{ {
QByteArray temp; temp.append(url.queryItemValue("request")); QByteArray temp; temp.append(uri.queryItemValue("request"));
QString decoded = QUrl::fromPercentEncoding(temp); QString decoded = QUrl::fromPercentEncoding(temp);
QUrl fetchUrl(decoded, QUrl::StrictMode); QUrl fetchUrl(decoded, QUrl::StrictMode);
@ -436,9 +433,7 @@ bool PaymentServer::readPaymentRequest(const QString& filename, PaymentRequestPl
return request.parse(data); return request.parse(data);
} }
bool bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, QList<SendCoinsRecipient>& recipients)
PaymentServer::processPaymentRequest(PaymentRequestPlus& request,
QList<SendCoinsRecipient>& recipients)
{ {
if (!optionsModel) if (!optionsModel)
return false; return false;
@ -504,8 +499,7 @@ PaymentServer::processPaymentRequest(PaymentRequestPlus& request,
return true; return true;
} }
void void PaymentServer::fetchRequest(const QUrl& url)
PaymentServer::fetchRequest(const QUrl& url)
{ {
QNetworkRequest netRequest; QNetworkRequest netRequest;
netRequest.setAttribute(QNetworkRequest::User, "PaymentRequest"); netRequest.setAttribute(QNetworkRequest::User, "PaymentRequest");
@ -515,8 +509,7 @@ PaymentServer::fetchRequest(const QUrl& url)
netManager->get(netRequest); netManager->get(netRequest);
} }
void void PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipient, QByteArray transaction)
PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipient, QByteArray transaction)
{ {
const payments::PaymentDetails& details = recipient.paymentRequest.getDetails(); const payments::PaymentDetails& details = recipient.paymentRequest.getDetails();
if (!details.has_payment_url()) if (!details.has_payment_url())
@ -571,8 +564,7 @@ PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipient, QB
} }
} }
void void PaymentServer::netRequestFinished(QNetworkReply* reply)
PaymentServer::netRequestFinished(QNetworkReply* reply)
{ {
reply->deleteLater(); reply->deleteLater();
if (reply->error() != QNetworkReply::NoError) if (reply->error() != QNetworkReply::NoError)
@ -617,9 +609,10 @@ PaymentServer::netRequestFinished(QNetworkReply* reply)
} }
} }
void void PaymentServer::reportSslErrors(QNetworkReply* reply, const QList<QSslError> &errs)
PaymentServer::reportSslErrors(QNetworkReply* reply, const QList<QSslError> &errs)
{ {
Q_UNUSED(reply);
QString errString; QString errString;
foreach (const QSslError& err, errs) { foreach (const QSslError& err, errs) {
qDebug() << "PaymentServer::reportSslErrors : " << err; qDebug() << "PaymentServer::reportSslErrors : " << err;

9
src/qt/paymentserver.h

@ -36,6 +36,8 @@
class CWallet; class CWallet;
class OptionsModel; class OptionsModel;
QT_BEGIN_NAMESPACE
class QApplication; class QApplication;
class QByteArray; class QByteArray;
class QLocalServer; class QLocalServer;
@ -43,6 +45,7 @@ class QNetworkAccessManager;
class QNetworkReply; class QNetworkReply;
class QSslError; class QSslError;
class QUrl; class QUrl;
QT_END_NAMESPACE
class PaymentServer : public QObject class PaymentServer : public QObject
{ {
@ -56,8 +59,8 @@ public:
// will be called so we startup in the right mode. // will be called so we startup in the right mode.
static bool ipcSendCommandLine(int argc, char *argv[]); static bool ipcSendCommandLine(int argc, char *argv[]);
PaymentServer(QObject* parent, // parent should be QApplication object // parent should be QApplication object
bool startLocalServer=true); PaymentServer(QObject* parent, bool startLocalServer = true);
~PaymentServer(); ~PaymentServer();
// Load root certificate authorities. Pass NULL (default) // Load root certificate authorities. Pass NULL (default)
@ -65,7 +68,7 @@ public:
// or, if that's not set, to use the system default root certificates. // or, if that's not set, to use the system default root certificates.
// If you pass in a store, you should not X509_STORE_free it: it will be // If you pass in a store, you should not X509_STORE_free it: it will be
// freed either at exit or when another set of CAs are loaded. // freed either at exit or when another set of CAs are loaded.
static void LoadRootCAs(X509_STORE* store=NULL); static void LoadRootCAs(X509_STORE* store = NULL);
// Return certificate store // Return certificate store
static X509_STORE* getCertStore() { return certStore; } static X509_STORE* getCertStore() { return certStore; }

2
src/util.h

@ -522,7 +522,7 @@ inline void SetThreadPriority(int nPriority)
// PRIO_MAX is not defined on Solaris // PRIO_MAX is not defined on Solaris
#ifndef PRIO_MAX #ifndef PRIO_MAX
#define PRIO_MAX 20 #define PRIO_MAX 20
#endif #endif
#define THREAD_PRIORITY_LOWEST PRIO_MAX #define THREAD_PRIORITY_LOWEST PRIO_MAX
#define THREAD_PRIORITY_BELOW_NORMAL 2 #define THREAD_PRIORITY_BELOW_NORMAL 2

Loading…
Cancel
Save