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.
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 network (main, testnet3, regtest)
60 QString getNetworkName() const;
61 //! Return true if core is doing initial block download
62 bool inInitialBlockDownload() const;
63 //! Return true if core is importing blocks
64 enum BlockSource getBlockSource() const;
65 //! Return warnings to be displayed in status bar
66 QString getStatusBarWarnings() const;
68 QString formatFullVersion() const;
69 QString formatBuildDate() const;
70 bool isReleaseVersion() const;
71 QString clientName() const;
72 QString formatClientStartupTime() const;
75 OptionsModel *optionsModel;
76 PeerTableModel *peerTableModel;
79 bool cachedReindexing;
82 int numBlocksAtStartup;
86 void subscribeToCoreSignals();
87 void unsubscribeFromCoreSignals();
90 void numConnectionsChanged(int count);
91 void numBlocksChanged(int count);
92 void alertsChanged(const QString &warnings);
93 void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
95 //! Fired when a message should be reported to the user
96 void message(const QString &title, const QString &message, unsigned int style);
98 // Show progress dialog e.g. for verifychain
99 void showProgress(const QString &title, int nProgress);
103 void updateNumConnections(int numConnections);
104 void updateAlert(const QString &hash, int status);
107 #endif // CLIENTMODEL_H