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 warnings to be displayed in status bar
53 QString getStatusBarWarnings() const;
55 QString formatFullVersion() const;
56 QString formatBuildDate() const;
57 QString clientName() const;
58 QString formatClientStartupTime() const;
61 OptionsModel *optionsModel;
64 int cachedNumBlocksOfPeers;
66 int numBlocksAtStartup;
70 void subscribeToCoreSignals();
71 void unsubscribeFromCoreSignals();
73 void numConnectionsChanged(int count);
74 void numBlocksChanged(int count);
75 void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
77 //! Asynchronous error notification
78 void error(const QString &title, const QString &message, bool modal);
82 void updateNumConnections(int numConnections);
83 void updateAlert(const QString &hash, int status);
86 #endif // CLIENTMODEL_H