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