Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Slots | Signals | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ClientModel Class Reference

Model for Bitcoin network client. More...

#include <clientmodel.h>

+ Inheritance diagram for ClientModel:
+ Collaboration diagram for ClientModel:

Public Slots

void updateTimer ()
 
void updateNumConnections (int numConnections)
 
void updateAlert (const QString &hash, int status)
 

Signals

void numConnectionsChanged (int count)
 
void numBlocksChanged (int count)
 
void alertsChanged (const QString &warnings)
 
void bytesChanged (quint64 totalBytesIn, quint64 totalBytesOut)
 
void message (const QString &title, const QString &message, unsigned int style)
 Fired when a message should be reported to the user. More...
 

Public Member Functions

 ClientModel (OptionsModel *optionsModel, QObject *parent=0)
 
 ~ClientModel ()
 
OptionsModelgetOptionsModel ()
 
int getNumConnections (unsigned int flags=CONNECTIONS_ALL) const
 Return number of connections, default is in- and outbound (total) More...
 
int getNumBlocks () const
 
int getNumBlocksAtStartup ()
 
quint64 getTotalBytesRecv () const
 
quint64 getTotalBytesSent () const
 
double getVerificationProgress () const
 
QDateTime getLastBlockDate () const
 
QString getNetworkName () const
 Return network (main, testnet3, regtest) More...
 
bool inInitialBlockDownload () const
 Return true if core is doing initial block download. More...
 
enum BlockSource getBlockSource () const
 Return true if core is importing blocks. More...
 
QString getStatusBarWarnings () const
 Return warnings to be displayed in status bar. More...
 
QString formatFullVersion () const
 
QString formatBuildDate () const
 
bool isReleaseVersion () const
 
QString clientName () const
 
QString formatClientStartupTime () const
 

Private Member Functions

void subscribeToCoreSignals ()
 
void unsubscribeFromCoreSignals ()
 

Private Attributes

OptionsModeloptionsModel
 
int cachedNumBlocks
 
bool cachedReindexing
 
bool cachedImporting
 
int numBlocksAtStartup
 
QTimer * pollTimer
 

Detailed Description

Model for Bitcoin network client.

Definition at line 36 of file clientmodel.h.

Constructor & Destructor Documentation

ClientModel::ClientModel ( OptionsModel optionsModel,
QObject parent = 0 
)
explicit

Definition at line 24 of file clientmodel.cpp.

References MODEL_UPDATE_DELAY, pollTimer, subscribeToCoreSignals(), and updateTimer().

+ Here is the call graph for this function:

ClientModel::~ClientModel ( )

Definition at line 37 of file clientmodel.cpp.

References unsubscribeFromCoreSignals().

+ Here is the call graph for this function:

Member Function Documentation

void ClientModel::alertsChanged ( const QString &  warnings)
signal

Definition at line 131 of file moc_clientmodel.cpp.

Referenced by updateAlert().

+ Here is the caller graph for this function:

void ClientModel::bytesChanged ( quint64  totalBytesIn,
quint64  totalBytesOut 
)
signal

Definition at line 138 of file moc_clientmodel.cpp.

Referenced by updateTimer().

+ Here is the caller graph for this function:

QString ClientModel::clientName ( ) const

Definition at line 191 of file clientmodel.cpp.

References CLIENT_NAME.

Referenced by RPCConsole::setClientModel().

+ Here is the caller graph for this function:

QString ClientModel::formatBuildDate ( ) const

Definition at line 181 of file clientmodel.cpp.

References CLIENT_DATE.

Referenced by RPCConsole::setClientModel().

+ Here is the caller graph for this function:

QString ClientModel::formatClientStartupTime ( ) const

Definition at line 196 of file clientmodel.cpp.

References nClientStartupTime.

Referenced by RPCConsole::setClientModel().

+ Here is the caller graph for this function:

QString ClientModel::formatFullVersion ( ) const

Definition at line 176 of file clientmodel.cpp.

References FormatFullVersion().

Referenced by RPCConsole::setClientModel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

enum BlockSource ClientModel::getBlockSource ( ) const

Return true if core is importing blocks.

Definition at line 154 of file clientmodel.cpp.

References BLOCK_SOURCE_DISK, BLOCK_SOURCE_NETWORK, BLOCK_SOURCE_NONE, BLOCK_SOURCE_REINDEX, fImporting, fReindex, and getNumConnections().

Referenced by BitcoinGUI::setNumBlocks().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QDateTime ClientModel::getLastBlockDate ( ) const

Definition at line 78 of file clientmodel.cpp.

References chainActive, cs_main, CBlockIndex::GetBlockTime(), LOCK, Params(), and CChain::Tip().

Referenced by RPCConsole::setNumBlocks(), and BitcoinGUI::setNumBlocks().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QString ClientModel::getNetworkName ( ) const

Return network (main, testnet3, regtest)

Definition at line 141 of file clientmodel.cpp.

References Params().

Referenced by RPCConsole::setClientModel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ClientModel::getNumBlocks ( ) const

Definition at line 56 of file clientmodel.cpp.

References chainActive, cs_main, CChain::Height(), and LOCK.

Referenced by getNumBlocksAtStartup(), RPCConsole::setClientModel(), BitcoinGUI::setClientModel(), and updateTimer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ClientModel::getNumBlocksAtStartup ( )

Definition at line 62 of file clientmodel.cpp.

References getNumBlocks(), and numBlocksAtStartup.

+ Here is the call graph for this function:

int ClientModel::getNumConnections ( unsigned int  flags = CONNECTIONS_ALL) const

Return number of connections, default is in- and outbound (total)

Definition at line 42 of file clientmodel.cpp.

References CONNECTIONS_ALL, CONNECTIONS_IN, CONNECTIONS_OUT, cs_vNodes, CNode::fInbound, LOCK, and vNodes.

Referenced by getBlockSource(), RPCConsole::setClientModel(), BitcoinGUI::setClientModel(), and RPCConsole::setNumConnections().

+ Here is the caller graph for this function:

OptionsModel * ClientModel::getOptionsModel ( )

Definition at line 171 of file clientmodel.cpp.

References optionsModel.

Referenced by BitcoinGUI::changeEvent(), BitcoinGUI::closeEvent(), and BitcoinGUI::optionsClicked().

+ Here is the caller graph for this function:

QString ClientModel::getStatusBarWarnings ( ) const

Return warnings to be displayed in status bar.

Definition at line 166 of file clientmodel.cpp.

References GetWarnings().

Referenced by OverviewPage::setClientModel(), and updateAlert().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

quint64 ClientModel::getTotalBytesRecv ( ) const

Definition at line 68 of file clientmodel.cpp.

References CNode::GetTotalBytesRecv().

Referenced by TrafficGraphWidget::clear(), TrafficGraphWidget::setClientModel(), RPCConsole::setClientModel(), TrafficGraphWidget::updateRates(), and updateTimer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

quint64 ClientModel::getTotalBytesSent ( ) const

Definition at line 73 of file clientmodel.cpp.

References CNode::GetTotalBytesSent().

Referenced by TrafficGraphWidget::clear(), TrafficGraphWidget::setClientModel(), RPCConsole::setClientModel(), TrafficGraphWidget::updateRates(), and updateTimer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double ClientModel::getVerificationProgress ( ) const

Definition at line 87 of file clientmodel.cpp.

References chainActive, cs_main, Checkpoints::GuessVerificationProgress(), LOCK, and CChain::Tip().

Referenced by BitcoinGUI::setNumBlocks().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ClientModel::inInitialBlockDownload ( ) const

Return true if core is doing initial block download.

Definition at line 149 of file clientmodel.cpp.

References IsInitialBlockDownload().

Referenced by WalletView::processNewTransaction().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ClientModel::isReleaseVersion ( ) const

Definition at line 186 of file clientmodel.cpp.

References CLIENT_VERSION_IS_RELEASE.

void ClientModel::message ( const QString &  title,
const QString &  message,
unsigned int  style 
)
signal

Fired when a message should be reported to the user.

Definition at line 145 of file moc_clientmodel.cpp.

Referenced by updateAlert().

+ Here is the caller graph for this function:

void ClientModel::numBlocksChanged ( int  count)
signal

Definition at line 124 of file moc_clientmodel.cpp.

Referenced by updateTimer().

+ Here is the caller graph for this function:

void ClientModel::numConnectionsChanged ( int  count)
signal

Definition at line 117 of file moc_clientmodel.cpp.

Referenced by updateNumConnections().

+ Here is the caller graph for this function:

void ClientModel::subscribeToCoreSignals ( )
private

Definition at line 223 of file clientmodel.cpp.

References CClientUIInterface::NotifyAlertChanged, NotifyAlertChanged(), CClientUIInterface::NotifyBlocksChanged, NotifyBlocksChanged(), CClientUIInterface::NotifyNumConnectionsChanged, NotifyNumConnectionsChanged(), and uiInterface.

Referenced by ClientModel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ClientModel::unsubscribeFromCoreSignals ( )
private

Definition at line 231 of file clientmodel.cpp.

References CClientUIInterface::NotifyAlertChanged, NotifyAlertChanged(), CClientUIInterface::NotifyBlocksChanged, NotifyBlocksChanged(), CClientUIInterface::NotifyNumConnectionsChanged, NotifyNumConnectionsChanged(), and uiInterface.

Referenced by ~ClientModel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ClientModel::updateAlert ( const QString &  hash,
int  status 
)
slot

Definition at line 124 of file clientmodel.cpp.

References alertsChanged(), CT_NEW, CAlert::getAlertByHash(), getStatusBarWarnings(), CClientUIInterface::ICON_ERROR, CAlert::IsNull(), message(), base_uint< BITS >::SetHex(), and CUnsignedAlert::strStatusBar.

+ Here is the call graph for this function:

void ClientModel::updateNumConnections ( int  numConnections)
slot

Definition at line 119 of file clientmodel.cpp.

References numConnectionsChanged().

void ClientModel::updateTimer ( )
slot

Definition at line 93 of file clientmodel.cpp.

References bytesChanged(), cachedImporting, cachedNumBlocks, cachedReindexing, cs_main, fImporting, fReindex, getNumBlocks(), getTotalBytesRecv(), getTotalBytesSent(), numBlocksChanged(), and TRY_LOCK.

Referenced by ClientModel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

bool ClientModel::cachedImporting
private

Definition at line 77 of file clientmodel.h.

Referenced by updateTimer().

int ClientModel::cachedNumBlocks
private

Definition at line 75 of file clientmodel.h.

Referenced by updateTimer().

bool ClientModel::cachedReindexing
private

Definition at line 76 of file clientmodel.h.

Referenced by updateTimer().

int ClientModel::numBlocksAtStartup
private

Definition at line 79 of file clientmodel.h.

Referenced by getNumBlocksAtStartup().

OptionsModel* ClientModel::optionsModel
private

Definition at line 73 of file clientmodel.h.

Referenced by getOptionsModel().

QTimer* ClientModel::pollTimer
private

Definition at line 81 of file clientmodel.h.

Referenced by ClientModel().


The documentation for this class was generated from the following files: