]> Git Repo - VerusCoin.git/blob - src/qt/bitcoingui.h
Merge pull request #2840 from sipa/nosendlock
[VerusCoin.git] / src / qt / bitcoingui.h
1 #ifndef BITCOINGUI_H
2 #define BITCOINGUI_H
3
4 #include <QMainWindow>
5 #include <QSystemTrayIcon>
6 #include <QMap>
7
8 class TransactionTableModel;
9 class WalletFrame;
10 class WalletView;
11 class ClientModel;
12 class WalletModel;
13 class WalletStack;
14 class TransactionView;
15 class OverviewPage;
16 class AddressBookPage;
17 class SendCoinsDialog;
18 class SendCoinsRecipient;
19 class SignVerifyMessageDialog;
20 class Notificator;
21 class RPCConsole;
22
23 class CWallet;
24
25 QT_BEGIN_NAMESPACE
26 class QLabel;
27 class QModelIndex;
28 class QProgressBar;
29 class QStackedWidget;
30 class QUrl;
31 class QListWidget;
32 class QPushButton;
33 class QAction;
34 QT_END_NAMESPACE
35
36 /**
37   Bitcoin GUI main class. This class represents the main window of the Bitcoin UI. It communicates with both the client and
38   wallet models to give the user an up-to-date view of the current core state.
39 */
40 class BitcoinGUI : public QMainWindow
41 {
42     Q_OBJECT
43
44 public:
45     static const QString DEFAULT_WALLET;
46
47     explicit BitcoinGUI(bool fIsTestnet = false, QWidget *parent = 0);
48     ~BitcoinGUI();
49
50     /** Set the client model.
51         The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
52     */
53     void setClientModel(ClientModel *clientModel);
54     /** Set the wallet model.
55         The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
56         functionality.
57     */
58
59     bool addWallet(const QString& name, WalletModel *walletModel);
60     bool setCurrentWallet(const QString& name);
61
62     void removeAllWallets();
63
64 protected:
65     void changeEvent(QEvent *e);
66     void closeEvent(QCloseEvent *event);
67     void dragEnterEvent(QDragEnterEvent *event);
68     void dropEvent(QDropEvent *event);
69     bool eventFilter(QObject *object, QEvent *event);
70
71 private:
72     ClientModel *clientModel;
73     WalletFrame *walletFrame;
74
75     QLabel *labelEncryptionIcon;
76     QLabel *labelConnectionsIcon;
77     QLabel *labelBlocksIcon;
78     QLabel *progressBarLabel;
79     QProgressBar *progressBar;
80
81     QMenuBar *appMenuBar;
82     QAction *overviewAction;
83     QAction *historyAction;
84     QAction *quitAction;
85     QAction *sendCoinsAction;
86     QAction *addressBookAction;
87     QAction *signMessageAction;
88     QAction *verifyMessageAction;
89     QAction *aboutAction;
90     QAction *receiveCoinsAction;
91     QAction *optionsAction;
92     QAction *toggleHideAction;
93     QAction *encryptWalletAction;
94     QAction *backupWalletAction;
95     QAction *changePassphraseAction;
96     QAction *aboutQtAction;
97     QAction *openRPCConsoleAction;
98
99     QSystemTrayIcon *trayIcon;
100     Notificator *notificator;
101     TransactionView *transactionView;
102     RPCConsole *rpcConsole;
103
104     QMovie *syncIconMovie;
105     /** Keep track of previous number of blocks, to detect progress */
106     int prevBlocks;
107
108     /** Create the main UI actions. */
109     void createActions(bool fIsTestnet);
110     /** Create the menu bar and sub-menus. */
111     void createMenuBar();
112     /** Create the toolbars */
113     void createToolBars();
114     /** Create system tray icon and notification */
115     void createTrayIcon(bool fIsTestnet);
116     /** Create system tray menu (or setup the dock menu) */
117     void createTrayIconMenu();
118
119 public slots:
120     /** Set number of connections shown in the UI */
121     void setNumConnections(int count);
122     /** Set number of blocks shown in the UI */
123     void setNumBlocks(int count, int nTotalBlocks);
124     /** Set the encryption status as shown in the UI.
125        @param[in] status            current encryption status
126        @see WalletModel::EncryptionStatus
127     */
128     void setEncryptionStatus(int status);
129
130     /** Notify the user of an event from the core network or transaction handling code.
131        @param[in] title     the message box / notification title
132        @param[in] message   the displayed text
133        @param[in] style     modality and style definitions (icon and used buttons - buttons only for message boxes)
134                             @see CClientUIInterface::MessageBoxFlags
135        @param[in] ret       pointer to a bool that will be modified to whether Ok was clicked (modal only)
136     */
137     void message(const QString &title, const QString &message, unsigned int style, bool *ret = NULL);
138     /** Asks the user whether to pay the transaction fee or to cancel the transaction.
139        It is currently not possible to pass a return value to another thread through
140        BlockingQueuedConnection, so an indirected pointer is used.
141        https://bugreports.qt-project.org/browse/QTBUG-10440
142
143       @param[in] nFeeRequired       the required fee
144       @param[out] payFee            true to pay the fee, false to not pay the fee
145     */
146     void askFee(qint64 nFeeRequired, bool *payFee);
147
148     void handlePaymentRequest(const SendCoinsRecipient& recipient);
149     void showPaymentACK(const QString& msg);
150
151     /** Show incoming transaction notification for new transactions. */
152     void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address);
153
154 private slots:
155     /** Switch to overview (home) page */
156     void gotoOverviewPage();
157     /** Switch to history (transactions) page */
158     void gotoHistoryPage();
159     /** Switch to address book page */
160     void gotoAddressBookPage();
161     /** Switch to receive coins page */
162     void gotoReceiveCoinsPage();
163     /** Switch to send coins page */
164     void gotoSendCoinsPage(QString addr = "");
165
166     /** Show Sign/Verify Message dialog and switch to sign message tab */
167     void gotoSignMessageTab(QString addr = "");
168     /** Show Sign/Verify Message dialog and switch to verify message tab */
169     void gotoVerifyMessageTab(QString addr = "");
170
171     /** Show configuration dialog */
172     void optionsClicked();
173     /** Show about dialog */
174     void aboutClicked();
175 #ifndef Q_OS_MAC
176     /** Handle tray icon clicked */
177     void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
178 #endif
179
180     /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
181     void showNormalIfMinimized(bool fToggleHidden = false);
182     /** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */
183     void toggleHidden();
184
185     /** called by a timer to check if fRequestShutdown has been set **/
186     void detectShutdown();
187 };
188
189 #endif // BITCOINGUI_H
This page took 0.033855 seconds and 4 git commands to generate.