Line data Source code
1 : // Copyright (c) 2011-2020 The Bitcoin Core developers 2 : // Distributed under the MIT software license, see the accompanying 3 : // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 : 5 : #ifndef BITCOIN_QT_WALLETVIEW_H 6 : #define BITCOIN_QT_WALLETVIEW_H 7 : 8 : #include <amount.h> 9 : 10 : #include <QStackedWidget> 11 : 12 : class ClientModel; 13 : class OverviewPage; 14 : class PlatformStyle; 15 : class ReceiveCoinsDialog; 16 : class SendCoinsDialog; 17 : class SendCoinsRecipient; 18 : class TransactionView; 19 : class WalletModel; 20 : class AddressBookPage; 21 : 22 : QT_BEGIN_NAMESPACE 23 : class QModelIndex; 24 : class QProgressDialog; 25 : QT_END_NAMESPACE 26 : 27 : /* 28 : WalletView class. This class represents the view to a single wallet. 29 : It was added to support multiple wallet functionality. Each wallet gets its own WalletView instance. 30 : It communicates with both the client and the wallet models to give the user an up-to-date view of the 31 : current core state. 32 : */ 33 : class WalletView : public QStackedWidget 34 : { 35 0 : Q_OBJECT 36 : 37 : public: 38 : explicit WalletView(const PlatformStyle *platformStyle, QWidget *parent); 39 : ~WalletView(); 40 : 41 : /** Set the client model. 42 : The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic. 43 : */ 44 : void setClientModel(ClientModel *clientModel); 45 0 : WalletModel *getWalletModel() { return walletModel; } 46 : /** Set the wallet model. 47 : The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending 48 : functionality. 49 : */ 50 : void setWalletModel(WalletModel *walletModel); 51 : 52 : bool handlePaymentRequest(const SendCoinsRecipient& recipient); 53 : 54 : void showOutOfSyncWarning(bool fShow); 55 : 56 : private: 57 : ClientModel *clientModel; 58 : WalletModel *walletModel; 59 : 60 : OverviewPage *overviewPage; 61 : QWidget *transactionsPage; 62 : ReceiveCoinsDialog *receiveCoinsPage; 63 : SendCoinsDialog *sendCoinsPage; 64 : AddressBookPage *usedSendingAddressesPage; 65 : AddressBookPage *usedReceivingAddressesPage; 66 : 67 : TransactionView *transactionView; 68 : 69 : QProgressDialog* progressDialog{nullptr}; 70 : const PlatformStyle *platformStyle; 71 : 72 : public Q_SLOTS: 73 : /** Switch to overview (home) page */ 74 : void gotoOverviewPage(); 75 : /** Switch to history (transactions) page */ 76 : void gotoHistoryPage(); 77 : /** Switch to receive coins page */ 78 : void gotoReceiveCoinsPage(); 79 : /** Switch to send coins page */ 80 : void gotoSendCoinsPage(QString addr = ""); 81 : 82 : /** Show Sign/Verify Message dialog and switch to sign message tab */ 83 : void gotoSignMessageTab(QString addr = ""); 84 : /** Show Sign/Verify Message dialog and switch to verify message tab */ 85 : void gotoVerifyMessageTab(QString addr = ""); 86 : /** Load Partially Signed Bitcoin Transaction */ 87 : void gotoLoadPSBT(bool from_clipboard = false); 88 : 89 : /** Show incoming transaction notification for new transactions. 90 : 91 : The new items are those between start and end inclusive, under the given parent item. 92 : */ 93 : void processNewTransaction(const QModelIndex& parent, int start, int /*end*/); 94 : /** Encrypt the wallet */ 95 : void encryptWallet(bool status); 96 : /** Backup the wallet */ 97 : void backupWallet(); 98 : /** Change encrypted wallet passphrase */ 99 : void changePassphrase(); 100 : /** Ask for passphrase to unlock wallet temporarily */ 101 : void unlockWallet(); 102 : 103 : /** Show used sending addresses */ 104 : void usedSendingAddresses(); 105 : /** Show used receiving addresses */ 106 : void usedReceivingAddresses(); 107 : 108 : /** Re-emit encryption status signal */ 109 : void updateEncryptionStatus(); 110 : 111 : /** Show progress dialog e.g. for rescan */ 112 : void showProgress(const QString &title, int nProgress); 113 : 114 : /** User has requested more information about the out of sync state */ 115 : void requestedSyncWarningInfo(); 116 : 117 : Q_SIGNALS: 118 : void setPrivacy(bool privacy); 119 : void transactionClicked(); 120 : void coinsSent(); 121 : /** Fired when a message should be reported to the user */ 122 : void message(const QString &title, const QString &message, unsigned int style); 123 : /** Encryption status of wallet changed */ 124 : void encryptionStatusChanged(); 125 : /** HD-Enabled status of wallet changed (only possible during startup) */ 126 : void hdEnabledStatusChanged(); 127 : /** Notify that a new transaction appeared */ 128 : void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label, const QString& walletName); 129 : /** Notify that the out of sync warning icon has been pressed */ 130 : void outOfSyncWarningClicked(); 131 : }; 132 : 133 : #endif // BITCOIN_QT_WALLETVIEW_H