4b7131710c531dfa7bb8c5e4645445e6a1faf0ec
[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
77     QSystemTrayIcon *trayIcon;
78     TransactionView *transactionView;
79
80     QMovie *syncIconMovie;
81
82     void createActions();
83     QWidget *createTabs();
84     void createTrayIcon();
85
86 public slots:
87     void setNumConnections(int count);
88     void setNumBlocks(int count);
89     void setEncryptionStatus(int status);
90
91     void error(const QString &title, const QString &message);
92     /* It is currently not possible to pass a return value to another thread through
93        BlockingQueuedConnection, so use an indirected pointer.
94        http://bugreports.qt.nokia.com/browse/QTBUG-10440
95     */
96     void askFee(qint64 nFeeRequired, bool *payFee);
97
98 private slots:
99     // UI pages
100     void gotoOverviewPage();
101     void gotoHistoryPage();
102     void gotoAddressBookPage();
103     void gotoReceiveCoinsPage();
104     void gotoSendCoinsPage();
105
106     // Misc actions
107     void optionsClicked();
108     void aboutClicked();
109     void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
110     void incomingTransaction(const QModelIndex & parent, int start, int end);
111 };
112
113 #endif