Line data Source code
1 : // Copyright (c) 2011-2019 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_WALLETFRAME_H 6 : #define BITCOIN_QT_WALLETFRAME_H 7 : 8 : #include <QFrame> 9 : #include <QMap> 10 : 11 : class BitcoinGUI; 12 : class ClientModel; 13 : class PlatformStyle; 14 : class SendCoinsRecipient; 15 : class WalletModel; 16 : class WalletView; 17 : 18 : QT_BEGIN_NAMESPACE 19 : class QStackedWidget; 20 : QT_END_NAMESPACE 21 : 22 : /** 23 : * A container for embedding all wallet-related 24 : * controls into BitcoinGUI. The purpose of this class is to allow future 25 : * refinements of the wallet controls with minimal need for further 26 : * modifications to BitcoinGUI, thus greatly simplifying merges while 27 : * reducing the risk of breaking top-level stuff. 28 : */ 29 : class WalletFrame : public QFrame 30 : { 31 0 : Q_OBJECT 32 : 33 : public: 34 : explicit WalletFrame(const PlatformStyle *platformStyle, BitcoinGUI *_gui = nullptr); 35 : ~WalletFrame(); 36 : 37 : void setClientModel(ClientModel *clientModel); 38 : 39 : bool addWallet(WalletModel *walletModel); 40 : void setCurrentWallet(WalletModel* wallet_model); 41 : void removeWallet(WalletModel* wallet_model); 42 : void removeAllWallets(); 43 : 44 : bool handlePaymentRequest(const SendCoinsRecipient& recipient); 45 : 46 : void showOutOfSyncWarning(bool fShow); 47 : 48 : Q_SIGNALS: 49 : /** Notify that the user has requested more information about the out-of-sync warning */ 50 : void requestedSyncWarningInfo(); 51 : 52 : private: 53 : QStackedWidget *walletStack; 54 : BitcoinGUI *gui; 55 : ClientModel *clientModel; 56 : QMap<WalletModel*, WalletView*> mapWalletViews; 57 : 58 : bool bOutOfSync; 59 : 60 : const PlatformStyle *platformStyle; 61 : 62 : public: 63 : WalletView* currentWalletView() const; 64 : WalletModel* currentWalletModel() const; 65 : 66 : public Q_SLOTS: 67 : /** Switch to overview (home) page */ 68 : void gotoOverviewPage(); 69 : /** Switch to history (transactions) page */ 70 : void gotoHistoryPage(); 71 : /** Switch to receive coins page */ 72 : void gotoReceiveCoinsPage(); 73 : /** Switch to send coins page */ 74 : void gotoSendCoinsPage(QString addr = ""); 75 : 76 : /** Show Sign/Verify Message dialog and switch to sign message tab */ 77 : void gotoSignMessageTab(QString addr = ""); 78 : /** Show Sign/Verify Message dialog and switch to verify message tab */ 79 : void gotoVerifyMessageTab(QString addr = ""); 80 : 81 : /** Load Partially Signed Bitcoin Transaction */ 82 : void gotoLoadPSBT(bool from_clipboard = false); 83 : 84 : /** Encrypt the wallet */ 85 : void encryptWallet(bool status); 86 : /** Backup the wallet */ 87 : void backupWallet(); 88 : /** Change encrypted wallet passphrase */ 89 : void changePassphrase(); 90 : /** Ask for passphrase to unlock wallet temporarily */ 91 : void unlockWallet(); 92 : 93 : /** Show used sending addresses */ 94 : void usedSendingAddresses(); 95 : /** Show used receiving addresses */ 96 : void usedReceivingAddresses(); 97 : /** Pass on signal over requested out-of-sync-warning information */ 98 : void outOfSyncWarningClicked(); 99 : }; 100 : 101 : #endif // BITCOIN_QT_WALLETFRAME_H