| 434 | } |
| 435 | |
| 436 | void BrowserWindow::processUserList() |
| 437 | { |
| 438 | auto sizeAvailable = ImGui::GetContentRegionAvail(); |
| 439 | if (ImGui::BeginChild("##2", ImVec2(sizeAvailable.x, sizeAvailable.y - scale(BrowserBottomSpace)), false, ImGuiWindowFlags_HorizontalScrollbar)) { |
| 440 | |
| 441 | |
| 442 | ImGui::PushID("User list"); |
| 443 | auto& styleRepository = StyleRepository::get(); |
| 444 | static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_RowBg |
| 445 | | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ScrollY | ImGuiTableFlags_ScrollX; |
| 446 | |
| 447 | if (ImGui::BeginTabBar("##Simulators", ImGuiTabBarFlags_FittingPolicyResizeDown)) { |
| 448 | if (ImGui::BeginTabItem("Simulators", nullptr, ImGuiTabItemFlags_None)) { |
| 449 | |
| 450 | if (ImGui::BeginTable("Browser", 5, flags, ImVec2(-1, -1), 0.0f)) { |
| 451 | ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_PreferSortDescending | ImGuiTableColumnFlags_WidthFixed, scale(90.0f)); |
| 452 | auto isLoggedIn = NetworkService::get().getLoggedInUserName().has_value(); |
| 453 | ImGui::TableSetupColumn( |
| 454 | isLoggedIn ? "GPU model" : "GPU (visible if logged in)", |
| 455 | ImGuiTableColumnFlags_DefaultSort | ImGuiTableColumnFlags_WidthFixed, |
| 456 | styleRepository.scale(200.0f)); |
| 457 | ImGui::TableSetupColumn("Time spent", ImGuiTableColumnFlags_DefaultSort | ImGuiTableColumnFlags_WidthFixed, styleRepository.scale(80.0f)); |
| 458 | ImGui::TableSetupColumn( |
| 459 | "Reactions received", |
| 460 | ImGuiTableColumnFlags_DefaultSort | ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_PreferSortDescending, |
| 461 | scale(120.0f)); |
| 462 | ImGui::TableSetupColumn( |
| 463 | "Reactions given", ImGuiTableColumnFlags_DefaultSort | ImGuiTableColumnFlags_WidthFixed, styleRepository.scale(100.0f)); |
| 464 | ImGui::TableSetupScrollFreeze(0, 1); |
| 465 | ImGui::TableHeadersRow(); |
| 466 | ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, Const::TableHeaderColor); |
| 467 | |
| 468 | ImGuiListClipper clipper; |
| 469 | clipper.Begin(_userTOs.size()); |
| 470 | while (clipper.Step()) { |
| 471 | for (int row = clipper.DisplayStart; row < clipper.DisplayEnd; row++) { |
| 472 | auto item = &_userTOs[row]; |
| 473 | |
| 474 | ImGui::PushID(row); |
| 475 | ImGui::TableNextRow(0, scale(RowHeight)); |
| 476 | |
| 477 | ImGui::TableNextColumn(); |
| 478 | auto isBoldFont = isLoggedIn && *NetworkService::get().getLoggedInUserName() == item->userName; |
| 479 | |
| 480 | if (item->online) { |
| 481 | AlienImGui::OnlineSymbol(); |
| 482 | ImGui::SameLine(); |
| 483 | } else if (item->lastDayOnline) { |
| 484 | AlienImGui::LastDayOnlineSymbol(); |
| 485 | ImGui::SameLine(); |
| 486 | } |
| 487 | processShortenedText(item->userName, isBoldFont); |
| 488 | |
| 489 | ImGui::TableNextColumn(); |
| 490 | if (isLoggedIn && LoginController::get().shareGpuInfo()) { |
| 491 | processShortenedText(getGpuString(item->gpu), isBoldFont); |
| 492 | } |
| 493 |
nothing calls this directly
no test coverage detected