| 87 | ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, BarPaddingY)); |
| 88 | ImGui::ProgressBar(Task.Fraction, ImVec2(-FLT_MIN, BarHeight), *Overlay); |
| 89 | ImGui::PopStyleVar(2); |
| 90 | ImGui::PopStyleColor(2); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | void Render() |
| 95 | { |
| 96 | TVector<FSlowTaskProgress> Tasks = SlowTasks::GetSnapshot(); |
| 97 | |
| 98 | const bool bWantOpen = !Tasks.IsEmpty(); |
| 99 | const bool bIsOpen = ImGui::IsPopupOpen(GPopupID); |
| 100 | |
| 101 | if (bWantOpen && !bIsOpen) |
| 102 | { |
| 103 | ImGui::OpenPopup(GPopupID); |
| 104 | } |
| 105 | |
| 106 | if (!bWantOpen) |
| 107 | { |
| 108 | // Drain the popup so it actually closes once every task has finished. |
| 109 | if (bIsOpen && ImGui::BeginPopupModal(GPopupID, nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize)) |
| 110 | { |
| 111 | ImGui::CloseCurrentPopup(); |
| 112 | ImGui::EndPopup(); |
| 113 | } |
| 114 | return; |
| 115 | } |
| 116 | |
| 117 | const ImGuiViewport* Viewport = ImGui::GetMainViewport(); |
| 118 | ImGui::SetNextWindowPos(Viewport->GetCenter(), ImGuiCond_Always, ImVec2(0.5f, 0.5f)); |
| 119 | ImGui::SetNextWindowSize(ImVec2(460.0f, 0.0f), ImGuiCond_Always); |
| 120 | |
| 121 | constexpr ImGuiWindowFlags Flags = |
| 122 | ImGuiWindowFlags_NoTitleBar | |
| 123 | ImGuiWindowFlags_NoResize | |
| 124 | ImGuiWindowFlags_NoMove | |
| 125 | ImGuiWindowFlags_NoSavedSettings; |
| 126 | |
| 127 | ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 18.0f)); |
| 128 | ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(6.0f, 6.0f)); |
| 129 | |
| 130 | if (ImGui::BeginPopupModal(GPopupID, nullptr, Flags)) |
| 131 | { |
| 132 | ImGui::PushStyleColor(ImGuiCol_Text, GHeaderText); |
| 133 | ImGui::TextUnformatted(LE_ICON_TIMER_SAND " WORKING"); |
| 134 | ImGui::PopStyleColor(); |
| 135 | ImGui::Spacing(); |
| 136 | |
| 137 | for (int32 i = 0; i < Tasks.Num(); ++i) |
| 138 | { |
| 139 | if (i > 0) |
| 140 | { |
| 141 | ImGui::Spacing(); |
| 142 | ImGui::Separator(); |
| 143 | ImGui::Spacing(); |
| 144 | } |
| 145 | DrawTask(Tasks[i]); |
| 146 | } |
nothing calls this directly
no test coverage detected