1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef BITCOIN_QT_CLIENTMODEL_H
6 #define BITCOIN_QT_CLIENTMODEL_H
10 class AddressTableModel;
13 class TransactionTableModel;
31 CONNECTIONS_IN = (1U << 0),
32 CONNECTIONS_OUT = (1U << 1),
33 CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT),
36 /** Model for Bitcoin network client. */
37 class ClientModel : public QObject
42 explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
45 OptionsModel *getOptionsModel();
46 PeerTableModel *getPeerTableModel();
48 //! Return number of connections, default is in- and outbound (total)
49 int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const;
50 int getNumBlocks() const;
51 int getNumBlocksAtStartup();
53 quint64 getTotalBytesRecv() const;
54 quint64 getTotalBytesSent() const;
56 double getVerificationProgress() const;
57 QDateTime getLastBlockDate() const;
59 //! Return true if core is doing initial block download
60 bool inInitialBlockDownload() const;
61 //! Return true if core is importing blocks
62 enum BlockSource getBlockSource() const;
63 //! Return warnings to be displayed in status bar
64 QString getStatusBarWarnings() const;
66 QString formatFullVersion() const;
67 QString formatBuildDate() const;
68 bool isReleaseVersion() const;
69 QString clientName() const;
70 QString formatClientStartupTime() const;
73 OptionsModel *optionsModel;
74 PeerTableModel *peerTableModel;
77 bool cachedReindexing;
80 int numBlocksAtStartup;
84 void subscribeToCoreSignals();
85 void unsubscribeFromCoreSignals();
88 void numConnectionsChanged(int count);
89 void numBlocksChanged(int count);
90 void alertsChanged(const QString &warnings);
91 void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
93 //! Fired when a message should be reported to the user
94 void message(const QString &title, const QString &message, unsigned int style);
96 // Show progress dialog e.g. for verifychain
97 void showProgress(const QString &title, int nProgress);
101 void updateNumConnections(int numConnections);
102 void updateAlert(const QString &hash, int status);
105 #endif // BITCOIN_QT_CLIENTMODEL_H