5 #include <QSystemTrayIcon>
8 class TransactionTableModel;
14 class TransactionView;
16 class AddressBookPage;
17 class SendCoinsDialog;
18 class SendCoinsRecipient;
19 class SignVerifyMessageDialog;
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.
40 class BitcoinGUI : public QMainWindow
45 static const QString DEFAULT_WALLET;
47 explicit BitcoinGUI(bool fIsTestnet = false, QWidget *parent = 0);
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.
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
59 bool addWallet(const QString& name, WalletModel *walletModel);
60 bool setCurrentWallet(const QString& name);
62 void removeAllWallets();
64 /** Used by WalletView to allow access to needed QActions */
65 // Todo: Use Qt signals for these
66 QAction * getOverviewAction() { return overviewAction; }
67 QAction * getHistoryAction() { return historyAction; }
68 QAction * getAddressBookAction() { return addressBookAction; }
69 QAction * getReceiveCoinsAction() { return receiveCoinsAction; }
70 QAction * getSendCoinsAction() { return sendCoinsAction; }
73 void changeEvent(QEvent *e);
74 void closeEvent(QCloseEvent *event);
75 void dragEnterEvent(QDragEnterEvent *event);
76 void dropEvent(QDropEvent *event);
77 bool eventFilter(QObject *object, QEvent *event);
80 ClientModel *clientModel;
81 WalletFrame *walletFrame;
83 QLabel *labelEncryptionIcon;
84 QLabel *labelConnectionsIcon;
85 QLabel *labelBlocksIcon;
86 QLabel *progressBarLabel;
87 QProgressBar *progressBar;
90 QAction *overviewAction;
91 QAction *historyAction;
93 QAction *sendCoinsAction;
94 QAction *addressBookAction;
95 QAction *signMessageAction;
96 QAction *verifyMessageAction;
98 QAction *receiveCoinsAction;
99 QAction *optionsAction;
100 QAction *toggleHideAction;
101 QAction *encryptWalletAction;
102 QAction *backupWalletAction;
103 QAction *changePassphraseAction;
104 QAction *aboutQtAction;
105 QAction *openRPCConsoleAction;
107 QSystemTrayIcon *trayIcon;
108 Notificator *notificator;
109 TransactionView *transactionView;
110 RPCConsole *rpcConsole;
112 QMovie *syncIconMovie;
113 /** Keep track of previous number of blocks, to detect progress */
116 /** Create the main UI actions. */
117 void createActions(bool fIsTestnet);
118 /** Create the menu bar and sub-menus. */
119 void createMenuBar();
120 /** Create the toolbars */
121 void createToolBars();
122 /** Create system tray icon and notification */
123 void createTrayIcon(bool fIsTestnet);
124 /** Create system tray menu (or setup the dock menu) */
125 void createTrayIconMenu();
128 /** Set number of connections shown in the UI */
129 void setNumConnections(int count);
130 /** Set number of blocks shown in the UI */
131 void setNumBlocks(int count, int nTotalBlocks);
132 /** Set the encryption status as shown in the UI.
133 @param[in] status current encryption status
134 @see WalletModel::EncryptionStatus
136 void setEncryptionStatus(int status);
138 /** Notify the user of an event from the core network or transaction handling code.
139 @param[in] title the message box / notification title
140 @param[in] message the displayed text
141 @param[in] style modality and style definitions (icon and used buttons - buttons only for message boxes)
142 @see CClientUIInterface::MessageBoxFlags
143 @param[in] ret pointer to a bool that will be modified to whether Ok was clicked (modal only)
145 void message(const QString &title, const QString &message, unsigned int style, bool *ret = NULL);
146 /** Asks the user whether to pay the transaction fee or to cancel the transaction.
147 It is currently not possible to pass a return value to another thread through
148 BlockingQueuedConnection, so an indirected pointer is used.
149 https://bugreports.qt-project.org/browse/QTBUG-10440
151 @param[in] nFeeRequired the required fee
152 @param[out] payFee true to pay the fee, false to not pay the fee
154 void askFee(qint64 nFeeRequired, bool *payFee);
156 void handlePaymentRequest(const SendCoinsRecipient& recipient);
157 void showPaymentACK(QString msg);
159 /** Show incoming transaction notification for new transactions. */
160 void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address);
163 /** Switch to overview (home) page */
164 void gotoOverviewPage();
165 /** Switch to history (transactions) page */
166 void gotoHistoryPage();
167 /** Switch to address book page */
168 void gotoAddressBookPage();
169 /** Switch to receive coins page */
170 void gotoReceiveCoinsPage();
171 /** Switch to send coins page */
172 void gotoSendCoinsPage(QString addr = "");
174 /** Show Sign/Verify Message dialog and switch to sign message tab */
175 void gotoSignMessageTab(QString addr = "");
176 /** Show Sign/Verify Message dialog and switch to verify message tab */
177 void gotoVerifyMessageTab(QString addr = "");
179 /** Show configuration dialog */
180 void optionsClicked();
181 /** Show about dialog */
184 /** Handle tray icon clicked */
185 void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
188 /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
189 void showNormalIfMinimized(bool fToggleHidden = false);
190 /** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */
193 /** called by a timer to check if fRequestShutdown has been set **/
194 void detectShutdown();
197 #endif // BITCOINGUI_H