From 00b13365fb187b67f61455984b4344835849590c Mon Sep 17 00:00:00 2001 From: James Coxon Date: Fri, 14 Apr 2017 10:02:19 +0100 Subject: [PATCH 1/3] 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); From 9868031a9c242a8e4e3012c90bfe1965141283b2 Mon Sep 17 00:00:00 2001 From: James Coxon Date: Sat, 15 Apr 2017 07:34:52 +0100 Subject: [PATCH 2/3] Displays block count for all states, simplified code Due to the frequency of refreshing can appear out of sync with the block count display in Advanced (when catching up) - minor issue --- rai/qt/qt.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/rai/qt/qt.cpp b/rai/qt/qt.cpp index 2f76efa3..d9f23821 100644 --- a/rai/qt/qt.cpp +++ b/rai/qt/qt.cpp @@ -642,12 +642,7 @@ std::string rai_qt::status::text () result = "Status: Generating proof of work"; break; case rai_qt::status_types::synchronizing: - result = "Status: Synchronizing, Block: "; - if (unchecked != 0) - { - count_string += " (" + std::to_string (unchecked) + ")"; - } - result += count_string.c_str (); + result = "Status: Synchronizing"; break; case rai_qt::status_types::locked: result = "Status: Wallet locked"; @@ -659,17 +654,20 @@ std::string rai_qt::status::text () result = "Status: Wallet active"; break; case rai_qt::status_types::nominal: - result = "Status: Running, Block: "; - if (unchecked != 0) - { - count_string += " (" + std::to_string (unchecked) + ")"; - } - result += count_string.c_str (); + result = "Status: Running"; break; default: assert (false); break; } + + result += ", Block: "; + if (unchecked != 0) + { + count_string += " (" + std::to_string (unchecked) + ")"; + } + result += count_string.c_str (); + return result; } From db58c8fcbc9e466b964874ca92fc987d368f7dee Mon Sep 17 00:00:00 2001 From: James Coxon Date: Sat, 15 Apr 2017 08:01:24 +0100 Subject: [PATCH 3/3] Added tooltip to help interpretation of status bar --- rai/qt/qt.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/rai/qt/qt.cpp b/rai/qt/qt.cpp index d9f23821..42401a82 100644 --- a/rai/qt/qt.cpp +++ b/rai/qt/qt.cpp @@ -622,6 +622,7 @@ void rai_qt::status::set_text () { wallet.status->setText (text ().c_str ()); wallet.status->setStyleSheet ((std::string ("QLabel {") + color () + "}").c_str ()); + wallet.status->setToolTip("Wallet status and wallet block count (blocks remaining to sync)"); } std::string rai_qt::status::text ()