Remove 'estimated total blocks' field from gui
[novacoin.git] / src / qt / clientmodel.h
1 #ifndef CLIENTMODEL_H
2 #define CLIENTMODEL_H
3
4 #include <QObject>
5
6 #include <stdint.h>
7
8 class OptionsModel;
9 class AddressTableModel;
10 class TransactionTableModel;
11 class CWallet;
12
13 QT_BEGIN_NAMESPACE
14 class QDateTime;
15 class QTimer;
16 QT_END_NAMESPACE
17
18 enum NumConnections {
19     CONNECTIONS_NONE = 0,
20     CONNECTIONS_IN = (1U << 0),
21     CONNECTIONS_OUT = (1U << 1),
22     CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT),
23 };
24
25 /** Model for Bitcoin network client. */
26 class ClientModel : public QObject
27 {
28     Q_OBJECT
29 public:
30     explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
31     ~ClientModel();
32
33     OptionsModel *getOptionsModel();
34
35     double getPoSKernelPS();
36     double getDifficulty(bool fProofofStake);
37
38     //! Return number of connections, default is in- and outbound (total)
39     int getNumConnections(uint8_t flags = CONNECTIONS_ALL) const;
40     int getNumBlocks() const;
41     int getNumBlocksAtStartup();
42
43     quint64 getTotalBytesRecv() const;
44     quint64 getTotalBytesSent() const;
45
46     QDateTime getLastBlockDate() const;
47
48     //! Return true if client connected to testnet
49     bool isTestNet() const;
50     //! Return true if core is doing initial block download
51     bool inInitialBlockDownload() const;
52     //! Return warnings to be displayed in status bar
53     QString getStatusBarWarnings() const;
54
55     QString formatFullVersion() const;
56     QString formatBuildDate() const;
57     QString clientName() const;
58     QString formatClientStartupTime() const;
59
60 private:
61     OptionsModel *optionsModel;
62
63     int cachedNumBlocks;
64     int cachedNumBlocksOfPeers;
65
66     int numBlocksAtStartup;
67
68     QTimer *pollTimer;
69
70     void subscribeToCoreSignals();
71     void unsubscribeFromCoreSignals();
72 signals:
73     void numConnectionsChanged(int count);
74     void numBlocksChanged(int count);
75     void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
76
77     //! Asynchronous error notification
78     void error(const QString &title, const QString &message, bool modal);
79
80 public slots:
81     void updateTimer();
82     void updateNumConnections(int numConnections);
83     void updateAlert(const QString &hash, int status);
84 };
85
86 #endif // CLIENTMODEL_H