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