Full support for other units, add configuration option for default unit (used when...
[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(OptionsModel *optionsModel, 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     OptionsModel *optionsModel;
42
43     int cachedNumConnections;
44     int cachedNumBlocks;
45
46 signals:
47     void numConnectionsChanged(int count);
48     void numBlocksChanged(int count);
49
50     // Asynchronous error notification
51     void error(const QString &title, const QString &message);
52
53 public slots:
54
55 private slots:
56     void update();
57 };
58
59 #endif // CLIENTMODEL_H