Improved Mac experience; QDoubleSpinBox for BitcoinAmountField
[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 class Notificator;
15
16 QT_BEGIN_NAMESPACE
17 class QLabel;
18 class QLineEdit;
19 class QTableView;
20 class QAbstractItemModel;
21 class QModelIndex;
22 class QProgressBar;
23 class QStackedWidget;
24 class QUrl;
25 QT_END_NAMESPACE
26
27 class BitcoinGUI : public QMainWindow
28 {
29     Q_OBJECT
30 public:
31     explicit BitcoinGUI(QWidget *parent = 0);
32     ~BitcoinGUI();
33
34     void setClientModel(ClientModel *clientModel);
35     void setWalletModel(WalletModel *walletModel);
36     
37     /* Transaction table tab indices */
38     enum {
39         AllTransactions = 0,
40         SentReceived = 1,
41         Sent = 2,
42         Received = 3
43     } TabIndex;
44
45 protected:
46     void changeEvent(QEvent *e);
47     void closeEvent(QCloseEvent *event);
48     void dragEnterEvent(QDragEnterEvent *event);
49     void dropEvent(QDropEvent *event);
50
51 private:
52     ClientModel *clientModel;
53     WalletModel *walletModel;
54
55     QStackedWidget *centralWidget;
56
57     OverviewPage *overviewPage;
58     QWidget *transactionsPage;
59     AddressBookPage *addressBookPage;
60     AddressBookPage *receiveCoinsPage;
61     SendCoinsDialog *sendCoinsPage;
62
63     QLabel *labelEncryptionIcon;
64     QLabel *labelConnectionsIcon;
65     QLabel *labelBlocksIcon;
66     QLabel *progressBarLabel;
67     QProgressBar *progressBar;
68
69     QMenuBar *appMenuBar;
70     QAction *overviewAction;
71     QAction *historyAction;
72     QAction *quitAction;
73     QAction *sendCoinsAction;
74     QAction *addressBookAction;
75     QAction *aboutAction;
76     QAction *receiveCoinsAction;
77     QAction *optionsAction;
78     QAction *openBitcoinAction;
79     QAction *exportAction;
80     QAction *encryptWalletAction;
81     QAction *changePassphraseAction;
82
83     QSystemTrayIcon *trayIcon;
84     Notificator *notificator;
85     TransactionView *transactionView;
86
87     QMovie *syncIconMovie;
88
89     void createActions();
90     void createMenuBar();
91     void createToolBars();
92     QWidget *createTabs();
93     void createTrayIcon();
94
95 public slots:
96     void setNumConnections(int count);
97     void setNumBlocks(int count);
98     void setEncryptionStatus(int status);
99
100     void error(const QString &title, const QString &message);
101     /* It is currently not possible to pass a return value to another thread through
102        BlockingQueuedConnection, so use an indirected pointer.
103        http://bugreports.qt.nokia.com/browse/QTBUG-10440
104     */
105     void askFee(qint64 nFeeRequired, bool *payFee);
106
107 private slots:
108     // UI pages
109     void gotoOverviewPage();
110     void gotoHistoryPage();
111     void gotoAddressBookPage();
112     void gotoReceiveCoinsPage();
113     void gotoSendCoinsPage();
114
115     // Misc actions
116     void optionsClicked();
117     void aboutClicked();
118 #ifndef Q_WS_MAC
119     void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
120 #endif
121     void incomingTransaction(const QModelIndex & parent, int start, int end);
122     void encryptWallet(bool status);
123     void changePassphrase();
124     void unlockWallet();
125 };
126
127 #endif