1 #include "clientmodel.h"
2 #include "guiconstants.h"
3 #include "optionsmodel.h"
4 #include "addresstablemodel.h"
5 #include "transactiontablemodel.h"
11 ClientModel::ClientModel(CWallet *wallet, QObject *parent) :
12 QObject(parent), wallet(wallet), optionsModel(0)
14 // Until signal notifications is built into the bitcoin core,
15 // simply update everything after polling using a timer.
16 QTimer *timer = new QTimer(this);
17 connect(timer, SIGNAL(timeout()), this, SLOT(update()));
18 timer->start(MODEL_UPDATE_DELAY);
20 optionsModel = new OptionsModel(wallet, this);
23 int ClientModel::getNumConnections() const
28 int ClientModel::getNumBlocks() const
33 void ClientModel::update()
35 // Plainly emit all signals for now. To be more efficient this should check
36 // whether the values actually changed first, although it'd be even better if these
37 // were events coming in from the bitcoin core.
38 emit numConnectionsChanged(getNumConnections());
39 emit numBlocksChanged(getNumBlocks());
42 bool ClientModel::isTestNet() const
47 bool ClientModel::inInitialBlockDownload() const
49 return IsInitialBlockDownload();
52 int ClientModel::getTotalBlocksEstimate() const
54 return GetTotalBlocksEstimate();
57 OptionsModel *ClientModel::getOptionsModel()
62 QString ClientModel::formatFullVersion() const
64 return QString::fromStdString(FormatFullVersion());