aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2013-04-09 10:59:29 -0700
committerGavin Andresen <gavinandresen@gmail.com>2013-04-09 10:59:29 -0700
commitc553fe8d43e2011a1555cdf41c769ccf31b4d6a9 (patch)
tree65c9fc59e3b94aae4920745be6ff60e85226331d /src
parent54c0b3eac7e617fb5edc322aaca166f3b4ef9288 (diff)
parent87dd6035e583d45d6c2e464867425ee1a9cad8e9 (diff)
downloadbitcoin-c553fe8d43e2011a1555cdf41c769ccf31b4d6a9.tar.xz
Merge pull request #2469 from Diapolo/clientmodel-progress
Bitcoin-Qt: emit numBlocksChanged for changed reindex or importing state
Diffstat (limited to 'src')
-rw-r--r--src/qt/clientmodel.cpp10
-rw-r--r--src/qt/clientmodel.h2
2 files changed, 10 insertions, 2 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 863176aa1b..c17c602b50 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -17,7 +17,9 @@ static const int64 nClientStartupTime = GetTime();
ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
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->setInterval(MODEL_UPDATE_DELAY);
@@ -70,10 +72,14 @@ void ClientModel::updateTimer()
int newNumBlocks = getNumBlocks();
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;
cachedNumBlocksOfPeers = newNumBlocksOfPeers;
+ cachedReindexing = fReindex;
+ cachedImporting = fImporting;
// ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI
emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks));
diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h
index 3ba34b2786..904bff1886 100644
--- a/src/qt/clientmodel.h
+++ b/src/qt/clientmodel.h
@@ -60,6 +60,8 @@ private:
int cachedNumBlocks;
int cachedNumBlocksOfPeers;
+ bool cachedReindexing;
+ bool cachedImporting;
int numBlocksAtStartup;