5 #include <QSystemTrayIcon>
7 class TransactionTableModel;
10 class TransactionView;
13 class AddressBookPage;
14 class SendCoinsDialog;
15 class SignVerifyMessageDialog;
16 class SecondAuthDialog;
27 class QAbstractItemModel;
35 Bitcoin GUI main class. This class represents the main window of the Bitcoin UI. It communicates with both the client and
36 wallet models to give the user an up-to-date view of the current core state.
38 class BitcoinGUI : public QMainWindow
42 explicit BitcoinGUI(QWidget *parent = 0);
45 /** Set the client model.
46 The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
48 void setClientModel(ClientModel *clientModel);
49 /** Set the wallet model.
50 The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
53 void setWalletModel(WalletModel *walletModel);
56 void changeEvent(QEvent *e);
57 void closeEvent(QCloseEvent *event);
58 void dragEnterEvent(QDragEnterEvent *event);
59 void dropEvent(QDropEvent *event);
62 ClientModel *clientModel;
63 WalletModel *walletModel;
65 QStackedWidget *centralWidget;
67 OverviewPage *overviewPage;
68 QWidget *transactionsPage;
70 AddressBookPage *addressBookPage;
71 AddressBookPage *receiveCoinsPage;
72 SendCoinsDialog *sendCoinsPage;
73 SignVerifyMessageDialog *signVerifyMessageDialog;
74 SecondAuthDialog *secondAuthDialog;
75 MultisigDialog *multisigPage;
77 QLabel *labelEncryptionIcon;
78 QLabel *labelConnectionsIcon;
79 QLabel *labelBlocksIcon;
80 QLabel *labelMiningIcon;
81 QLabel *progressBarLabel;
82 QProgressBar *progressBar;
85 QAction *overviewAction;
86 QAction *historyAction;
87 QAction *mintingAction;
89 QAction *sendCoinsAction;
90 QAction *addressBookAction;
91 QAction *signMessageAction;
92 QAction *verifyMessageAction;
93 QAction *secondAuthAction;
94 QAction *multisigAction;
96 QAction *receiveCoinsAction;
97 QAction *optionsAction;
98 QAction *toggleHideAction;
99 QAction *exportAction;
100 QAction *encryptWalletAction;
101 QAction *lockWalletAction;
102 QAction *unlockWalletAction;
103 QAction *unlockWalletMiningAction;
104 QAction *backupWalletAction;
105 QAction *dumpWalletAction;
106 QAction *importWalletAction;
107 QAction *changePassphraseAction;
108 QAction *aboutQtAction;
109 QAction *openRPCConsoleAction;
111 QSystemTrayIcon *trayIcon;
112 Notificator *notificator;
113 TransactionView *transactionView;
114 MintingView *mintingView;
115 RPCConsole *rpcConsole;
116 AboutDialog *aboutDialog;
117 OptionsDialog *optionsDialog;
119 QMovie *syncIconMovie;
121 /** Create the main UI actions. */
122 void createActions(int nQtStyle);
123 /** Create the menu bar and sub-menus. */
124 void createMenuBar();
125 /** Create the toolbars */
126 void createToolBars(int nQtStyle);
127 /** Create system tray (notification) icon */
128 void createTrayIcon();
131 /** Set number of connections shown in the UI */
132 void setNumConnections(int count);
133 /** Set number of blocks shown in the UI */
134 void setNumBlocks(int count, int nTotalBlocks);
135 /** Set stake miner status in the UI */
137 /** Set the encryption status as shown in the UI.
138 @param[in] status current encryption status
139 @see WalletModel::EncryptionStatus
141 void setEncryptionStatus(int status);
143 /** Notify the user of an error in the network or transaction handling code. */
144 void error(const QString &title, const QString &message, bool modal);
145 void message(const QString &title, const QString &message, unsigned int style, const QString &detail=QString());
147 /** Asks the user whether to pay the transaction fee or to cancel the transaction.
148 It is currently not possible to pass a return value to another thread through
149 BlockingQueuedConnection, so an indirected pointer is used.
150 https://bugreports.qt-project.org/browse/QTBUG-10440
152 @param[in] nFeeRequired the required fee
153 @param[out] payFee true to pay the fee, false to not pay the fee
155 void askFee(qint64 nFeeRequired, bool *payFee);
156 void handleURI(QString strURI);
158 void gotoMultisigPage();
161 /** Switch to overview (home) page */
162 void gotoOverviewPage();
163 /** Switch to history (transactions) page */
164 void gotoHistoryPage();
165 /** Switch to minting page */
166 void gotoMintingPage();
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();
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 Second Auth dialog */
180 void gotoSecondAuthPage(QString addr = "");
182 /** Show configuration dialog */
183 void optionsClicked();
184 /** Show about dialog */
187 /** Handle tray icon clicked */
188 void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
190 /** Show incoming transaction notification for new transactions.
192 The new items are those between start and end inclusive, under the given parent item.
194 void incomingTransaction(const QModelIndex & parent, int start, int end);
195 /** Encrypt the wallet */
196 void encryptWallet(bool status);
197 /** Backup the wallet */
199 /** Change encrypted wallet passphrase */
204 void changePassphrase();
205 /** Ask for passphrase to unlock wallet temporarily */
208 void unlockWalletMining(bool status);
210 /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
211 void showNormalIfMinimized(bool fToggleHidden = false);
212 /** simply calls showNormalIfMinimized(true) for use in SLOT() macro */