make initial block download reporting somewhat better by tracking version responses
[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 // Interface to Bitcoin network client
16 class ClientModel : public QObject
17 {
18     Q_OBJECT
19 public:
20     // The only reason that this constructor takes a wallet is because
21     // the global client settings are stored in the main wallet.
22     explicit ClientModel(CWallet *wallet, QObject *parent = 0);
23
24     OptionsModel *getOptionsModel();
25
26     int getNumConnections() const;
27     int getNumBlocks() const;
28
29     QDateTime getLastBlockDate() const;
30
31     // Return true if client connected to testnet
32     bool isTestNet() const;
33     // Return true if core is doing initial block download
34     bool inInitialBlockDownload() const;
35     // Return conservative estimate of total number of blocks, or 0 if unknown
36     int getTotalBlocksEstimate() const;
37
38     QString formatFullVersion() const;
39
40 private:
41     CWallet *wallet;
42
43     OptionsModel *optionsModel;
44
45     int cachedNumConnections;
46     int cachedNumBlocks;
47
48 signals:
49     void numConnectionsChanged(int count);
50     void numBlocksChanged(int count);
51
52     // Asynchronous error notification
53     void error(const QString &title, const QString &message);
54
55 public slots:
56
57 private slots:
58     void update();
59 };
60
61 #endif // CLIENTMODEL_H