Fix Minimize to the tray instead of the taskbar
[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     QWidget *dummyWidget;
58
59     OverviewPage *overviewPage;
60     QWidget *transactionsPage;
61     AddressBookPage *addressBookPage;
62     AddressBookPage *receiveCoinsPage;
63     SendCoinsDialog *sendCoinsPage;
64
65     QLabel *labelEncryptionIcon;
66     QLabel *labelConnectionsIcon;
67     QLabel *labelBlocksIcon;
68     QLabel *progressBarLabel;
69     QProgressBar *progressBar;
70
71     QMenuBar *appMenuBar;
72     QAction *overviewAction;
73     QAction *historyAction;
74     QAction *quitAction;
75     QAction *sendCoinsAction;
76     QAction *addressBookAction;
77     QAction *aboutAction;
78     QAction *receiveCoinsAction;
79     QAction *optionsAction;
80     QAction *openBitcoinAction;
81     QAction *exportAction;
82     QAction *encryptWalletAction;
83     QAction *changePassphraseAction;
84     QAction *aboutQtAction;
85
86     QSystemTrayIcon *trayIcon;
87     Notificator *notificator;
88     TransactionView *transactionView;
89
90     QMovie *syncIconMovie;
91
92     void createActions();
93     void createMenuBar();
94     void createToolBars();
95     QWidget *createTabs();
96     void createTrayIcon();
97
98 public slots:
99     void setNumConnections(int count);
100     void setNumBlocks(int count);
101     void setEncryptionStatus(int status);
102     /** Set the status bar text if there are any warnings (removes sync progress bar if applicable) */
103     void refreshStatusBar();
104
105     void error(const QString &title, const QString &message);
106     /* It is currently not possible to pass a return value to another thread through
107        BlockingQueuedConnection, so use an indirected pointer.
108        http://bugreports.qt.nokia.com/browse/QTBUG-10440
109     */
110     void askFee(qint64 nFeeRequired, bool *payFee);
111
112     void showNormal();
113
114 private slots:
115     // UI pages
116     void gotoOverviewPage();
117     void gotoHistoryPage();
118     void gotoAddressBookPage();
119     void gotoReceiveCoinsPage();
120     void gotoSendCoinsPage();
121
122     // Misc actions
123     void optionsClicked();
124     void aboutClicked();
125 #ifndef Q_WS_MAC
126     void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
127 #endif
128     void incomingTransaction(const QModelIndex & parent, int start, int end);
129     void encryptWallet(bool status);
130     void changePassphrase();
131     void unlockWallet();
132 };
133
134 #endif