소스 검색

Add a little bit of color to have a better visual of important informations

rotor 9 년 전
부모
커밋
cefea5db5a
1개의 변경된 파일8개의 추가작업 그리고 7개의 파일을 삭제
  1. 8 7
      src/ConsoleStatCalc.cc

+ 8 - 7
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<RequestGroup>& 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<RequestGroup>& 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<RequestGroup>& rg,
   if (eta > 0) {
     o << " ETA:" << colors::yellow << util::secfmt(eta) << colors::clear;
   }
-  o << "]";
+  o << colors::magenta  << "]" << colors::clear;
 }
 } // namespace