Wallet encryption part 2: ask passphrase when needed, add menu options
[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 OverviewPage;
12 class AddressBookPage;
13 class SendCoinsDialog;
14
15 QT_BEGIN_NAMESPACE
16 class QLabel;
17 class QLineEdit;
18 class QTableView;
19 class QAbstractItemModel;
20 class QModelIndex;
21 class QProgressBar;
22 class QStackedWidget;
23 class QUrl;
24 QT_END_NAMESPACE
25
26 class BitcoinGUI : public QMainWindow
27 {
28     Q_OBJECT
29 public:
30     explicit BitcoinGUI(QWidget *parent = 0);
31     void setClientModel(ClientModel *clientModel);
32     void setWalletModel(WalletModel *walletModel);
33     
34     /* Transaction table tab indices */
35     enum {
36         AllTransactions = 0,
37         SentReceived = 1,
38         Sent = 2,
39         Received = 3
40     } TabIndex;
41
42 protected:
43     void changeEvent(QEvent *e);
44     void closeEvent(QCloseEvent *event);
45     void dragEnterEvent(QDragEnterEvent *event);
46     void dropEvent(QDropEvent *event);
47
48 private:
49     ClientModel *clientModel;
50     WalletModel *walletModel;
51
52     QStackedWidget *centralWidget;
53
54     OverviewPage *overviewPage;
55     QWidget *transactionsPage;
56     AddressBookPage *addressBookPage;
57     AddressBookPage *receiveCoinsPage;
58     SendCoinsDialog *sendCoinsPage;
59
60     QLabel *labelEncryptionIcon;
61     QLabel *labelConnectionsIcon;
62     QLabel *labelBlocksIcon;
63     QLabel *progressBarLabel;
64     QProgressBar *progressBar;
65
66     QAction *overviewAction;
67     QAction *historyAction;
68     QAction *quitAction;
69     QAction *sendCoinsAction;
70     QAction *addressBookAction;
71     QAction *aboutAction;
72     QAction *receiveCoinsAction;
73     QAction *optionsAction;
74     QAction *openBitcoinAction;
75     QAction *exportAction;
76     QAction *encryptWalletAction;
77     QAction *changePassphraseAction;
78
79     QSystemTrayIcon *trayIcon;
80     TransactionView *transactionView;
81
82     QMovie *syncIconMovie;
83
84     void createActions();
85     QWidget *createTabs();
86     void createTrayIcon();
87
88 public slots:
89     void setNumConnections(int count);
90     void setNumBlocks(int count);
91     void setEncryptionStatus(int status);
92
93     void error(const QString &title, const QString &message);
94     /* It is currently not possible to pass a return value to another thread through
95        BlockingQueuedConnection, so use an indirected pointer.
96        http://bugreports.qt.nokia.com/browse/QTBUG-10440
97     */
98     void askFee(qint64 nFeeRequired, bool *payFee);
99
100 private slots:
101     // UI pages
102     void gotoOverviewPage();
103     void gotoHistoryPage();
104     void gotoAddressBookPage();
105     void gotoReceiveCoinsPage();
106     void gotoSendCoinsPage();
107
108     // Misc actions
109     void optionsClicked();
110     void aboutClicked();
111     void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
112     void incomingTransaction(const QModelIndex & parent, int start, int end);
113     void encryptWallet(bool status);
114     void changePassphrase();
115     void unlockWallet();
116 };
117
118 #endif