5 #include <QSystemTrayIcon>
7 class TransactionTableModel;
10 class TransactionView;
13 class AddressBookPage;
14 class SendCoinsDialog;
15 class SignVerifyMessageDialog;
25 class QAbstractItemModel;
33 Bitcoin GUI main class. This class represents the main window of the Bitcoin UI. It communicates with both the client and
34 wallet models to give the user an up-to-date view of the current core state.
36 class BitcoinGUI : public QMainWindow
40 explicit BitcoinGUI(QWidget *parent = 0);
43 /** Set the client model.
44 The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
46 void setClientModel(ClientModel *clientModel);
47 /** Set the wallet model.
48 The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
51 void setWalletModel(WalletModel *walletModel);
54 void changeEvent(QEvent *e);
55 void closeEvent(QCloseEvent *event);
56 void dragEnterEvent(QDragEnterEvent *event);
57 void dropEvent(QDropEvent *event);
60 ClientModel *clientModel;
61 WalletModel *walletModel;
63 QStackedWidget *centralWidget;
65 OverviewPage *overviewPage;
66 QWidget *transactionsPage;
68 AddressBookPage *addressBookPage;
69 AddressBookPage *receiveCoinsPage;
70 SendCoinsDialog *sendCoinsPage;
71 SignVerifyMessageDialog *signVerifyMessageDialog;
72 MultisigDialog *multisigPage;
74 QLabel *labelEncryptionIcon;
75 QLabel *labelConnectionsIcon;
76 QLabel *labelBlocksIcon;
77 QLabel *labelMiningIcon;
78 QLabel *progressBarLabel;
79 QProgressBar *progressBar;
82 QAction *overviewAction;
83 QAction *historyAction;
84 QAction *mintingAction;
86 QAction *sendCoinsAction;
87 QAction *addressBookAction;
88 QAction *signMessageAction;
89 QAction *verifyMessageAction;
90 QAction *multisigAction;
92 QAction *receiveCoinsAction;
93 QAction *optionsAction;
94 QAction *toggleHideAction;
95 QAction *exportAction;
96 QAction *encryptWalletAction;
97 QAction *lockWalletAction;
98 QAction *unlockWalletAction;
99 QAction *unlockWalletMiningAction;
100 QAction *backupWalletAction;
101 QAction *dumpWalletAction;
102 QAction *importWalletAction;
103 QAction *changePassphraseAction;
104 QAction *aboutQtAction;
105 QAction *openRPCConsoleAction;
107 QSystemTrayIcon *trayIcon;
108 Notificator *notificator;
109 TransactionView *transactionView;
110 MintingView *mintingView;
111 RPCConsole *rpcConsole;
112 AboutDialog *aboutDialog;
114 QMovie *syncIconMovie;
116 /** Create the main UI actions. */
117 void createActions();
118 /** Create the menu bar and sub-menus. */
119 void createMenuBar();
120 /** Create the toolbars */
121 void createToolBars();
122 /** Create system tray (notification) icon */
123 void createTrayIcon();
126 /** Set number of connections shown in the UI */
127 void setNumConnections(int count);
128 /** Set number of blocks shown in the UI */
129 void setNumBlocks(int count, int nTotalBlocks);
130 /** Set stake miner status in the UI */
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 error in the network or transaction handling code. */
139 void error(const QString &title, const QString &message, bool modal);
140 void message(const QString &title, const QString &message, unsigned int style, const QString &detail=QString());
142 /** Asks the user whether to pay the transaction fee or to cancel the transaction.
143 It is currently not possible to pass a return value to another thread through
144 BlockingQueuedConnection, so an indirected pointer is used.
145 https://bugreports.qt-project.org/browse/QTBUG-10440
147 @param[in] nFeeRequired the required fee
148 @param[out] payFee true to pay the fee, false to not pay the fee
150 void askFee(qint64 nFeeRequired, bool *payFee);
151 void handleURI(QString strURI);
153 void gotoMultisigPage();
156 /** Switch to overview (home) page */
157 void gotoOverviewPage();
158 /** Switch to history (transactions) page */
159 void gotoHistoryPage();
160 /** Switch to minting page */
161 void gotoMintingPage();
162 /** Switch to address book page */
163 void gotoAddressBookPage();
164 /** Switch to receive coins page */
165 void gotoReceiveCoinsPage();
166 /** Switch to send coins page */
167 void gotoSendCoinsPage();
169 /** Show Sign/Verify Message dialog and switch to sign message tab */
170 void gotoSignMessageTab(QString addr = "");
171 /** Show Sign/Verify Message dialog and switch to verify message tab */
172 void gotoVerifyMessageTab(QString addr = "");
174 /** Show configuration dialog */
175 void optionsClicked();
176 /** Show about dialog */
179 /** Handle tray icon clicked */
180 void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
182 /** Show incoming transaction notification for new transactions.
184 The new items are those between start and end inclusive, under the given parent item.
186 void incomingTransaction(const QModelIndex & parent, int start, int end);
187 /** Encrypt the wallet */
188 void encryptWallet(bool status);
189 /** Backup the wallet */
191 /** Change encrypted wallet passphrase */
196 void changePassphrase();
197 /** Ask for passphrase to unlock wallet temporarily */
200 void unlockWalletMining(bool status);
202 /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
203 void showNormalIfMinimized(bool fToggleHidden = false);
204 /** simply calls showNormalIfMinimized(true) for use in SLOT() macro */