]> Git Repo - VerusCoin.git/blame - src/qt/bitcoingui.h
Merge pull request #4368
[VerusCoin.git] / src / qt / bitcoingui.h
CommitLineData
57702541 1// Copyright (c) 2011-2014 The Bitcoin developers
e592d43f
WL
2// Distributed under the MIT/X11 software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
1355cfe1
WL
5#ifndef BITCOINGUI_H
6#define BITCOINGUI_H
aaa1c3c4 7
b7f4b6d3 8#if defined(HAVE_CONFIG_H)
f3967bcc 9#include "config/bitcoin-config.h"
b7f4b6d3
WL
10#endif
11
aaa1c3c4 12#include <QMainWindow>
67155d92 13#include <QMap>
51ed9ec9 14#include <QSystemTrayIcon>
3f323a61 15
18cab09a 16class ClientModel;
cf9195c8 17class Notificator;
460c51fd 18class RPCConsole;
51ed9ec9
BD
19class SendCoinsRecipient;
20class WalletFrame;
21class WalletModel;
4d1bb15e 22
67155d92
EL
23class CWallet;
24
4d1bb15e 25QT_BEGIN_NAMESPACE
51ed9ec9 26class QAction;
3f323a61 27class QLabel;
6cab6635 28class QProgressBar;
06a91d96 29class QProgressDialog;
4d1bb15e 30QT_END_NAMESPACE
aaa1c3c4 31
66112ed6
WL
32/**
33 Bitcoin GUI main class. This class represents the main window of the Bitcoin UI. It communicates with both the client and
34 wallet models to give the user an up-to-date view of the current core state.
35*/
aaa1c3c4
WL
36class BitcoinGUI : public QMainWindow
37{
38 Q_OBJECT
32af5266 39
aaa1c3c4 40public:
67155d92 41 static const QString DEFAULT_WALLET;
8726de26 42
80fccb0e 43 explicit BitcoinGUI(bool fIsTestnet = false, QWidget *parent = 0);
527137e3 44 ~BitcoinGUI();
45
66112ed6
WL
46 /** Set the client model.
47 The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
48 */
ef079e18 49 void setClientModel(ClientModel *clientModel);
4751df0c 50
b7f4b6d3 51#ifdef ENABLE_WALLET
66112ed6
WL
52 /** Set the wallet model.
53 The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
54 functionality.
55 */
67155d92
EL
56 bool addWallet(const QString& name, WalletModel *walletModel);
57 bool setCurrentWallet(const QString& name);
67155d92 58 void removeAllWallets();
b7f4b6d3 59#endif
840470ec 60
352083cb
WL
61protected:
62 void changeEvent(QEvent *e);
63 void closeEvent(QCloseEvent *event);
db7f0234
WL
64 void dragEnterEvent(QDragEnterEvent *event);
65 void dropEvent(QDropEvent *event);
6f959c4c 66 bool eventFilter(QObject *object, QEvent *event);
352083cb 67
3f323a61 68private:
ef079e18 69 ClientModel *clientModel;
67155d92 70 WalletFrame *walletFrame;
64c8b699 71
ae8adeb9 72 QLabel *labelEncryptionIcon;
b1ef1b24 73 QLabel *labelConnectionsIcon;
8dcffd4d 74 QLabel *labelBlocksIcon;
6cab6635
WL
75 QLabel *progressBarLabel;
76 QProgressBar *progressBar;
06a91d96 77 QProgressDialog *progressDialog;
3f323a61 78
527137e3 79 QMenuBar *appMenuBar;
64c8b699
WL
80 QAction *overviewAction;
81 QAction *historyAction;
3479849d
WL
82 QAction *quitAction;
83 QAction *sendCoinsAction;
74fb765e
WL
84 QAction *usedSendingAddressesAction;
85 QAction *usedReceivingAddressesAction;
47894585 86 QAction *signMessageAction;
0c587936 87 QAction *verifyMessageAction;
3479849d
WL
88 QAction *aboutAction;
89 QAction *receiveCoinsAction;
90 QAction *optionsAction;
86d56349 91 QAction *toggleHideAction;
b7bcaf94 92 QAction *encryptWalletAction;
4efbda3f 93 QAction *backupWalletAction;
b7bcaf94 94 QAction *changePassphraseAction;
01ea41b2 95 QAction *aboutQtAction;
460c51fd 96 QAction *openRPCConsoleAction;
4c603586 97 QAction *openAction;
f0219813 98 QAction *showHelpMessageAction;
abf11f79 99
3f323a61 100 QSystemTrayIcon *trayIcon;
cf9195c8 101 Notificator *notificator;
460c51fd 102 RPCConsole *rpcConsole;
3f323a61 103
24cde0b7
WL
104 /** Keep track of previous number of blocks, to detect progress */
105 int prevBlocks;
f10b2d70 106 int spinnerFrame;
8dcffd4d 107
66112ed6 108 /** Create the main UI actions. */
80fccb0e 109 void createActions(bool fIsTestnet);
814efd6f 110 /** Create the menu bar and sub-menus. */
527137e3 111 void createMenuBar();
66112ed6 112 /** Create the toolbars */
527137e3 113 void createToolBars();
f8210212 114 /** Create system tray icon and notification */
80fccb0e 115 void createTrayIcon(bool fIsTestnet);
f8210212
PK
116 /** Create system tray menu (or setup the dock menu) */
117 void createTrayIconMenu();
3f323a61 118
146ba964
WL
119 /** Enable or disable all wallet-related actions */
120 void setWalletActionsEnabled(bool enabled);
121
35ecf854
WL
122 /** Connect core signals to GUI client */
123 void subscribeToCoreSignals();
124 /** Disconnect core signals from GUI client */
125 void unsubscribeFromCoreSignals();
126
4c603586
WL
127signals:
128 /** Signal raised when a URI was entered or dragged to the GUI */
129 void receivedURI(const QString &uri);
130
1a6d504a 131public slots:
66112ed6 132 /** Set number of connections shown in the UI */
1a6d504a 133 void setNumConnections(int count);
66112ed6 134 /** Set number of blocks shown in the UI */
aa250f04 135 void setNumBlocks(int count);
ae8adeb9 136
5350ea41
PK
137 /** Notify the user of an event from the core network or transaction handling code.
138 @param[in] title the message box / notification title
139 @param[in] message the displayed text
3675588a 140 @param[in] style modality and style definitions (icon and used buttons - buttons only for message boxes)
5350ea41 141 @see CClientUIInterface::MessageBoxFlags
f7f3a96b 142 @param[in] ret pointer to a bool that will be modified to whether Ok was clicked (modal only)
5350ea41 143 */
f7f3a96b 144 void message(const QString &title, const QString &message, unsigned int style, bool *ret = NULL);
08dd1b7b 145
b7f4b6d3
WL
146#ifdef ENABLE_WALLET
147 /** Set the encryption status as shown in the UI.
148 @param[in] status current encryption status
149 @see WalletModel::EncryptionStatus
150 */
151 void setEncryptionStatus(int status);
152
2384a286 153 bool handlePaymentRequest(const SendCoinsRecipient& recipient);
1a6d504a 154
67155d92
EL
155 /** Show incoming transaction notification for new transactions. */
156 void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address);
b7f4b6d3 157#endif
67155d92 158
aaa1c3c4 159private slots:
b7f4b6d3 160#ifdef ENABLE_WALLET
66112ed6 161 /** Switch to overview (home) page */
3479849d 162 void gotoOverviewPage();
66112ed6 163 /** Switch to history (transactions) page */
3479849d 164 void gotoHistoryPage();
66112ed6 165 /** Switch to receive coins page */
3479849d 166 void gotoReceiveCoinsPage();
66112ed6 167 /** Switch to send coins page */
abf11f79 168 void gotoSendCoinsPage(QString addr = "");
3479849d 169
ddadf791
PK
170 /** Show Sign/Verify Message dialog and switch to sign message tab */
171 void gotoSignMessageTab(QString addr = "");
172 /** Show Sign/Verify Message dialog and switch to verify message tab */
173 void gotoVerifyMessageTab(QString addr = "");
174
b7f4b6d3
WL
175 /** Show open dialog */
176 void openClicked();
177#endif
66112ed6 178 /** Show configuration dialog */
af943776 179 void optionsClicked();
66112ed6 180 /** Show about dialog */
8812ce7b 181 void aboutClicked();
f0219813
PK
182 /** Show help message dialog */
183 void showHelpMessageClicked();
81605d90 184#ifndef Q_OS_MAC
66112ed6 185 /** Handle tray icon clicked */
352083cb 186 void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
527137e3 187#endif
17690ea5 188
d2e6dd6c
PK
189 /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
190 void showNormalIfMinimized(bool fToggleHidden = false);
6f959c4c 191 /** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */
86d56349 192 void toggleHidden();
723035bb
GA
193
194 /** called by a timer to check if fRequestShutdown has been set **/
195 void detectShutdown();
06a91d96
CL
196
197 /** Show progress dialog e.g. for verifychain */
198 void showProgress(const QString &title, int nProgress);
aaa1c3c4
WL
199};
200
128eefa0 201#endif // BITCOINGUI_H
This page took 0.188093 seconds and 4 git commands to generate.