Add context menu on transaction list: copy label, copy address, edit label, show...
[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 QT_END_NAMESPACE
24
25 class BitcoinGUI : public QMainWindow
26 {
27     Q_OBJECT
28 public:
29     explicit BitcoinGUI(QWidget *parent = 0);
30     void setClientModel(ClientModel *clientModel);
31     void setWalletModel(WalletModel *walletModel);
32     
33     /* Transaction table tab indices */
34     enum {
35         AllTransactions = 0,
36         SentReceived = 1,
37         Sent = 2,
38         Received = 3
39     } TabIndex;
40
41 protected:
42     void changeEvent(QEvent *e);
43     void closeEvent(QCloseEvent *event);
44
45 private:
46     ClientModel *clientModel;
47     WalletModel *walletModel;
48
49     QStackedWidget *centralWidget;
50
51     OverviewPage *overviewPage;
52     QWidget *transactionsPage;
53     AddressBookPage *addressBookPage;
54     AddressBookPage *receiveCoinsPage;
55     SendCoinsDialog *sendCoinsPage;
56
57     QLabel *labelConnections;
58     QLabel *labelConnectionsIcon;
59     QLabel *labelBlocks;
60     QLabel *progressBarLabel;
61     QProgressBar *progressBar;
62
63     QAction *overviewAction;
64     QAction *historyAction;
65     QAction *quitAction;
66     QAction *sendCoinsAction;
67     QAction *addressBookAction;
68     QAction *aboutAction;
69     QAction *receiveCoinsAction;
70     QAction *optionsAction;
71     QAction *openBitcoinAction;
72     QAction *exportAction;
73
74     QSystemTrayIcon *trayIcon;
75     TransactionView *transactionView;
76
77     void createActions();
78     QWidget *createTabs();
79     void createTrayIcon();
80
81 public slots:
82     void setBalance(qint64 balance);
83     void setNumConnections(int count);
84     void setNumBlocks(int count);
85     void setNumTransactions(int count);
86     void error(const QString &title, const QString &message);
87     /* It is currently not possible to pass a return value to another thread through
88        BlockingQueuedConnection, so use an indirected pointer.
89        http://bugreports.qt.nokia.com/browse/QTBUG-10440
90     */
91     void askFee(qint64 nFeeRequired, bool *payFee);
92
93 private slots:
94     // UI pages
95     void gotoOverviewPage();
96     void gotoHistoryPage();
97     void gotoAddressBookPage();
98     void gotoReceiveCoinsPage();
99     void gotoSendCoinsPage();
100
101     // Misc actions
102     void optionsClicked();
103     void aboutClicked();
104     void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
105     void incomingTransaction(const QModelIndex & parent, int start, int end);
106     void exportClicked();
107 };
108
109 #endif