]> Git Repo - VerusCoin.git/blob - src/qt/bitcoingui.h
Merge pull request #3144 from Diapolo/message_sendcoinsdialog
[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 SendCoinsDialog;
17 class SendCoinsRecipient;
18 class SignVerifyMessageDialog;
19 class Notificator;
20 class RPCConsole;
21
22 class CWallet;
23
24 QT_BEGIN_NAMESPACE
25 class QLabel;
26 class QModelIndex;
27 class QProgressBar;
28 class QStackedWidget;
29 class QUrl;
30 class QListWidget;
31 class QPushButton;
32 class QAction;
33 QT_END_NAMESPACE
34
35 /**
36   Bitcoin GUI main class. This class represents the main window of the Bitcoin UI. It communicates with both the client and
37   wallet models to give the user an up-to-date view of the current core state.
38 */
39 class BitcoinGUI : public QMainWindow
40 {
41     Q_OBJECT
42
43 public:
44     static const QString DEFAULT_WALLET;
45
46     explicit BitcoinGUI(bool fIsTestnet = false, QWidget *parent = 0);
47     ~BitcoinGUI();
48
49     /** Set the client model.
50         The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
51     */
52     void setClientModel(ClientModel *clientModel);
53     /** Set the wallet model.
54         The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
55         functionality.
56     */
57
58     bool addWallet(const QString& name, WalletModel *walletModel);
59     bool setCurrentWallet(const QString& name);
60
61     void removeAllWallets();
62
63 protected:
64     void changeEvent(QEvent *e);
65     void closeEvent(QCloseEvent *event);
66     void dragEnterEvent(QDragEnterEvent *event);
67     void dropEvent(QDropEvent *event);
68     bool eventFilter(QObject *object, QEvent *event);
69
70 private:
71     ClientModel *clientModel;
72     WalletFrame *walletFrame;
73
74     QLabel *labelEncryptionIcon;
75     QLabel *labelConnectionsIcon;
76     QLabel *labelBlocksIcon;
77     QLabel *progressBarLabel;
78     QProgressBar *progressBar;
79
80     QMenuBar *appMenuBar;
81     QAction *overviewAction;
82     QAction *historyAction;
83     QAction *quitAction;
84     QAction *sendCoinsAction;
85     QAction *usedSendingAddressesAction;
86     QAction *usedReceivingAddressesAction;
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
139     /** Asks the user whether to pay the transaction fee or to cancel the transaction.
140        It is currently not possible to pass a return value to another thread through
141        BlockingQueuedConnection, so an indirected pointer is used.
142        https://bugreports.qt-project.org/browse/QTBUG-10440
143
144       @param[in] nFeeRequired       the required fee
145       @param[out] payFee            true to pay the fee, false to not pay the fee
146     */
147     void askFee(qint64 nFeeRequired, bool *payFee);
148
149     bool handlePaymentRequest(const SendCoinsRecipient& recipient);
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 receive coins page */
160     void gotoReceiveCoinsPage();
161     /** Switch to send coins page */
162     void gotoSendCoinsPage(QString addr = "");
163
164     /** Show Sign/Verify Message dialog and switch to sign message tab */
165     void gotoSignMessageTab(QString addr = "");
166     /** Show Sign/Verify Message dialog and switch to verify message tab */
167     void gotoVerifyMessageTab(QString addr = "");
168
169     /** Show configuration dialog */
170     void optionsClicked();
171     /** Show about dialog */
172     void aboutClicked();
173 #ifndef Q_OS_MAC
174     /** Handle tray icon clicked */
175     void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
176 #endif
177
178     /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
179     void showNormalIfMinimized(bool fToggleHidden = false);
180     /** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */
181     void toggleHidden();
182
183     /** called by a timer to check if fRequestShutdown has been set **/
184     void detectShutdown();
185 };
186
187 #endif // BITCOINGUI_H
This page took 0.033888 seconds and 4 git commands to generate.