]> Git Repo - VerusCoin.git/blob - src/qt/clientmodel.h
Remove references to X11 licence
[VerusCoin.git] / src / qt / clientmodel.h
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.
4
5 #ifndef BITCOIN_QT_CLIENTMODEL_H
6 #define BITCOIN_QT_CLIENTMODEL_H
7
8 #include <QObject>
9
10 class AddressTableModel;
11 class OptionsModel;
12 class PeerTableModel;
13 class TransactionTableModel;
14
15 class CWallet;
16
17 QT_BEGIN_NAMESPACE
18 class QDateTime;
19 class QTimer;
20 QT_END_NAMESPACE
21
22 enum BlockSource {
23     BLOCK_SOURCE_NONE,
24     BLOCK_SOURCE_REINDEX,
25     BLOCK_SOURCE_DISK,
26     BLOCK_SOURCE_NETWORK
27 };
28
29 enum NumConnections {
30     CONNECTIONS_NONE = 0,
31     CONNECTIONS_IN   = (1U << 0),
32     CONNECTIONS_OUT  = (1U << 1),
33     CONNECTIONS_ALL  = (CONNECTIONS_IN | CONNECTIONS_OUT),
34 };
35
36 /** Model for Bitcoin network client. */
37 class ClientModel : public QObject
38 {
39     Q_OBJECT
40
41 public:
42     explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
43     ~ClientModel();
44
45     OptionsModel *getOptionsModel();
46     PeerTableModel *getPeerTableModel();
47
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();
52
53     quint64 getTotalBytesRecv() const;
54     quint64 getTotalBytesSent() const;
55
56     double getVerificationProgress() const;
57     QDateTime getLastBlockDate() const;
58
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;
65
66     QString formatFullVersion() const;
67     QString formatBuildDate() const;
68     bool isReleaseVersion() const;
69     QString clientName() const;
70     QString formatClientStartupTime() const;
71
72 private:
73     OptionsModel *optionsModel;
74     PeerTableModel *peerTableModel;
75
76     int cachedNumBlocks;
77     bool cachedReindexing;
78     bool cachedImporting;
79
80     int numBlocksAtStartup;
81
82     QTimer *pollTimer;
83
84     void subscribeToCoreSignals();
85     void unsubscribeFromCoreSignals();
86
87 signals:
88     void numConnectionsChanged(int count);
89     void numBlocksChanged(int count);
90     void alertsChanged(const QString &warnings);
91     void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
92
93     //! Fired when a message should be reported to the user
94     void message(const QString &title, const QString &message, unsigned int style);
95
96     // Show progress dialog e.g. for verifychain
97     void showProgress(const QString &title, int nProgress);
98
99 public slots:
100     void updateTimer();
101     void updateNumConnections(int numConnections);
102     void updateAlert(const QString &hash, int status);
103 };
104
105 #endif // BITCOIN_QT_CLIENTMODEL_H
This page took 0.027857 seconds and 4 git commands to generate.