1 #include "clientmodel.h"
2 #include "guiconstants.h"
3 #include "optionsmodel.h"
4 #include "addresstablemodel.h"
5 #include "transactiontablemodel.h"
12 ClientModel::ClientModel(CWallet *wallet, QObject *parent) :
13 QObject(parent), wallet(wallet), optionsModel(0)
15 // Until signal notifications is built into the bitcoin core,
16 // simply update everything after polling using a timer.
17 QTimer *timer = new QTimer(this);
18 connect(timer, SIGNAL(timeout()), this, SLOT(update()));
19 timer->start(MODEL_UPDATE_DELAY);
21 optionsModel = new OptionsModel(wallet, this);
24 int ClientModel::getNumConnections() const
29 int ClientModel::getNumBlocks() const
34 QDateTime ClientModel::getLastBlockDate() const
36 return QDateTime::fromTime_t(pindexBest->GetBlockTime());
39 void ClientModel::update()
41 // Plainly emit all signals for now. To be more efficient this should check
42 // whether the values actually changed first, although it'd be even better if these
43 // were events coming in from the bitcoin core.
44 emit numConnectionsChanged(getNumConnections());
45 emit numBlocksChanged(getNumBlocks());
48 bool ClientModel::isTestNet() const
53 bool ClientModel::inInitialBlockDownload() const
55 return IsInitialBlockDownload();
58 int ClientModel::getTotalBlocksEstimate() const
60 return GetTotalBlocksEstimate();
63 OptionsModel *ClientModel::getOptionsModel()
68 QString ClientModel::formatFullVersion() const
70 return QString::fromStdString(FormatFullVersion());