You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

walletview.h 4.4KB

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