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