PRCYCoin  2.0.0.7rc1
P2P Digital Currency
clientmodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2014 The Bitcoin developers
2 // Copyright (c) 2014-2015 The Dash developers
3 // Copyright (c) 2015-2018 The PIVX developers
4 // Copyright (c) 2018-2020 The DAPS Project developers
5 // Distributed under the MIT/X11 software license, see the accompanying
6 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
7 
8 #ifndef BITCOIN_QT_CLIENTMODEL_H
9 #define BITCOIN_QT_CLIENTMODEL_H
10 
11 #include "uint256.h"
12 #include "chain.h"
13 #include <QObject>
14 #include <QDateTime>
15 
16 class AddressTableModel;
17 class BanTableModel;
18 class OptionsModel;
19 class PeerTableModel;
21 
22 class CWallet;
23 
24 QT_BEGIN_NAMESPACE
25 class QDateTime;
26 class QTimer;
27 QT_END_NAMESPACE
28 
34 };
35 
38  CONNECTIONS_IN = (1U << 0),
39  CONNECTIONS_OUT = (1U << 1),
41 };
42 
44 class ClientModel : public QObject
45 {
46  Q_OBJECT
47 
48 public:
49  explicit ClientModel(OptionsModel* optionsModel, QObject* parent = 0);
50  ~ClientModel();
51 
55 
57  int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const;
59  QString getMasternodeCountString() const;
60 
61  // from cached block index
62  int getNumBlocks();
63  QDateTime getLastBlockDate() const;
64  QString getLastBlockHash() const;
65  double getVerificationProgress() const;
66 
67  quint64 getTotalBytesRecv() const;
68  quint64 getTotalBytesSent() const;
69 
71  bool inInitialBlockDownload() const;
73  enum BlockSource getBlockSource() const;
75  QString getStatusBarWarnings() const;
76 
77  QString formatFullVersion() const;
78  bool isReleaseVersion() const;
79  QString clientName() const;
80  QString formatClientStartupTime() const;
81  QString dataDir() const;
82 
83  bool getTorInfo(std::string& ip_port) const;
84 
85  // Start/Stop the masternode polling timer
86  void startMasternodesTimer();
87  void stopMasternodesTimer();
88 
89  void setCacheTip(const CBlockIndex* const tip) { cacheTip = tip; }
90  void setCacheReindexing(bool reindex) { cachedReindexing = reindex; }
91  void setCacheImporting(bool import) { cachedImporting = import; }
92  void setCacheInitialSync(bool _initialSync) { cachedInitialSync = _initialSync; }
93 
94 private:
98 
99  const CBlockIndex* cacheTip{nullptr};
104 
106 
107  QTimer* pollTimer;
108  QTimer* pollMnTimer;
109 
110  void subscribeToCoreSignals();
112 
113 Q_SIGNALS:
114  void numConnectionsChanged(int count);
115  void numBlocksChanged(int count);
116  void strMasternodesChanged(const QString& strMasternodes);
117  void alertsChanged(const QString& warnings);
118  void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
119 
121  void message(const QString& title, const QString& message, unsigned int style);
122 
123  // Show progress dialog e.g. for verifychain
124  void showProgress(const QString& title, int nProgress);
125 
126 public Q_SLOTS:
127  void updateTimer();
128  void updateMnTimer();
129  void updateNumConnections(int numConnections);
130  void updateAlert();
131  void updateBanlist();
132 };
133 
134 #endif // BITCOIN_QT_CLIENTMODEL_H
ClientModel::alertsChanged
void alertsChanged(const QString &warnings)
ClientModel::startMasternodesTimer
void startMasternodesTimer()
Definition: clientmodel.cpp:151
ClientModel::subscribeToCoreSignals
void subscribeToCoreSignals()
Definition: clientmodel.cpp:292
ClientModel::cachedReindexing
bool cachedReindexing
Definition: clientmodel.h:101
CONNECTIONS_IN
@ CONNECTIONS_IN
Definition: clientmodel.h:38
ClientModel::getLastBlockHash
QString getLastBlockHash() const
Definition: clientmodel.cpp:115
ClientModel::numConnectionsChanged
void numConnectionsChanged(int count)
BLOCK_SOURCE_NONE
@ BLOCK_SOURCE_NONE
Definition: clientmodel.h:30
CONNECTIONS_OUT
@ CONNECTIONS_OUT
Definition: clientmodel.h:39
ClientModel::message
void message(const QString &title, const QString &message, unsigned int style)
Fired when a message should be reported to the user.
ClientModel::inInitialBlockDownload
bool inInitialBlockDownload() const
Return true if core is doing initial block download.
Definition: clientmodel.cpp:176
ClientModel::getNumConnections
int getNumConnections(unsigned int flags=CONNECTIONS_ALL) const
Return number of connections, default is in- and outbound (total)
Definition: clientmodel.cpp:61
ClientModel::isReleaseVersion
bool isReleaseVersion() const
Definition: clientmodel.cpp:218
ClientModel::numBlocksAtStartup
int numBlocksAtStartup
Definition: clientmodel.h:105
ClientModel::getTorInfo
bool getTorInfo(std::string &ip_port) const
Definition: clientmodel.cpp:312
AddressTableModel
Qt model of the address book in the core.
Definition: addresstablemodel.h:19
uint256.h
ClientModel::ClientModel
ClientModel(OptionsModel *optionsModel, QObject *parent=0)
Definition: clientmodel.cpp:35
ClientModel::getBlockSource
enum BlockSource getBlockSource() const
Return true if core is importing blocks.
Definition: clientmodel.cpp:181
flags
int flags
Definition: prcycoin-tx.cpp:297
ClientModel::updateTimer
void updateTimer()
Definition: clientmodel.cpp:126
CONNECTIONS_ALL
@ CONNECTIONS_ALL
Definition: clientmodel.h:40
ClientModel::setCacheImporting
void setCacheImporting(bool import)
Definition: clientmodel.h:91
CONNECTIONS_NONE
@ CONNECTIONS_NONE
Definition: clientmodel.h:37
ClientModel::cacheTip
const CBlockIndex * cacheTip
Definition: clientmodel.h:99
ClientModel::getStatusBarWarnings
QString getStatusBarWarnings() const
Return warnings to be displayed in status bar.
Definition: clientmodel.cpp:193
BanTableModel
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call.
Definition: bantablemodel.h:39
ClientModel::banTableModel
BanTableModel * banTableModel
Definition: clientmodel.h:97
ClientModel::updateMnTimer
void updateMnTimer()
Definition: clientmodel.cpp:134
ClientModel::getNumBlocksAtStartup
int getNumBlocksAtStartup()
Definition: clientmodel.cpp:93
OptionsModel
Interface from Qt to configuration data structure for Bitcoin client.
Definition: optionsmodel.h:18
ClientModel::getOptionsModel
OptionsModel * getOptionsModel()
Definition: clientmodel.cpp:198
ClientModel::unsubscribeFromCoreSignals
void unsubscribeFromCoreSignals()
Definition: clientmodel.cpp:302
ClientModel::cachedInitialSync
bool cachedInitialSync
Definition: clientmodel.h:103
BLOCK_SOURCE_NETWORK
@ BLOCK_SOURCE_NETWORK
Definition: clientmodel.h:33
ClientModel::cachedMasternodeCountString
QString cachedMasternodeCountString
Definition: clientmodel.h:100
ClientModel::getPeerTableModel
PeerTableModel * getPeerTableModel()
Definition: clientmodel.cpp:203
ClientModel::getMasternodeCountString
QString getMasternodeCountString() const
Definition: clientmodel.cpp:75
ClientModel::setCacheReindexing
void setCacheReindexing(bool reindex)
Definition: clientmodel.h:90
ClientModel::bytesChanged
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut)
ClientModel::setCacheTip
void setCacheTip(const CBlockIndex *const tip)
Definition: clientmodel.h:89
ClientModel::pollMnTimer
QTimer * pollMnTimer
Definition: clientmodel.h:108
ClientModel::pollTimer
QTimer * pollTimer
Definition: clientmodel.h:107
ClientModel::clientName
QString clientName() const
Definition: clientmodel.cpp:223
ClientModel::formatFullVersion
QString formatFullVersion() const
Definition: clientmodel.cpp:213
ClientModel::peerTableModel
PeerTableModel * peerTableModel
Definition: clientmodel.h:96
ClientModel::optionsModel
OptionsModel * optionsModel
Definition: clientmodel.h:95
PeerTableModel
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call.
Definition: peertablemodel.h:42
ClientModel::updateNumConnections
void updateNumConnections(int numConnections)
Definition: clientmodel.cpp:166
ClientModel::getTotalBytesSent
quint64 getTotalBytesSent() const
Definition: clientmodel.cpp:104
chain.h
ClientModel::getVerificationProgress
double getVerificationProgress() const
Definition: clientmodel.cpp:121
ClientModel::showProgress
void showProgress(const QString &title, int nProgress)
ClientModel::updateBanlist
void updateBanlist()
Definition: clientmodel.cpp:238
BLOCK_SOURCE_REINDEX
@ BLOCK_SOURCE_REINDEX
Definition: clientmodel.h:31
ClientModel
Model for PRCY network client.
Definition: clientmodel.h:44
TransactionTableModel
UI model for the transaction table of a wallet.
Definition: transactiontablemodel.h:21
ClientModel::setCacheInitialSync
void setCacheInitialSync(bool _initialSync)
Definition: clientmodel.h:92
ClientModel::getNumBlocks
int getNumBlocks()
Definition: clientmodel.cpp:84
CWallet
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
Definition: wallet.h:243
NumConnections
NumConnections
Definition: clientmodel.h:36
ClientModel::formatClientStartupTime
QString formatClientStartupTime() const
Definition: clientmodel.cpp:228
ClientModel::~ClientModel
~ClientModel()
Definition: clientmodel.cpp:56
ClientModel::dataDir
QString dataDir() const
Definition: clientmodel.cpp:233
BLOCK_SOURCE_DISK
@ BLOCK_SOURCE_DISK
Definition: clientmodel.h:32
ClientModel::strMasternodesChanged
void strMasternodesChanged(const QString &strMasternodes)
BlockSource
BlockSource
Definition: clientmodel.h:29
ClientModel::numBlocksChanged
void numBlocksChanged(int count)
CBlockIndex
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: chain.h:162
ClientModel::getLastBlockDate
QDateTime getLastBlockDate() const
Definition: clientmodel.cpp:109
ClientModel::stopMasternodesTimer
void stopMasternodesTimer()
Definition: clientmodel.cpp:159
ClientModel::getTotalBytesRecv
quint64 getTotalBytesRecv() const
Definition: clientmodel.cpp:99
ClientModel::updateAlert
void updateAlert()
Definition: clientmodel.cpp:171
ClientModel::cachedImporting
bool cachedImporting
Definition: clientmodel.h:102
ClientModel::getBanTableModel
BanTableModel * getBanTableModel()
Definition: clientmodel.cpp:208