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