diff options
| author | Jonas Schnelli <[email protected]> | 2016-09-23 18:22:45 +0200 |
|---|---|---|
| committer | Jonas Schnelli <[email protected]> | 2016-09-23 18:22:48 +0200 |
| commit | 24f72e9f3fd0ce64b944c2a474786f06ed5fa0fd (patch) | |
| tree | 234c1cda2d3fc459ba65d6e523b01c68e81586f6 /src/qt/clientmodel.cpp | |
| parent | Merge #8661: Do not set an addr time penalty when a peer advertises itself. (diff) | |
| parent | [Qt] modalinfolayer: removed unused comments, renamed signal, code style over... (diff) | |
| download | discoin-24f72e9f3fd0ce64b944c2a474786f06ed5fa0fd.tar.xz discoin-24f72e9f3fd0ce64b944c2a474786f06ed5fa0fd.zip | |
Merge #8371: [Qt] Add out-of-sync modal info layer
08827df [Qt] modalinfolayer: removed unused comments, renamed signal, code style overhaul (Jonas Schnelli)
d8b062e [Qt] only update "amount of blocks left" when the header chain is in-sync (Jonas Schnelli)
e3245b4 [Qt] add out-of-sync modal info layer (Jonas Schnelli)
e47052f [Qt] ClientModel add method to get the height of the header chain (Jonas Schnelli)
a001f18 [Qt] Always pass the numBlocksChanged signal for headers tip changed (Jonas Schnelli)
bd44a04 [Qt] make Out-Of-Sync warning icon clickable (Jonas Schnelli)
0904c3c [Refactor] refactor function that forms human readable text out of a timeoffset (Jonas Schnelli)
Diffstat (limited to 'src/qt/clientmodel.cpp')
| -rw-r--r-- | src/qt/clientmodel.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 62a70bacd..6d19b3d12 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -70,6 +70,22 @@ int ClientModel::getNumBlocks() const return chainActive.Height(); } +int ClientModel::getHeaderTipHeight() const +{ + LOCK(cs_main); + if (!pindexBestHeader) + return 0; + return pindexBestHeader->nHeight; +} + +int64_t ClientModel::getHeaderTipTime() const +{ + LOCK(cs_main); + if (!pindexBestHeader) + return 0; + return pindexBestHeader->GetBlockTime(); +} + quint64 ClientModel::getTotalBytesRecv() const { if(!g_connman) @@ -240,7 +256,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), |