устранил некоторые предупреждения компилятора
[novacoin.git] / src / qt / bitcoingui.h
1 #ifndef BITCOINGUI_H
2 #define BITCOINGUI_H
3
4 #include <QMainWindow>
5 #include <QSystemTrayIcon>
6
7 class TransactionTableModel;
8 class ClientModel;
9 class WalletModel;
10 class TransactionView;
11 class MintingView;
12 class OverviewPage;
13 class AddressBookPage;
14 class SendCoinsDialog;
15 class SignVerifyMessageDialog;
16 class MultisigDialog;
17 class Notificator;
18 class RPCConsole;
19 class AboutDialog;
20 class OptionsDialog;
21
22 QT_BEGIN_NAMESPACE
23 class QLabel;
24 class QLineEdit;
25 class QTableView;
26 class QAbstractItemModel;
27 class QModelIndex;
28 class QProgressBar;
29 class QStackedWidget;
30 class QUrl;
31 QT_END_NAMESPACE
32
33 /**
34   Bitcoin GUI main class. This class represents the main window of the Bitcoin UI. It communicates with both the client and
35   wallet models to give the user an up-to-date view of the current core state.
36 */
37 class BitcoinGUI : public QMainWindow
38 {
39     Q_OBJECT
40 public:
41     explicit BitcoinGUI(QWidget *parent = 0);
42     ~BitcoinGUI();
43
44     /** Set the client model.
45         The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
46     */
47     void setClientModel(ClientModel *clientModel);
48     /** Set the wallet model.
49         The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
50         functionality.
51     */
52     void setWalletModel(WalletModel *walletModel);
53
54 protected:
55     void changeEvent(QEvent *e);
56     void closeEvent(QCloseEvent *event);
57     void dragEnterEvent(QDragEnterEvent *event);
58     void dropEvent(QDropEvent *event);
59
60 private:
61     ClientModel *clientModel;
62     WalletModel *walletModel;
63
64     QStackedWidget *centralWidget;
65
66     OverviewPage *overviewPage;
67     QWidget *transactionsPage;
68     QWidget *mintingPage;
69     AddressBookPage *addressBookPage;
70     AddressBookPage *receiveCoinsPage;
71     SendCoinsDialog *sendCoinsPage;
72     SignVerifyMessageDialog *signVerifyMessageDialog;
73     MultisigDialog *multisigPage;
74
75     QLabel *labelEncryptionIcon;
76     QLabel *labelConnectionsIcon;
77     QLabel *labelBlocksIcon;
78     QLabel *labelMiningIcon;
79     QLabel *progressBarLabel;
80     QProgressBar *progressBar;
81
82     QMenuBar *appMenuBar;
83     QAction *overviewAction;
84     QAction *historyAction;
85     QAction *mintingAction;
86     QAction *quitAction;
87     QAction *sendCoinsAction;
88     QAction *addressBookAction;
89     QAction *signMessageAction;
90     QAction *verifyMessageAction;
91     QAction *multisigAction;
92     QAction *aboutAction;
93     QAction *receiveCoinsAction;
94     QAction *optionsAction;
95     QAction *toggleHideAction;
96     QAction *exportAction;
97     QAction *encryptWalletAction;
98     QAction *lockWalletAction;
99     QAction *unlockWalletAction;
100     QAction *unlockWalletMiningAction;
101     QAction *backupWalletAction;
102     QAction *dumpWalletAction;
103     QAction *importWalletAction;
104     QAction *changePassphraseAction;
105     QAction *aboutQtAction;
106     QAction *openRPCConsoleAction;
107
108     QSystemTrayIcon *trayIcon;
109     Notificator *notificator;
110     TransactionView *transactionView;
111     MintingView *mintingView;
112     RPCConsole *rpcConsole;
113     AboutDialog *aboutDialog;
114     OptionsDialog *optionsDialog;
115
116     QMovie *syncIconMovie;
117
118     /** Create the main UI actions. */
119     void createActions();
120     /** Create the menu bar and sub-menus. */
121     void createMenuBar();
122     /** Create the toolbars */
123     void createToolBars();
124     /** Create system tray (notification) icon */
125     void createTrayIcon();
126
127 public slots:
128     /** Set number of connections shown in the UI */
129     void setNumConnections(int count);
130     /** Set number of blocks shown in the UI */
131     void setNumBlocks(int count, int nTotalBlocks);
132     /** Set stake miner status in the UI */
133     void updateMining();
134     /** Set the encryption status as shown in the UI.
135        @param[in] status            current encryption status
136        @see WalletModel::EncryptionStatus
137     */
138     void setEncryptionStatus(int status);
139
140     /** Notify the user of an error in the network or transaction handling code. */
141     void message(const QString &title, const QString &message, unsigned int style, const QString &detail=QString());
142
143     /** Asks the user whether to pay the transaction fee or to cancel the transaction.
144        It is currently not possible to pass a return value to another thread through
145        BlockingQueuedConnection, so an indirected pointer is used.
146        https://bugreports.qt-project.org/browse/QTBUG-10440
147
148       @param[in] nFeeRequired       the required fee
149       @param[out] payFee            true to pay the fee, false to not pay the fee
150     */
151     void askFee(qint64 nFeeRequired, bool *payFee);
152     void handleURI(QString strURI);
153
154     void gotoMultisigPage();
155
156 private slots:
157     /** Switch to overview (home) page */
158     void gotoOverviewPage();
159     /** Switch to history (transactions) page */
160     void gotoHistoryPage();
161     /** Switch to minting page */
162     void gotoMintingPage();
163     /** Switch to address book page */
164     void gotoAddressBookPage();
165     /** Switch to receive coins page */
166     void gotoReceiveCoinsPage();
167     /** Switch to send coins page */
168     void gotoSendCoinsPage();
169
170     /** Show Sign/Verify Message dialog and switch to sign message tab */
171     void gotoSignMessageTab(QString addr = "");
172     /** Show Sign/Verify Message dialog and switch to verify message tab */
173     void gotoVerifyMessageTab(QString addr = "");
174
175     /** Show configuration dialog */
176     void optionsClicked();
177     /** Show about dialog */
178     void aboutClicked();
179 #ifndef Q_OS_MAC
180     /** Handle tray icon clicked */
181     void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
182 #endif
183     /** Show incoming transaction notification for new transactions.
184
185         The new items are those between start and end inclusive, under the given parent item.
186     */
187     void incomingTransaction(const QModelIndex & parent, int start, int end);
188     /** Encrypt the wallet */
189     void encryptWallet(bool status);
190     /** Backup the wallet */
191     void backupWallet();
192     /** Change encrypted wallet passphrase */
193
194     void dumpWallet();
195     void importWallet();
196
197     void changePassphrase();
198     /** Ask for passphrase to unlock wallet temporarily */
199     void lockWallet();
200     void unlockWallet();
201     void unlockWalletMining(bool status);
202
203     /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
204     void showNormalIfMinimized(bool fToggleHidden = false);
205     /** simply calls showNormalIfMinimized(true) for use in SLOT() macro */
206     void toggleHidden();
207 };
208
209 #endif