On initial block chain download, show a progress bar
[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
10 QT_BEGIN_NAMESPACE
11 class QLabel;
12 class QLineEdit;
13 class QTableView;
14 class QAbstractItemModel;
15 class QModelIndex;
16 class QProgressBar;
17 QT_END_NAMESPACE
18
19 class BitcoinGUI : public QMainWindow
20 {
21     Q_OBJECT
22 public:
23     explicit BitcoinGUI(QWidget *parent = 0);
24     void setModel(ClientModel *model);
25     
26     /* Transaction table tab indices */
27     enum {
28         AllTransactions = 0,
29         SentReceived = 1,
30         Sent = 2,
31         Received = 3
32     } TabIndex;
33
34 protected:
35     void changeEvent(QEvent *e);
36     void closeEvent(QCloseEvent *event);
37
38 private:
39     ClientModel *model;
40
41     QLineEdit *address;
42     QLabel *labelBalance;
43     QLabel *labelConnections;
44     QLabel *labelConnectionsIcon;
45     QLabel *labelBlocks;
46     QLabel *labelTransactions;
47     QLabel *progressBarLabel;
48     QProgressBar *progressBar;
49
50     QAction *quit;
51     QAction *sendcoins;
52     QAction *addressbook;
53     QAction *about;
54     QAction *receivingAddresses;
55     QAction *options;
56     QAction *openBitcoin;
57
58     QSystemTrayIcon *trayIcon;
59     QList<QTableView *> transactionViews;
60
61     void createActions();
62     QWidget *createTabs();
63     void createTrayIcon();
64     void setTabsModel(QAbstractItemModel *transaction_model);
65
66 public slots:
67     void setBalance(qint64 balance);
68     void setAddress(const QString &address);
69     void setNumConnections(int count);
70     void setNumBlocks(int count);
71     void setNumTransactions(int count);
72     void error(const QString &title, const QString &message);
73     /* It is currently not possible to pass a return value to another thread through
74        BlockingQueuedConnection, so use an indirected pointer.
75        http://bugreports.qt.nokia.com/browse/QTBUG-10440
76     */
77     void askFee(qint64 nFeeRequired, bool *payFee);
78
79 private slots:
80     void sendcoinsClicked();
81     void addressbookClicked();
82     void optionsClicked();
83     void receivingAddressesClicked();
84     void aboutClicked();
85     void newAddressClicked();
86     void copyClipboardClicked();
87     void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
88     void transactionDetails(const QModelIndex& idx);
89     void incomingTransaction(const QModelIndex & parent, int start, int end);
90 };
91
92 #endif