From 3664326818f50f75567a0af48ee12c2f21abab1c Mon Sep 17 00:00:00 2001 From: upstream svn Date: Sat, 23 Jan 2021 13:11:22 +0000 Subject: [PATCH] MuleTrayIcon: show MB/s instead kB/s --- .svn-revision | 2 +- src/MuleTrayIcon.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.svn-revision b/.svn-revision index 42857a2c..d6eb27c0 100644 --- a/.svn-revision +++ b/.svn-revision @@ -1 +1 @@ -11075 +11076 diff --git a/src/MuleTrayIcon.cpp b/src/MuleTrayIcon.cpp index 848d5e13..b5070928 100644 --- a/src/MuleTrayIcon.cpp +++ b/src/MuleTrayIcon.cpp @@ -286,6 +286,13 @@ void CMuleTrayIcon::UpdateTray() wxMenu* CMuleTrayIcon::CreatePopupMenu() { + float kBpsUp = theStats::GetUploadRate() / 1024.0; + float kBpsDown = theStats::GetDownloadRate() / 1024.0; + float MBpsUp = kBpsUp / 1024.0; + float MBpsDown = kBpsDown / 1024.0; + bool showMBpsUp = (MBpsUp >= 1); + bool showMBpsDown = (MBpsDown >= 1); + // Creates dinamically the menu to show the user. wxMenu *traymenu = new wxMenu(); traymenu->SetTitle(_("aMule Tray Menu")); @@ -316,9 +323,11 @@ wxMenu* CMuleTrayIcon::CreatePopupMenu() } traymenu->Append(TRAY_MENU_INFO, label); - label = CFormat(_("Download speed: %.1f")) % (theStats::GetDownloadRate() / 1024.0); + label = CFormat(_("Download speed: %.1f%s")) + % (showMBpsDown ? MBpsDown : kBpsDown) % (showMBpsDown ? _(" MB/s") : ((kBpsDown > 0) ? _(" kB/s") : "")); traymenu->Append(TRAY_MENU_INFO, label); - label = CFormat(_("Upload speed: %.1f")) % (theStats::GetUploadRate() / 1024.0); + label = CFormat(_("Upload speed: %.1f%s")) + % (showMBpsUp ? MBpsUp : kBpsUp) % (showMBpsUp ? _(" MB/s") : ((kBpsUp > 0) ? _(" kB/s") : "")); traymenu->Append(TRAY_MENU_INFO, label); traymenu->AppendSeparator(); -- 2.11.4.GIT