qtui.h/noui.h interface cleanup
[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     //! Return warnings to be displayed in status bar
37     QString getStatusBarWarnings() const;
38
39     QString formatFullVersion() const;
40
41 private:
42     OptionsModel *optionsModel;
43
44     int cachedNumConnections;
45     int cachedNumBlocks;
46     QString cachedStatusBar;
47
48     int numBlocksAtStartup;
49
50 signals:
51     void numConnectionsChanged(int count);
52     void numBlocksChanged(int count);
53
54     //! Asynchronous error notification
55     void error(const QString &title, const QString &message, bool modal);
56
57 public slots:
58
59 private slots:
60     void update();
61 };
62
63 #endif // CLIENTMODEL_H