1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
11 class AddressTableModel;
12 class TransactionTableModel;
27 /** Model for Bitcoin network client. */
28 class ClientModel : public QObject
33 explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
36 OptionsModel *getOptionsModel();
38 int getNumConnections() const;
39 int getNumBlocks() const;
40 int getNumBlocksAtStartup();
42 quint64 getTotalBytesRecv() const;
43 quint64 getTotalBytesSent() const;
45 double getVerificationProgress() 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 true if core is importing blocks
53 enum BlockSource getBlockSource() const;
54 //! Return conservative estimate of total number of blocks, or 0 if unknown
55 int getNumBlocksOfPeers() const;
56 //! Return warnings to be displayed in status bar
57 QString getStatusBarWarnings() const;
59 QString formatFullVersion() const;
60 QString formatBuildDate() const;
61 bool isReleaseVersion() const;
62 QString clientName() const;
63 QString formatClientStartupTime() const;
66 OptionsModel *optionsModel;
69 int cachedNumBlocksOfPeers;
70 bool cachedReindexing;
73 int numBlocksAtStartup;
77 void subscribeToCoreSignals();
78 void unsubscribeFromCoreSignals();
81 void numConnectionsChanged(int count);
82 void numBlocksChanged(int count, int countOfPeers);
83 void alertsChanged(const QString &warnings);
84 void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
86 //! Asynchronous message notification
87 void message(const QString &title, const QString &message, unsigned int style);
91 void updateNumConnections(int numConnections);
92 void updateAlert(const QString &hash, int status);
95 #endif // CLIENTMODEL_H