377da72611ec04ea8284d7150ec1b15f87c85e2d
[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 *labelConnectionsIcon;
61     QLabel *labelBlocksIcon;
62     QLabel *progressBarLabel;
63     QProgressBar *progressBar;
64
65     QAction *overviewAction;
66     QAction *historyAction;
67     QAction *quitAction;
68     QAction *sendCoinsAction;
69     QAction *addressBookAction;
70     QAction *aboutAction;
71     QAction *receiveCoinsAction;
72     QAction *optionsAction;
73     QAction *openBitcoinAction;
74     QAction *exportAction;
75
76     QSystemTrayIcon *trayIcon;
77     TransactionView *transactionView;
78
79     QMovie *syncIconMovie;
80
81     void createActions();
82     QWidget *createTabs();
83     void createTrayIcon();
84
85 public slots:
86     void setNumConnections(int count);
87     void setNumBlocks(int count);
88     void error(const QString &title, const QString &message);
89     /* It is currently not possible to pass a return value to another thread through
90        BlockingQueuedConnection, so use an indirected pointer.
91        http://bugreports.qt.nokia.com/browse/QTBUG-10440
92     */
93     void askFee(qint64 nFeeRequired, bool *payFee);
94
95 private slots:
96     // UI pages
97     void gotoOverviewPage();
98     void gotoHistoryPage();
99     void gotoAddressBookPage();
100     void gotoReceiveCoinsPage();
101     void gotoSendCoinsPage();
102
103     // Misc actions
104     void optionsClicked();
105     void aboutClicked();
106     void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
107     void incomingTransaction(const QModelIndex & parent, int start, int end);
108 };
109
110 #endif