From 8777539c2c4505e1d0d7ce253922536b542687ba Mon Sep 17 00:00:00 2001 From: Green Sky Date: Wed, 20 Nov 2024 12:55:46 +0100 Subject: [PATCH] add download priority (does not seem to work yet) --- src/chat_gui4.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/chat_gui4.cpp b/src/chat_gui4.cpp index 550110b5..a1c74e78 100644 --- a/src/chat_gui4.cpp +++ b/src/chat_gui4.cpp @@ -1345,6 +1345,45 @@ void ChatGui4::renderMessageBodyFile(Message3Registry& reg, const Message3 e) { ImGui::Separator(); + // TODO: better way to dif up/down + if (!o.all_of()) { + if (ImGui::BeginMenu("dowload priority")) { + using Priority = ObjComp::Ephemeral::File::DownloadPriority::Priority; + auto& p_comp = o.get_or_emplace(); + + bool updated {false}; + if (ImGui::MenuItem("highest", nullptr, p_comp.p == Priority::HIGHEST)) { + p_comp.p = Priority::HIGHEST; + updated = true; + } + if (ImGui::MenuItem("high", nullptr, p_comp.p == Priority::HIGH)) { + p_comp.p = Priority::HIGH; + updated = true; + } + if (ImGui::MenuItem("normal", nullptr, p_comp.p == Priority::NORMAL)) { + p_comp.p = Priority::NORMAL; + updated = true; + } + if (ImGui::MenuItem("low", nullptr, p_comp.p == Priority::LOW)) { + p_comp.p = Priority::LOW; + updated = true; + } + if (ImGui::MenuItem("lowest", nullptr, p_comp.p == Priority::LOWEST)) { + p_comp.p = Priority::LOWEST; + updated = true; + } + + if (updated) { + std::cout << "CG: updated download priority to " << int(p_comp.p) << "\n"; + // TODO: dont do it here + _os.throwEventUpdate(o); + } + + ImGui::EndMenu(); + } + ImGui::Separator(); + } + if (ImGui::BeginMenu("forward", o.all_of())) { for (const auto& c : _cr.view()) { // filter