From a001f1880283089d3eb0aa83e889d9707d79fd5f Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Tue, 19 Jul 2016 15:49:50 +0200 Subject: [Qt] Always pass the numBlocksChanged signal for headers tip changed --- src/qt/clientmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qt/clientmodel.cpp') diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 14661b857..30f412dd2 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -234,7 +234,7 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, const CB int64_t& nLastUpdateNotification = fHeader ? nLastHeaderTipUpdateNotification : nLastBlockTipUpdateNotification; // if we are in-sync, update the UI regardless of last update time - if (!initialSync || now - nLastUpdateNotification > MODEL_UPDATE_DELAY) { + if (fHeader || !initialSync || now - nLastUpdateNotification > MODEL_UPDATE_DELAY) { //pass a async signal to the UI thread QMetaObject::invokeMethod(clientmodel, "numBlocksChanged", Qt::QueuedConnection, Q_ARG(int, pIndex->nHeight), -- cgit v1.2.3 From e47052f6b5ea901ecdc1cb8245dd98a98b06618a Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Tue, 19 Jul 2016 15:50:50 +0200 Subject: [Qt] ClientModel add method to get the height of the header chain --- src/qt/clientmodel.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/qt/clientmodel.cpp') diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 30f412dd2..e3240b95a 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -68,6 +68,14 @@ int ClientModel::getNumBlocks() const return chainActive.Height(); } +int ClientModel::getHeaderHeight() const +{ + LOCK(cs_main); + if (!pindexBestHeader) + return 0; + return pindexBestHeader->nHeight; +} + quint64 ClientModel::getTotalBytesRecv() const { return CNode::GetTotalBytesRecv(); -- cgit v1.2.3 From d8b062ef5eea3addff00a09bad1dab162452b4b5 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Tue, 13 Sep 2016 16:36:24 +0200 Subject: [Qt] only update "amount of blocks left" when the header chain is in-sync --- src/qt/clientmodel.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/qt/clientmodel.cpp') diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index e3240b95a..fb0cce59c 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -68,7 +68,7 @@ int ClientModel::getNumBlocks() const return chainActive.Height(); } -int ClientModel::getHeaderHeight() const +int ClientModel::getHeaderTipHeight() const { LOCK(cs_main); if (!pindexBestHeader) @@ -76,6 +76,14 @@ int ClientModel::getHeaderHeight() const return pindexBestHeader->nHeight; } +int64_t ClientModel::getHeaderTipTime() const +{ + LOCK(cs_main); + if (!pindexBestHeader) + return 0; + return pindexBestHeader->GetBlockTime(); +} + quint64 ClientModel::getTotalBytesRecv() const { return CNode::GetTotalBytesRecv(); -- cgit v1.2.3