5 #include <QSystemTrayIcon>
8 class TransactionTableModel;
14 class TransactionView;
16 class SendCoinsDialog;
17 class SendCoinsRecipient;
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();
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);
71 ClientModel *clientModel;
72 WalletFrame *walletFrame;
74 QLabel *labelEncryptionIcon;
75 QLabel *labelConnectionsIcon;
76 QLabel *labelBlocksIcon;
77 QLabel *progressBarLabel;
78 QProgressBar *progressBar;
81 QAction *overviewAction;
82 QAction *historyAction;
84 QAction *sendCoinsAction;
85 QAction *usedSendingAddressesAction;
86 QAction *usedReceivingAddressesAction;
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);
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
144 @param[in] nFeeRequired the required fee
145 @param[out] payFee true to pay the fee, false to not pay the fee
147 void askFee(qint64 nFeeRequired, bool *payFee);
149 bool handlePaymentRequest(const SendCoinsRecipient& recipient);
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 receive coins page */
160 void gotoReceiveCoinsPage();
161 /** Switch to send coins page */
162 void gotoSendCoinsPage(QString addr = "");
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 = "");
169 /** Show configuration dialog */
170 void optionsClicked();
171 /** Show about dialog */
174 /** Handle tray icon clicked */
175 void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
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 */
183 /** called by a timer to check if fRequestShutdown has been set **/
184 void detectShutdown();
187 #endif // BITCOINGUI_H