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();
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);
72 ClientModel *clientModel;
73 WalletFrame *walletFrame;
75 QLabel *labelEncryptionIcon;
76 QLabel *labelConnectionsIcon;
77 QLabel *labelBlocksIcon;
78 QLabel *progressBarLabel;
79 QProgressBar *progressBar;
82 QAction *overviewAction;
83 QAction *historyAction;
85 QAction *sendCoinsAction;
86 QAction *addressBookAction;
87 QAction *signMessageAction;
88 QAction *verifyMessageAction;
90 QAction *receiveCoinsAction;
91 QAction *optionsAction;
92 QAction *toggleHideAction;
93 QAction *encryptWalletAction;
94 QAction *backupWalletAction;
95 QAction *changePassphraseAction;
96 QAction *aboutQtAction;
97 QAction *openRPCConsoleAction;
99 QSystemTrayIcon *trayIcon;
100 Notificator *notificator;
101 TransactionView *transactionView;
102 RPCConsole *rpcConsole;
104 QMovie *syncIconMovie;
105 /** Keep track of previous number of blocks, to detect progress */
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();
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
128 void setEncryptionStatus(int status);
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)
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
143 @param[in] nFeeRequired the required fee
144 @param[out] payFee true to pay the fee, false to not pay the fee
146 void askFee(qint64 nFeeRequired, bool *payFee);
148 void handlePaymentRequest(const SendCoinsRecipient& recipient);
149 void showPaymentACK(const QString& msg);
151 /** Show incoming transaction notification for new transactions. */
152 void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address);
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 = "");
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 = "");
171 /** Show configuration dialog */
172 void optionsClicked();
173 /** Show about dialog */
176 /** Handle tray icon clicked */
177 void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
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 */
185 /** called by a timer to check if fRequestShutdown has been set **/
186 void detectShutdown();
189 #endif // BITCOINGUI_H