Display a "freshness" indicator instead of nr of blocks
[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 signals:
46     void numConnectionsChanged(int count);
47     void numBlocksChanged(int count);
48
49     // Asynchronous error notification
50     void error(const QString &title, const QString &message);
51
52 public slots:
53
54 private slots:
55     void update();
56 };
57
58 #endif // CLIENTMODEL_H