9 class AddressTableModel;
10 class TransactionTableModel;
20 CONNECTIONS_IN = (1U << 0),
21 CONNECTIONS_OUT = (1U << 1),
22 CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT),
25 /** Model for Bitcoin network client. */
26 class ClientModel : public QObject
30 explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
33 OptionsModel *getOptionsModel();
35 double getPoSKernelPS();
36 double getDifficulty(bool fProofofStake);
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();
43 quint64 getTotalBytesRecv() const;
44 quint64 getTotalBytesSent() const;
46 QDateTime getLastBlockDate() const;
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 conservative estimate of total number of blocks, or 0 if unknown
53 int getNumBlocksOfPeers() const;
54 //! Return warnings to be displayed in status bar
55 QString getStatusBarWarnings() const;
57 QString formatFullVersion() const;
58 QString formatBuildDate() const;
59 QString clientName() const;
60 QString formatClientStartupTime() const;
63 OptionsModel *optionsModel;
66 int cachedNumBlocksOfPeers;
68 int numBlocksAtStartup;
72 void subscribeToCoreSignals();
73 void unsubscribeFromCoreSignals();
75 void numConnectionsChanged(int count);
76 void numBlocksChanged(int count, int countOfPeers);
77 void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
79 //! Asynchronous error notification
80 void error(const QString &title, const QString &message, bool modal);
84 void updateNumConnections(int numConnections);
85 void updateAlert(const QString &hash, int status);
88 #endif // CLIENTMODEL_H