From 72d35756705aa3db6cd60db23749e0297595afe7 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Mon, 28 Oct 2024 23:17:52 +0100 Subject: [PATCH] more human readable --- src/chat_gui4.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/chat_gui4.cpp b/src/chat_gui4.cpp index 832a16be..c6712d17 100644 --- a/src/chat_gui4.cpp +++ b/src/chat_gui4.cpp @@ -1352,10 +1352,27 @@ void ChatGui4::renderMessageBodyFile(Message3Registry& reg, const Message3 e) { if (fts != nullptr) { ImGui::SeparatorText("transfer stats"); - ImGui::Text("rate up : %.1f Bytes/s", fts->rate_up); - ImGui::Text("rate down : %.1f Bytes/s", fts->rate_down); - ImGui::Text("total up : %lu Bytes", fts->total_up); - ImGui::Text("total down: %lu Bytes", fts->total_down); + + { + const char* byte_suffix = "???"; + int64_t byte_divider = sizeToHumanReadable(fts->rate_up, byte_suffix); + ImGui::Text("rate up : %.2f %s/s", fts->rate_up/byte_divider, byte_suffix); + } + { + const char* byte_suffix = "???"; + int64_t byte_divider = sizeToHumanReadable(fts->rate_down, byte_suffix); + ImGui::Text("rate down : %.2f %s/s", fts->rate_down/byte_divider, byte_suffix); + } + { + const char* byte_suffix = "???"; + int64_t byte_divider = sizeToHumanReadable(fts->total_up, byte_suffix); + ImGui::Text("total up : %.3f %s", double(fts->total_up)/byte_divider, byte_suffix); + } + { + const char* byte_suffix = "???"; + int64_t byte_divider = sizeToHumanReadable(fts->total_down, byte_suffix); + ImGui::Text("total down: %.3f %s", double(fts->total_down)/byte_divider, byte_suffix); + } } ImGui::EndTooltip();