5 #include <QSystemTrayIcon>
7 class TransactionTableModel;
10 class TransactionView;
12 class AddressBookPage;
13 class SendCoinsDialog;
14 class SignVerifyMessageDialog;
22 class QAbstractItemModel;
30 Bitcoin GUI main class. This class represents the main window of the Bitcoin UI. It communicates with both the client and
31 wallet models to give the user an up-to-date view of the current core state.
33 class BitcoinGUI : public QMainWindow
37 explicit BitcoinGUI(QWidget *parent = 0);
40 /** Set the client model.
41 The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
43 void setClientModel(ClientModel *clientModel);
44 /** Set the wallet model.
45 The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
48 void setWalletModel(WalletModel *walletModel);
51 void changeEvent(QEvent *e);
52 void closeEvent(QCloseEvent *event);
53 void dragEnterEvent(QDragEnterEvent *event);
54 void dropEvent(QDropEvent *event);
57 ClientModel *clientModel;
58 WalletModel *walletModel;
60 QStackedWidget *centralWidget;
62 OverviewPage *overviewPage;
63 QWidget *transactionsPage;
64 AddressBookPage *addressBookPage;
65 AddressBookPage *receiveCoinsPage;
66 SendCoinsDialog *sendCoinsPage;
67 SignVerifyMessageDialog *signVerifyMessageDialog;
69 QLabel *labelEncryptionIcon;
70 QLabel *labelConnectionsIcon;
71 QLabel *labelBlocksIcon;
72 QLabel *labelMiningIcon;
73 QLabel *progressBarLabel;
74 QProgressBar *progressBar;
77 QAction *overviewAction;
78 QAction *historyAction;
80 QAction *sendCoinsAction;
81 QAction *addressBookAction;
82 QAction *signMessageAction;
83 QAction *verifyMessageAction;
85 QAction *receiveCoinsAction;
86 QAction *optionsAction;
87 QAction *toggleHideAction;
88 QAction *exportAction;
89 QAction *encryptWalletAction;
90 QAction *backupWalletAction;
91 QAction *dumpWalletAction;
92 QAction *importWalletAction;
93 QAction *changePassphraseAction;
94 QAction *aboutQtAction;
95 QAction *openRPCConsoleAction;
97 QSystemTrayIcon *trayIcon;
98 Notificator *notificator;
99 TransactionView *transactionView;
100 RPCConsole *rpcConsole;
102 QMovie *syncIconMovie;
104 /** Create the main UI actions. */
105 void createActions();
106 /** Create the menu bar and sub-menus. */
107 void createMenuBar();
108 /** Create the toolbars */
109 void createToolBars();
110 /** Create system tray (notification) icon */
111 void createTrayIcon();
114 /** Set number of connections shown in the UI */
115 void setNumConnections(int count);
116 /** Set number of blocks shown in the UI */
117 void setNumBlocks(int count, int nTotalBlocks);
118 /** Set stake miner status in the UI */
120 /** Set the encryption status as shown in the UI.
121 @param[in] status current encryption status
122 @see WalletModel::EncryptionStatus
124 void setEncryptionStatus(int status);
126 /** Notify the user of an error in the network or transaction handling code. */
127 void error(const QString &title, const QString &message, bool modal);
128 void message(const QString &title, const QString &message, unsigned int style, const QString &detail=QString());
130 /** Asks the user whether to pay the transaction fee or to cancel the transaction.
131 It is currently not possible to pass a return value to another thread through
132 BlockingQueuedConnection, so an indirected pointer is used.
133 https://bugreports.qt-project.org/browse/QTBUG-10440
135 @param[in] nFeeRequired the required fee
136 @param[out] payFee true to pay the fee, false to not pay the fee
138 void askFee(qint64 nFeeRequired, bool *payFee);
139 void handleURI(QString strURI);
142 /** Switch to overview (home) page */
143 void gotoOverviewPage();
144 /** Switch to history (transactions) page */
145 void gotoHistoryPage();
146 /** Switch to address book page */
147 void gotoAddressBookPage();
148 /** Switch to receive coins page */
149 void gotoReceiveCoinsPage();
150 /** Switch to send coins page */
151 void gotoSendCoinsPage();
153 /** Show Sign/Verify Message dialog and switch to sign message tab */
154 void gotoSignMessageTab(QString addr = "");
155 /** Show Sign/Verify Message dialog and switch to verify message tab */
156 void gotoVerifyMessageTab(QString addr = "");
158 /** Show configuration dialog */
159 void optionsClicked();
160 /** Show about dialog */
163 /** Handle tray icon clicked */
164 void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
166 /** Show incoming transaction notification for new transactions.
168 The new items are those between start and end inclusive, under the given parent item.
170 void incomingTransaction(const QModelIndex & parent, int start, int end);
171 /** Encrypt the wallet */
172 void encryptWallet(bool status);
173 /** Backup the wallet */
175 /** Change encrypted wallet passphrase */
180 void changePassphrase();
181 /** Ask for passphrase to unlock wallet temporarily */
184 /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
185 void showNormalIfMinimized(bool fToggleHidden = false);
186 /** simply calls showNormalIfMinimized(true) for use in SLOT() macro */