|
|
@ -17,7 +17,9 @@ static const int64 nClientStartupTime = GetTime();
|
|
|
|
|
|
|
|
|
|
|
|
ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
|
|
|
|
ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
|
|
|
|
QObject(parent), optionsModel(optionsModel),
|
|
|
|
QObject(parent), optionsModel(optionsModel),
|
|
|
|
cachedNumBlocks(0), cachedNumBlocksOfPeers(0), numBlocksAtStartup(-1), pollTimer(0)
|
|
|
|
cachedNumBlocks(0), cachedNumBlocksOfPeers(0),
|
|
|
|
|
|
|
|
cachedReindexing(0), cachedImporting(0),
|
|
|
|
|
|
|
|
numBlocksAtStartup(-1), pollTimer(0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pollTimer = new QTimer(this);
|
|
|
|
pollTimer = new QTimer(this);
|
|
|
|
pollTimer->setInterval(MODEL_UPDATE_DELAY);
|
|
|
|
pollTimer->setInterval(MODEL_UPDATE_DELAY);
|
|
|
@ -70,10 +72,14 @@ void ClientModel::updateTimer()
|
|
|
|
int newNumBlocks = getNumBlocks();
|
|
|
|
int newNumBlocks = getNumBlocks();
|
|
|
|
int newNumBlocksOfPeers = getNumBlocksOfPeers();
|
|
|
|
int newNumBlocksOfPeers = getNumBlocksOfPeers();
|
|
|
|
|
|
|
|
|
|
|
|
if(cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers)
|
|
|
|
// check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state
|
|
|
|
|
|
|
|
if (cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers ||
|
|
|
|
|
|
|
|
cachedReindexing != fReindex || cachedImporting != fImporting)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cachedNumBlocks = newNumBlocks;
|
|
|
|
cachedNumBlocks = newNumBlocks;
|
|
|
|
cachedNumBlocksOfPeers = newNumBlocksOfPeers;
|
|
|
|
cachedNumBlocksOfPeers = newNumBlocksOfPeers;
|
|
|
|
|
|
|
|
cachedReindexing = fReindex;
|
|
|
|
|
|
|
|
cachedImporting = fImporting;
|
|
|
|
|
|
|
|
|
|
|
|
// ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI
|
|
|
|
// ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI
|
|
|
|
emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks));
|
|
|
|
emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks));
|
|
|
|