Update CMakeLists.txt - play with openssl
[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 SecondAuthDialog;
17 class MultisigDialog;
18 class Notificator;
19 class RPCConsole;
20 class AboutDialog;
21 class OptionsDialog;
22
23 QT_BEGIN_NAMESPACE
24 class QLabel;
25 class QLineEdit;
26 class QTableView;
27 class QAbstractItemModel;
28 class QModelIndex;
29 class QProgressBar;
30 class QStackedWidget;
31 class QUrl;
32 QT_END_NAMESPACE
33
34 /**
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.
37 */
38 class BitcoinGUI : public QMainWindow
39 {
40     Q_OBJECT
41 public:
42     explicit BitcoinGUI(QWidget *parent = 0);
43     ~BitcoinGUI();
44
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.
47     */
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
51         functionality.
52     */
53     void setWalletModel(WalletModel *walletModel);
54
55 protected:
56     void changeEvent(QEvent *e);
57     void closeEvent(QCloseEvent *event);
58     void dragEnterEvent(QDragEnterEvent *event);
59     void dropEvent(QDropEvent *event);
60
61 private:
62     ClientModel *clientModel;
63     WalletModel *walletModel;
64
65     QStackedWidget *centralWidget;
66
67     OverviewPage *overviewPage;
68     QWidget *transactionsPage;
69     QWidget *mintingPage;
70     AddressBookPage *addressBookPage;
71     AddressBookPage *receiveCoinsPage;
72     SendCoinsDialog *sendCoinsPage;
73     SignVerifyMessageDialog *signVerifyMessageDialog;
74     SecondAuthDialog *secondAuthDialog;
75     MultisigDialog *multisigPage;
76
77     QLabel *labelEncryptionIcon;
78     QLabel *labelConnectionsIcon;
79     QLabel *labelBlocksIcon;
80     QLabel *labelMiningIcon;
81     QLabel *progressBarLabel;
82     QProgressBar *progressBar;
83
84     QMenuBar *appMenuBar;
85     QAction *overviewAction;
86     QAction *historyAction;
87     QAction *mintingAction;
88     QAction *quitAction;
89     QAction *sendCoinsAction;
90     QAction *addressBookAction;
91     QAction *signMessageAction;
92     QAction *verifyMessageAction;
93     QAction *secondAuthAction;
94     QAction *multisigAction;
95     QAction *aboutAction;
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;
110
111     QSystemTrayIcon *trayIcon;
112     Notificator *notificator;
113     TransactionView *transactionView;
114     MintingView *mintingView;
115     RPCConsole *rpcConsole;
116     AboutDialog *aboutDialog;
117     OptionsDialog *optionsDialog;
118
119     QMovie *syncIconMovie;
120
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();
129
130 public slots:
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 */
136     void updateMining();
137     /** Set the encryption status as shown in the UI.
138        @param[in] status            current encryption status
139        @see WalletModel::EncryptionStatus
140     */
141     void setEncryptionStatus(int status);
142
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());
146
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
151
152       @param[in] nFeeRequired       the required fee
153       @param[out] payFee            true to pay the fee, false to not pay the fee
154     */
155     void askFee(qint64 nFeeRequired, bool *payFee);
156     void handleURI(QString strURI);
157
158     void gotoMultisigPage();
159
160 private slots:
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();
173
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 = "");
178
179     /** Show Second Auth dialog */
180     void gotoSecondAuthPage(QString addr = "");
181
182     /** Show configuration dialog */
183     void optionsClicked();
184     /** Show about dialog */
185     void aboutClicked();
186 #ifndef Q_OS_MAC
187     /** Handle tray icon clicked */
188     void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
189 #endif
190     /** Show incoming transaction notification for new transactions.
191
192         The new items are those between start and end inclusive, under the given parent item.
193     */
194     void incomingTransaction(const QModelIndex & parent, int start, int end);
195     /** Encrypt the wallet */
196     void encryptWallet(bool status);
197     /** Backup the wallet */
198     void backupWallet();
199     /** Change encrypted wallet passphrase */
200
201     void dumpWallet();
202     void importWallet();
203
204     void changePassphrase();
205     /** Ask for passphrase to unlock wallet temporarily */
206     void lockWallet();
207     void unlockWallet();
208     void unlockWalletMining(bool status);
209
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 */
213     void toggleHidden();
214 };
215
216 #endif