diff options
Diffstat (limited to 'src/qt/walletmodel.h')
-rw-r--r-- | src/qt/walletmodel.h | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 2bb91d85a9..111ae2178c 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -59,20 +59,20 @@ public: static const int CURRENT_VERSION = 1; int nVersion; - IMPLEMENT_SERIALIZE - ( - SendCoinsRecipient* pthis = const_cast<SendCoinsRecipient*>(this); + ADD_SERIALIZE_METHODS; - std::string sAddress = pthis->address.toStdString(); - std::string sLabel = pthis->label.toStdString(); - std::string sMessage = pthis->message.toStdString(); + template <typename Stream, typename Operation> + inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { + std::string sAddress = address.toStdString(); + std::string sLabel = label.toStdString(); + std::string sMessage = message.toStdString(); std::string sPaymentRequest; - if (!fRead && pthis->paymentRequest.IsInitialized()) - pthis->paymentRequest.SerializeToString(&sPaymentRequest); - std::string sAuthenticatedMerchant = pthis->authenticatedMerchant.toStdString(); + if (!ser_action.ForRead() && paymentRequest.IsInitialized()) + paymentRequest.SerializeToString(&sPaymentRequest); + std::string sAuthenticatedMerchant = authenticatedMerchant.toStdString(); - READWRITE(pthis->nVersion); - nVersion = pthis->nVersion; + READWRITE(this->nVersion); + nVersion = this->nVersion; READWRITE(sAddress); READWRITE(sLabel); READWRITE(amount); @@ -80,16 +80,16 @@ public: READWRITE(sPaymentRequest); READWRITE(sAuthenticatedMerchant); - if (fRead) + if (ser_action.ForRead()) { - pthis->address = QString::fromStdString(sAddress); - pthis->label = QString::fromStdString(sLabel); - pthis->message = QString::fromStdString(sMessage); + address = QString::fromStdString(sAddress); + label = QString::fromStdString(sLabel); + message = QString::fromStdString(sMessage); if (!sPaymentRequest.empty()) - pthis->paymentRequest.parse(QByteArray::fromRawData(sPaymentRequest.data(), sPaymentRequest.size())); - pthis->authenticatedMerchant = QString::fromStdString(sAuthenticatedMerchant); + paymentRequest.parse(QByteArray::fromRawData(sPaymentRequest.data(), sPaymentRequest.size())); + authenticatedMerchant = QString::fromStdString(sAuthenticatedMerchant); } - ) + } }; /** Interface to Bitcoin wallet from Qt view code. */ @@ -128,10 +128,10 @@ public: qint64 getBalance(const CCoinControl *coinControl = NULL) const; qint64 getUnconfirmedBalance() const; qint64 getImmatureBalance() const; + bool haveWatchOnly() const; qint64 getWatchBalance() const; qint64 getWatchUnconfirmedBalance() const; qint64 getWatchImmatureBalance() const; - int getNumTransactions() const; EncryptionStatus getEncryptionStatus() const; bool processingQueuedTransactions() { return fProcessingQueuedTransactions; } @@ -198,6 +198,8 @@ public: private: CWallet *wallet; bool fProcessingQueuedTransactions; + bool fHaveWatchOnly; + bool fForceCheckBalanceChanged; // Wallet has an options model for wallet-specific options // (transaction fee, for example) @@ -214,7 +216,6 @@ private: qint64 cachedWatchOnlyBalance; qint64 cachedWatchUnconfBalance; qint64 cachedWatchImmatureBalance; - qint64 cachedNumTransactions; EncryptionStatus cachedEncryptionStatus; int cachedNumBlocks; @@ -229,9 +230,6 @@ signals: void balanceChanged(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance, qint64 watchOnlyBalance, qint64 watchUnconfBalance, qint64 watchImmatureBalance); - // Number of transactions in wallet changed - void numTransactionsChanged(int count); - // Encryption status of wallet changed void encryptionStatusChanged(int status); @@ -249,6 +247,9 @@ signals: // Show progress dialog e.g. for rescan void showProgress(const QString &title, int nProgress); + // Watch-only address added + void notifyWatchonlyChanged(bool fHaveWatchonly); + public slots: /* Wallet status might have changed */ void updateStatus(); @@ -256,6 +257,8 @@ public slots: void updateTransaction(const QString &hash, int status); /* New, updated or removed address book entry */ void updateAddressBook(const QString &address, const QString &label, bool isMine, const QString &purpose, int status); + /* Watch-only added */ + void updateWatchOnlyFlag(bool fHaveWatchonly); /* Current, immature or unconfirmed balance might have changed - emit 'balanceChanged' if so */ void pollBalanceChanged(); /* Needed to update fProcessingQueuedTransactions through a QueuedConnection */ |