]> Git Repo - VerusCoin.git/blob - src/qt/clientmodel.h
Merge pull request #3197 from laanwj/2013_11_qt_license
[VerusCoin.git] / src / qt / clientmodel.h
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.
4
5 #ifndef CLIENTMODEL_H
6 #define CLIENTMODEL_H
7
8 #include <QObject>
9
10 class OptionsModel;
11 class AddressTableModel;
12 class TransactionTableModel;
13 class CWallet;
14
15 QT_BEGIN_NAMESPACE
16 class QDateTime;
17 class QTimer;
18 QT_END_NAMESPACE
19
20 enum BlockSource {
21     BLOCK_SOURCE_NONE,
22     BLOCK_SOURCE_REINDEX,
23     BLOCK_SOURCE_DISK,
24     BLOCK_SOURCE_NETWORK
25 };
26
27 /** Model for Bitcoin network client. */
28 class ClientModel : public QObject
29 {
30     Q_OBJECT
31
32 public:
33     explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
34     ~ClientModel();
35
36     OptionsModel *getOptionsModel();
37
38     int getNumConnections() const;
39     int getNumBlocks() const;
40     int getNumBlocksAtStartup();
41
42     quint64 getTotalBytesRecv() const;
43     quint64 getTotalBytesSent() const;
44
45     double getVerificationProgress() const;
46     QDateTime getLastBlockDate() const;
47
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;
58
59     QString formatFullVersion() const;
60     QString formatBuildDate() const;
61     bool isReleaseVersion() const;
62     QString clientName() const;
63     QString formatClientStartupTime() const;
64
65 private:
66     OptionsModel *optionsModel;
67
68     int cachedNumBlocks;
69     int cachedNumBlocksOfPeers;
70     bool cachedReindexing;
71     bool cachedImporting;
72
73     int numBlocksAtStartup;
74
75     QTimer *pollTimer;
76
77     void subscribeToCoreSignals();
78     void unsubscribeFromCoreSignals();
79
80 signals:
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);
85
86     //! Asynchronous message notification
87     void message(const QString &title, const QString &message, unsigned int style);
88
89 public slots:
90     void updateTimer();
91     void updateNumConnections(int numConnections);
92     void updateAlert(const QString &hash, int status);
93 };
94
95 #endif // CLIENTMODEL_H
This page took 0.029248 seconds and 4 git commands to generate.