diff --git a/src/chat_gui4.cpp b/src/chat_gui4.cpp index 8fe466c..ed47d17 100644 --- a/src/chat_gui4.cpp +++ b/src/chat_gui4.cpp @@ -2,6 +2,7 @@ #include "./file_selector.hpp" +#include #include #include #include @@ -545,9 +546,16 @@ void ChatGui4::renderMessageBodyFile(Message3Registry& reg, const Message3 e) { ImGui::TextUnformatted("down"); if (reg.all_of(e)) { ImGui::SameLine(); + + float fraction = float(reg.get(e).total) / reg.get(e).total_size; + + char overlay_buf[32]; + std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%%", fraction * 100 + 0.01f); + ImGui::ProgressBar( - float(reg.get(e).total) / reg.get(e).total_size, - {-FLT_MIN, TEXT_BASE_HEIGHT} + fraction, + {-FLT_MIN, TEXT_BASE_HEIGHT}, + overlay_buf ); // TODO: numbers } @@ -559,9 +567,16 @@ void ChatGui4::renderMessageBodyFile(Message3Registry& reg, const Message3 e) { ImGui::TextUnformatted(" up"); if (reg.all_of(e)) { ImGui::SameLine(); + + float fraction = float(reg.get(e).total) / reg.get(e).total_size; + + char overlay_buf[32]; + std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%%", fraction * 100 + 0.01f); + ImGui::ProgressBar( - float(reg.get(e).total) / reg.get(e).total_size, - {-FLT_MIN, TEXT_BASE_HEIGHT} + fraction, + {-FLT_MIN, TEXT_BASE_HEIGHT}, + overlay_buf ); // TODO: numbers }