From 00b13365fb187b67f61455984b4344835849590c Mon Sep 17 00:00:00 2001 From: James Coxon Date: Fri, 14 Apr 2017 10:02:19 +0100 Subject: [PATCH] Added block count to status bar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added block count to status bar when ‘Running’ and ‘Sync’ to allow easy visualisation of updates etc. --- rai/qt/qt.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/rai/qt/qt.cpp b/rai/qt/qt.cpp index d815a0a9..2f76efa3 100644 --- a/rai/qt/qt.cpp +++ b/rai/qt/qt.cpp @@ -628,6 +628,11 @@ std::string rai_qt::status::text () { assert (!active.empty ()); std::string result; + rai::transaction transaction (wallet.wallet_m->node.store.environment, nullptr, false); + auto size (wallet.wallet_m->node.store.block_count (transaction)); + auto unchecked (wallet.wallet_m->node.store.unchecked_count (transaction)); + auto count_string (std::to_string (size.sum ())); + switch (*active.begin ()) { case rai_qt::status_types::disconnected: @@ -637,7 +642,12 @@ std::string rai_qt::status::text () result = "Status: Generating proof of work"; break; case rai_qt::status_types::synchronizing: - result = "Status: Synchronizing"; + result = "Status: Synchronizing, Block: "; + if (unchecked != 0) + { + count_string += " (" + std::to_string (unchecked) + ")"; + } + result += count_string.c_str (); break; case rai_qt::status_types::locked: result = "Status: Wallet locked"; @@ -649,7 +659,12 @@ std::string rai_qt::status::text () result = "Status: Wallet active"; break; case rai_qt::status_types::nominal: - result = "Status: Running"; + result = "Status: Running, Block: "; + if (unchecked != 0) + { + count_string += " (" + std::to_string (unchecked) + ")"; + } + result += count_string.c_str (); break; default: assert (false);