diff options
Diffstat (limited to 'src/qt/walletmodel.h')
-rw-r--r-- | src/qt/walletmodel.h | 59 |
1 files changed, 20 insertions, 39 deletions
diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index ff4b38a804..8ff19f4ae5 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -13,6 +13,7 @@ #include <qt/paymentrequestplus.h> #include <qt/walletmodeltransaction.h> +#include <interface/wallet.h> #include <support/allocators/secure.h> #include <map> @@ -34,9 +35,12 @@ class CKeyID; class COutPoint; class COutput; class CPubKey; -class CWallet; class uint256; +namespace interface { +class Node; +} // namespace interface + QT_BEGIN_NAMESPACE class QTimer; QT_END_NAMESPACE @@ -107,7 +111,7 @@ class WalletModel : public QObject Q_OBJECT public: - explicit WalletModel(const PlatformStyle *platformStyle, CWallet *wallet, OptionsModel *optionsModel, QObject *parent = 0); + explicit WalletModel(std::unique_ptr<interface::Wallet> wallet, interface::Node& node, const PlatformStyle *platformStyle, CWallet *cwallet, OptionsModel *optionsModel, QObject *parent = 0); ~WalletModel(); enum StatusCode // Returned by sendCoins @@ -136,15 +140,6 @@ public: TransactionTableModel *getTransactionTableModel(); RecentRequestsTableModel *getRecentRequestsTableModel(); - CWallet *getWallet() const { return wallet; }; - - CAmount getBalance(const CCoinControl *coinControl = nullptr) const; - CAmount getUnconfirmedBalance() const; - CAmount getImmatureBalance() const; - bool haveWatchOnly() const; - CAmount getWatchBalance() const; - CAmount getWatchUnconfirmedBalance() const; - CAmount getWatchImmatureBalance() const; EncryptionStatus getEncryptionStatus() const; // Check address for validity @@ -173,8 +168,6 @@ public: // Passphrase only needed when unlocking bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString()); bool changePassphrase(const SecureString &oldPass, const SecureString &newPass); - // Wallet backup - bool backupWallet(const QString &filename); // RAI object for unlocking wallet, returned by requestUnlock() class UnlockContext @@ -198,40 +191,33 @@ public: UnlockContext requestUnlock(); - bool getPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const; - bool IsSpendable(const CTxDestination& dest) const; - bool getPrivKey(const CKeyID &address, CKey& vchPrivKeyOut) const; void getOutputs(const std::vector<COutPoint>& vOutpoints, std::vector<COutput>& vOutputs); bool isSpent(const COutPoint& outpoint) const; void listCoins(std::map<QString, std::vector<COutput> >& mapCoins) const; - bool isLockedCoin(uint256 hash, unsigned int n) const; - void lockCoin(COutPoint& output); - void unlockCoin(COutPoint& output); - void listLockedCoins(std::vector<COutPoint>& vOutpts); - void loadReceiveRequests(std::vector<std::string>& vReceiveRequests); bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest); - bool transactionCanBeAbandoned(uint256 hash) const; - bool abandonTransaction(uint256 hash) const; - - bool transactionCanBeBumped(uint256 hash) const; bool bumpFee(uint256 hash); static bool isWalletEnabled(); - bool hdEnabled() const; - - OutputType getDefaultAddressType() const; - - int getDefaultConfirmTarget() const; + interface::Node& node() const { return m_node; } + interface::Wallet& wallet() const { return *m_wallet; } QString getWalletName() const; - static bool isMultiwallet(); + bool isMultiwallet(); private: - CWallet *wallet; + std::unique_ptr<interface::Wallet> m_wallet; + std::unique_ptr<interface::Handler> m_handler_status_changed; + std::unique_ptr<interface::Handler> m_handler_address_book_changed; + std::unique_ptr<interface::Handler> m_handler_transaction_changed; + std::unique_ptr<interface::Handler> m_handler_show_progress; + std::unique_ptr<interface::Handler> m_handler_watch_only_changed; + interface::Node& m_node; + + CWallet *cwallet; bool fHaveWatchOnly; bool fForceCheckBalanceChanged; @@ -244,12 +230,7 @@ private: RecentRequestsTableModel *recentRequestsTableModel; // Cache some values to be able to detect changes - CAmount cachedBalance; - CAmount cachedUnconfirmedBalance; - CAmount cachedImmatureBalance; - CAmount cachedWatchOnlyBalance; - CAmount cachedWatchUnconfBalance; - CAmount cachedWatchImmatureBalance; + interface::WalletBalances m_cached_balances; EncryptionStatus cachedEncryptionStatus; int cachedNumBlocks; @@ -257,7 +238,7 @@ private: void subscribeToCoreSignals(); void unsubscribeFromCoreSignals(); - void checkBalanceChanged(); + void checkBalanceChanged(const interface::WalletBalances& new_balances); Q_SIGNALS: // Signal that balance in wallet changed |