| 45 | } |
| 46 | |
| 47 | bool showYesNoMessageBox(BString id, bool open, const char* title, const char* msg, bool* yes) { |
| 48 | bool result = true; |
| 49 | ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(GlobalSettings::scaleFloatUI(8.0f), GlobalSettings::scaleFloatUI(8.0f))); |
| 50 | ImGui::PushID(id.c_str()); |
| 51 | if (open) { |
| 52 | ImGui::OpenPopup(title); |
| 53 | } |
| 54 | if (ImGui::BeginPopupModal(title, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) |
| 55 | { |
| 56 | SAFE_IMGUI_TEXT(msg); |
| 57 | ImGui::Separator(); |
| 58 | |
| 59 | if (ImGui::Button(c_getTranslation(Msg::GENERIC_DLG_YES), ImVec2(GlobalSettings::scaleFloatUIAndFont(120.0f), 0))) { |
| 60 | ImGui::CloseCurrentPopup(); |
| 61 | result = false; |
| 62 | *yes = true; |
| 63 | } |
| 64 | ImGui::SameLine(); |
| 65 | if (ImGui::Button(c_getTranslation(Msg::GENERIC_DLG_NO), ImVec2(GlobalSettings::scaleFloatUIAndFont(120.0f), 0))) { |
| 66 | ImGui::CloseCurrentPopup(); |
| 67 | result = false; |
| 68 | } |
| 69 | ImGui::SetItemDefaultFocus(); |
| 70 | ImGui::EndPopup(); |
| 71 | } |
| 72 | ImGui::PopID(); |
| 73 | ImGui::PopStyleVar(); |
| 74 | return result; |
| 75 | } |
| 76 | |
| 77 | BString getReadableSize(U64 bytes) { |
| 78 | if (bytes < 4096) { |
no test coverage detected