| 1114 | } |
| 1115 | |
| 1116 | void ImGuiMenu::drawModalMessage_() |
| 1117 | { |
| 1118 | ImGui::PushStyleColor( ImGuiCol_ModalWindowDimBg, ImVec4( 1, 0.125f, 0.125f, ImGui::GetStyle().Colors[ImGuiCol_ModalWindowDimBg].w ) ); |
| 1119 | |
| 1120 | std::string titleKey; |
| 1121 | std::string titleDisplay; |
| 1122 | if ( modalMessageType_ == NotificationType::Error ) |
| 1123 | { |
| 1124 | titleKey = "Error"; |
| 1125 | titleDisplay = s_tr( "Error" ); |
| 1126 | } |
| 1127 | else if ( modalMessageType_ == NotificationType::Warning ) |
| 1128 | { |
| 1129 | titleKey = "Warning"; |
| 1130 | titleDisplay = s_tr( "Warning" ); |
| 1131 | } |
| 1132 | else //if ( modalMessageType_ == MessageType::Info ) |
| 1133 | { |
| 1134 | titleKey = "Info"; |
| 1135 | titleDisplay = s_tr( "Info" ); |
| 1136 | } |
| 1137 | |
| 1138 | const std::string titleImGui = " " + titleKey + "##modal"; |
| 1139 | |
| 1140 | if ( showInfoModal_ && |
| 1141 | !ImGui::IsPopupOpen( " Error##modal" ) && !ImGui::IsPopupOpen( " Warning##modal" ) && !ImGui::IsPopupOpen( " Info##modal" ) ) |
| 1142 | { |
| 1143 | ImGui::OpenPopup( titleImGui.c_str() ); |
| 1144 | showInfoModal_ = false; |
| 1145 | } |
| 1146 | |
| 1147 | ModalDialog modal( titleImGui, { |
| 1148 | .headline = titleDisplay, |
| 1149 | .text = storedModalMessage_, |
| 1150 | .closeOnClickOutside = true, |
| 1151 | } ); |
| 1152 | if ( modal.beginPopup() ) |
| 1153 | { |
| 1154 | const auto style = ImGui::GetStyle(); |
| 1155 | ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, { style.FramePadding.x, cButtonPadding * UI::scale() } ); |
| 1156 | if ( UI::button( _tr( "Okay" ), Vector2f( -1, 0 ), ImGuiKey_Enter ) ) |
| 1157 | ImGui::CloseCurrentPopup(); |
| 1158 | ImGui::PopStyleVar(); |
| 1159 | |
| 1160 | modal.endPopup(); |
| 1161 | needModalBgChange_ = true; |
| 1162 | } |
| 1163 | else |
| 1164 | { |
| 1165 | needModalBgChange_ = false; |
| 1166 | } |
| 1167 | |
| 1168 | ImGui::PopStyleColor(); |
| 1169 | } |
| 1170 | |
| 1171 | void ImGuiMenu::setDrawTimeMillisecThreshold( long long maxGoodTimeMillisec ) |
| 1172 | { |
nothing calls this directly
no test coverage detected