From cefea5db5acc3f2f7268de394f4bac2b5945998e Mon Sep 17 00:00:00 2001 From: rotor Date: Tue, 19 Apr 2016 10:56:44 +0200 Subject: [PATCH] Add a little bit of color to have a better visual of important informations --- src/ConsoleStatCalc.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ConsoleStatCalc.cc b/src/ConsoleStatCalc.cc index 066e814f..5ee91832 100644 --- a/src/ConsoleStatCalc.cc +++ b/src/ConsoleStatCalc.cc @@ -124,7 +124,8 @@ void printSizeProgress(ColorizedStream& o, o << sizeFormatter(rg->getCompletedLength()) << "B/" << sizeFormatter(rg->getTotalLength()) << "B"; if (rg->getTotalLength() > 0) { - o << "(" << 100 * rg->getCompletedLength() / rg->getTotalLength() << "%)"; + o << colors::cyan << "(" << 100 * rg->getCompletedLength() / rg->getTotalLength() << "%)"; + o << colors::clear; } } } @@ -138,11 +139,11 @@ void printProgressCompact(ColorizedStream& o, const DownloadEngine* e, NetStat& netstat = e->getRequestGroupMan()->getNetStat(); int dl = netstat.calculateDownloadSpeed(); int ul = netstat.calculateUploadSpeed(); - o << "[DL:" << colors::green << sizeFormatter(dl) << "B" << colors::clear; + o << colors::magenta << "[" << colors::clear << "DL:" << colors::green << sizeFormatter(dl) << "B" << colors::clear; if (ul) { o << " UL:" << colors::cyan << sizeFormatter(ul) << "B" << colors::clear; } - o << "]"; + o << colors::magenta << "]" << colors::clear; } const RequestGroupList& groups = e->getRequestGroupMan()->getRequestGroups(); @@ -152,9 +153,9 @@ void printProgressCompact(ColorizedStream& o, const DownloadEngine* e, ++i, ++cnt) { const std::shared_ptr& rg = *i; TransferStat stat = rg->calculateStat(); - o << "[#" << GroupId::toAbbrevHex(rg->getGID()) << " "; + o << colors::magenta << "[" << colors::clear << "#" << GroupId::toAbbrevHex(rg->getGID()) << " "; printSizeProgress(o, rg, stat, sizeFormatter); - o << "]"; + o << colors::magenta << "]" << colors::clear; } if (cnt < groups.size()) { o << "(+" << groups.size() - cnt << ")"; @@ -172,7 +173,7 @@ void printProgress(ColorizedStream& o, const std::shared_ptr& rg, eta = (rg->getTotalLength() - rg->getCompletedLength()) / stat.downloadSpeed; } - o << "[#" << GroupId::toAbbrevHex(rg->getGID()) << " "; + o << colors::magenta << "[" << colors::clear << "#" << GroupId::toAbbrevHex(rg->getGID()) << " "; printSizeProgress(o, rg, stat, sizeFormatter); o << " CN:" << rg->getNumConnection(); #ifdef ENABLE_BITTORRENT @@ -195,7 +196,7 @@ void printProgress(ColorizedStream& o, const std::shared_ptr& rg, if (eta > 0) { o << " ETA:" << colors::yellow << util::secfmt(eta) << colors::clear; } - o << "]"; + o << colors::magenta << "]" << colors::clear; } } // namespace