Browse Source

several small Qt-related fixes

- make BitcoinGUI::showPaymentACK() use a reference for msg and use our
  own GUIUtil::HtmlEscape() function
- ensure QTimer usage in clientmodel is the same as in walletmodel
- remove an unneeded debug message in walletframe
- flag some parameters as unused in DebugMessageHandler()
- small code formatting changes
0.10
Philip Kaufmann 11 years ago
parent
commit
d5f0ef54f8
  1. 3
      src/qt/bitcoin.cpp
  2. 8
      src/qt/bitcoingui.cpp
  3. 2
      src/qt/bitcoingui.h
  4. 3
      src/qt/clientmodel.cpp
  5. 2
      src/qt/walletmodel.cpp
  6. 4
      src/qt/walletmodeltransaction.cpp

3
src/qt/bitcoin.cpp

@ -155,11 +155,14 @@ static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTrans
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
void DebugMessageHandler(QtMsgType type, const char * msg) void DebugMessageHandler(QtMsgType type, const char * msg)
{ {
Q_UNUSED(type);
LogPrint("qt", "Bitcoin-Qt: %s\n", msg); LogPrint("qt", "Bitcoin-Qt: %s\n", msg);
} }
#else #else
void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString &msg) void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString &msg)
{ {
Q_UNUSED(type);
Q_UNUSED(context);
LogPrint("qt", "Bitcoin-Qt: %s\n", qPrintable(msg)); LogPrint("qt", "Bitcoin-Qt: %s\n", qPrintable(msg));
} }
#endif #endif

8
src/qt/bitcoingui.cpp

@ -751,13 +751,9 @@ void BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient)
walletFrame->handlePaymentRequest(recipient); walletFrame->handlePaymentRequest(recipient);
} }
void BitcoinGUI::showPaymentACK(QString msg) void BitcoinGUI::showPaymentACK(const QString& msg)
{ {
#if QT_VERSION < 0x050000 message(tr("Payment acknowledged"), GUIUtil::HtmlEscape(msg), CClientUIInterface::MODAL);
message(tr("Payment acknowledged"), Qt::escape(msg), CClientUIInterface::MODAL);
#else
message(tr("Payment acknowledged"), msg.toHtmlEscaped(), CClientUIInterface::MODAL);
#endif
} }
void BitcoinGUI::setEncryptionStatus(int status) void BitcoinGUI::setEncryptionStatus(int status)

2
src/qt/bitcoingui.h

@ -154,7 +154,7 @@ public slots:
void askFee(qint64 nFeeRequired, bool *payFee); void askFee(qint64 nFeeRequired, bool *payFee);
void handlePaymentRequest(const SendCoinsRecipient& recipient); void handlePaymentRequest(const SendCoinsRecipient& recipient);
void showPaymentACK(QString msg); void showPaymentACK(const QString& msg);
/** Show incoming transaction notification for new transactions. */ /** Show incoming transaction notification for new transactions. */
void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address); void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address);

3
src/qt/clientmodel.cpp

@ -24,9 +24,8 @@ ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
numBlocksAtStartup(-1), pollTimer(0) numBlocksAtStartup(-1), pollTimer(0)
{ {
pollTimer = new QTimer(this); pollTimer = new QTimer(this);
pollTimer->setInterval(MODEL_UPDATE_DELAY);
pollTimer->start();
connect(pollTimer, SIGNAL(timeout()), this, SLOT(updateTimer())); connect(pollTimer, SIGNAL(timeout()), this, SLOT(updateTimer()));
pollTimer->start(MODEL_UPDATE_DELAY);
subscribeToCoreSignals(); subscribeToCoreSignals();
} }

2
src/qt/walletmodel.cpp

@ -143,7 +143,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
foreach(const SendCoinsRecipient &rcp, recipients) foreach(const SendCoinsRecipient &rcp, recipients)
{ {
if (rcp.paymentRequest.IsInitialized()) if (rcp.paymentRequest.IsInitialized())
{ // PaymentRequest... { // PaymentRequest...
int64 subtotal = 0; int64 subtotal = 0;
const payments::PaymentDetails& details = rcp.paymentRequest.getDetails(); const payments::PaymentDetails& details = rcp.paymentRequest.getDetails();
for (int i = 0; i < details.outputs_size(); i++) for (int i = 0; i < details.outputs_size(); i++)

4
src/qt/walletmodeltransaction.cpp

@ -32,7 +32,7 @@ qint64 WalletModelTransaction::getTransactionFee()
void WalletModelTransaction::setTransactionFee(qint64 newFee) void WalletModelTransaction::setTransactionFee(qint64 newFee)
{ {
fee=newFee; fee = newFee;
} }
qint64 WalletModelTransaction::getTotalTransactionAmount() qint64 WalletModelTransaction::getTotalTransactionAmount()
@ -40,7 +40,7 @@ qint64 WalletModelTransaction::getTotalTransactionAmount()
qint64 totalTransactionAmount = 0; qint64 totalTransactionAmount = 0;
foreach(const SendCoinsRecipient &rcp, recipients) foreach(const SendCoinsRecipient &rcp, recipients)
{ {
totalTransactionAmount+=rcp.amount; totalTransactionAmount += rcp.amount;
} }
return totalTransactionAmount; return totalTransactionAmount;
} }

Loading…
Cancel
Save