From d934e689671ab18a49bcf2a0e747d4b3e89e17d1 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sun, 4 Sep 2016 15:01:01 +1200 Subject: [PATCH] Fit metrics screen into an 80-column terminal without wrapping --- src/metrics.cpp | 18 ++++++++--------- src/metrics.h | 52 +++++++++++++++++++++---------------------------- 2 files changed, 31 insertions(+), 39 deletions(-) diff --git a/src/metrics.cpp b/src/metrics.cpp index b835ddfae..60ae8dae0 100644 --- a/src/metrics.cpp +++ b/src/metrics.cpp @@ -107,8 +107,8 @@ void ThreadShowMetricsScreen() std::cout << std::endl; // Thank you text - std::cout << OFFSET << "Thank you for running a Zcash node!" << std::endl; - std::cout << OFFSET << "By running this node, you're contributing to the social good :)" << std::endl; + std::cout << "Thank you for running a Zcash node!" << std::endl; + std::cout << "By running this node, you're contributing to the social good :)" << std::endl; std::cout << std::endl; // Miner status @@ -122,10 +122,10 @@ void ThreadShowMetricsScreen() else nThreads = boost::thread::hardware_concurrency(); } - std::cout << OFFSET << "You are running " << nThreads << " mining threads." << std::endl; + std::cout << "You are running " << nThreads << " mining threads." << std::endl; } else { - std::cout << OFFSET << "You are currently not mining." << std::endl; - std::cout << OFFSET << "To enable mining, add 'gen=1' to your zcash.conf and restart." << std::endl; + std::cout << "You are currently not mining." << std::endl; + std::cout << "To enable mining, add 'gen=1' to your zcash.conf and restart." << std::endl; } std::cout << std::endl; @@ -147,7 +147,7 @@ void ThreadShowMetricsScreen() int seconds = uptime - (((((days * 24) + hours) * 60) + minutes) * 60); // Display uptime - std::cout << OFFSET << "Since starting this node "; + std::cout << "Since starting this node "; if (days > 0) { std::cout << days << " days, "; } @@ -159,15 +159,15 @@ void ThreadShowMetricsScreen() } std::cout << seconds << " seconds ago:" << std::endl; - std::cout << OFFSET << "- You have validated " << transactionsValidated.get() << " transactions." << std::endl; + std::cout << "- You have validated " << transactionsValidated.get() << " transactions." << std::endl; if (mining) { - std::cout << OFFSET << "- You have completed " << ehSolverRuns.get() << " Equihash solver runs." << std::endl; + std::cout << "- You have completed " << ehSolverRuns.get() << " Equihash solver runs." << std::endl; lines++; int mined = minedBlocks.get(); if (mined > 0) { - std::cout << OFFSET << "- You have mined " << mined << " blocks!" << std::endl; + std::cout << "- You have mined " << mined << " blocks!" << std::endl; lines++; } } diff --git a/src/metrics.h b/src/metrics.h index a9713f0e2..5d8cca0dc 100644 --- a/src/metrics.h +++ b/src/metrics.h @@ -35,35 +35,27 @@ void ThreadShowMetricsScreen(); * License: CC BY-SA 3.0 * * Rendering options: - * Zcash: img2txt -W 50 -H 26 -f utf8 -d none -g 0.7 Z-yellow.orange-logo.png - * Heart: img2txt -W 50 -H 26 -f utf8 -d none 2000px-Heart_corazón.svg.png + * Zcash: img2txt -W 40 -H 20 -f utf8 -d none -g 0.7 Z-yellow.orange-logo.png + * Heart: img2txt -W 40 -H 20 -f utf8 -d none 2000px-Heart_corazón.svg.png */ const std::string METRICS_ART = -"   \n" -"   \n" -"  .;tt;.   .;t: :t;. \n" -"  :8SX8S;;;:::t%8@S;  .X ;S S; X. \n" -"  t%Xt%%ttt@XXXX@::XXXX%XS  t. X X .t \n" -"  8S;tttt%%tt8 @:;::XXXXXS8   X tt X \n" -"  %S:;;;;:XXX@@8 S;8;;tt;XXXX%8  8 8 \n" -"  8S.:::;;% S:XXXXXX     \n" -"  88....:::% %;::XXXX@    \n" -"  S8888....:%;;;;;;;;;   8t;;;::XXX8    \n" -"   S888888...:::;;;;tX8  ;Xtt;;;;;::XS.  . . \n" -"  t888888888....::::8  @:ttttt;;;;:::X  % % \n" -"  888888888888...:SS  %t%%%ttttt;;;;:X  % % \n" -"  88888888888888.t. ;Stttt%%%ttttt;;;S  % % \n" -"  t888888888888S8 8X;;;tttt%%%tttt;;@  @ @ \n" -"   @8888888888%% %%::::;;;tttt%%%tttt.  S S \n" -"  Stt88888888. %SSSSSSSSSStttt%%%tX  S S \n" -"  8ttt8888S %;;tttt%S   @ @ \n" -"  8%ttt88S %;;;;tt%   8 8 \n" -"  %8ttttt@@@XXX@ %%%%%%%S::;;X8  %. .% \n" -"  88tttt888888 X8888....:S8   .; ;. \n" -"  t8@ttt888@8888@888888S8S  t t \n" -"  :888St8888888%S88;  S S \n" -"   .;tt;:   \n" -"   \n" -"   "; - -const std::string OFFSET = " "; +"   \n" +"   \n" +"  :88SX@888@@X8:  8; %X X% ;8 \n" +"  %%Xt%tt%SSSSS:XXXt@@  X :: :: X \n" +"  @S;;tt%%%t ;;::XXXXSX  % SS % \n" +"  .t:::;;%8888 88888tXXXX8;  S S \n" +"  .%...:::8 8::XXX%;  X X \n" +"  8888...:t888888X 8t;;::XX8   8 8 \n" +" %888888...:::;:8  :Xttt;;;::X@    \n" +" 888888888...:St 8:%%tttt;;;:X  X X \n" +" 88888888888S8  :%;ttt%%tttt;;X  8 8 \n" +" %888888888%t 8S:;;;tt%%%ttt;8  : : \n" +"  8t8888888  S8888888Stt%%%t@   :: :: \n" +"  .@tt888@ 8;;ttt@;  t t \n" +"  .8ttt8@SSSSS SXXXX%:;;;X;  8 8 \n" +"  X8ttt8888% %88...::X8   X. .X \n" +"  %8@tt88;8888%8888%8X   :; ;: \n" +"  :@888@XXX@888:  tt \n" +"   \n" +"   ";