b4054b5d87bddb834499b1c5c2c252a33314e07d
[novacoin.git] / src / qt / clientmodel.h
1 #ifndef CLIENTMODEL_H
2 #define CLIENTMODEL_H
3
4 #include <QObject>
5
6 class OptionsModel;
7 class AddressTableModel;
8 class TransactionTableModel;
9 class CWallet;
10
11 QT_BEGIN_NAMESPACE
12 class QDateTime;
13 QT_END_NAMESPACE
14
15 /** Model for Bitcoin network client. */
16 class ClientModel : public QObject
17 {
18     Q_OBJECT
19 public:
20     explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
21
22     OptionsModel *getOptionsModel();
23
24     int getNumConnections() const;
25     int getNumBlocks() const;
26     int getNumBlocksAtStartup();
27
28     QDateTime getLastBlockDate() const;
29
30     //! Return true if client connected to testnet
31     bool isTestNet() const;
32     //! Return true if core is doing initial block download
33     bool inInitialBlockDownload() const;
34     //! Return conservative estimate of total number of blocks, or 0 if unknown
35     int getNumBlocksOfPeers() const;
36
37     QString formatFullVersion() const;
38
39 private:
40     OptionsModel *optionsModel;
41
42     int cachedNumConnections;
43     int cachedNumBlocks;
44
45     int numBlocksAtStartup;
46
47 signals:
48     void numConnectionsChanged(int count);
49     void numBlocksChanged(int count);
50
51     //! Asynchronous error notification
52     void error(const QString &title, const QString &message);
53
54 public slots:
55
56 private slots:
57     void update();
58 };
59
60 #endif // CLIENTMODEL_H