Изменение базового класса окна About
[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
21 QT_BEGIN_NAMESPACE
22 class QLabel;
23 class QLineEdit;
24 class QTableView;
25 class QAbstractItemModel;
26 class QModelIndex;
27 class QProgressBar;
28 class QStackedWidget;
29 class QUrl;
30 QT_END_NAMESPACE
31
32 /**
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.
35 */
36 class BitcoinGUI : public QMainWindow
37 {
38     Q_OBJECT
39 public:
40     explicit BitcoinGUI(QWidget *parent = 0);
41     ~BitcoinGUI();
42
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.
45     */
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
49         functionality.
50     */
51     void setWalletModel(WalletModel *walletModel);
52
53 protected:
54     void changeEvent(QEvent *e);
55     void closeEvent(QCloseEvent *event);
56     void dragEnterEvent(QDragEnterEvent *event);
57     void dropEvent(QDropEvent *event);
58
59 private:
60     ClientModel *clientModel;
61     WalletModel *walletModel;
62
63     QStackedWidget *centralWidget;
64
65     OverviewPage *overviewPage;
66     QWidget *transactionsPage;
67     QWidget *mintingPage;
68     AddressBookPage *addressBookPage;
69     AddressBookPage *receiveCoinsPage;
70     SendCoinsDialog *sendCoinsPage;
71     SignVerifyMessageDialog *signVerifyMessageDialog;
72     MultisigDialog *multisigPage;
73
74     QLabel *labelEncryptionIcon;
75     QLabel *labelConnectionsIcon;
76     QLabel *labelBlocksIcon;
77     QLabel *labelMiningIcon;
78     QLabel *progressBarLabel;
79     QProgressBar *progressBar;
80
81     QMenuBar *appMenuBar;
82     QAction *overviewAction;
83     QAction *historyAction;
84     QAction *mintingAction;
85     QAction *quitAction;
86     QAction *sendCoinsAction;
87     QAction *addressBookAction;
88     QAction *signMessageAction;
89     QAction *verifyMessageAction;
90     QAction *multisigAction;
91     QAction *aboutAction;
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;
106
107     QSystemTrayIcon *trayIcon;
108     Notificator *notificator;
109     TransactionView *transactionView;
110     MintingView *mintingView;
111     RPCConsole *rpcConsole;
112     AboutDialog *aboutDialog;
113
114     QMovie *syncIconMovie;
115
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();
124
125 public slots:
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 */
131     void updateMining();
132     /** Set the encryption status as shown in the UI.
133        @param[in] status            current encryption status
134        @see WalletModel::EncryptionStatus
135     */
136     void setEncryptionStatus(int status);
137
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());
141
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
146
147       @param[in] nFeeRequired       the required fee
148       @param[out] payFee            true to pay the fee, false to not pay the fee
149     */
150     void askFee(qint64 nFeeRequired, bool *payFee);
151     void handleURI(QString strURI);
152
153     void gotoMultisigPage();
154
155 private slots:
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();
168
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 = "");
173
174     /** Show configuration dialog */
175     void optionsClicked();
176     /** Show about dialog */
177     void aboutClicked();
178 #ifndef Q_OS_MAC
179     /** Handle tray icon clicked */
180     void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
181 #endif
182     /** Show incoming transaction notification for new transactions.
183
184         The new items are those between start and end inclusive, under the given parent item.
185     */
186     void incomingTransaction(const QModelIndex & parent, int start, int end);
187     /** Encrypt the wallet */
188     void encryptWallet(bool status);
189     /** Backup the wallet */
190     void backupWallet();
191     /** Change encrypted wallet passphrase */
192
193     void dumpWallet();
194     void importWallet();
195
196     void changePassphrase();
197     /** Ask for passphrase to unlock wallet temporarily */
198     void lockWallet();
199     void unlockWallet();
200     void unlockWalletMining(bool status);
201
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 */
205     void toggleHidden();
206 };
207
208 #endif