| 53 | } |
| 54 | |
| 55 | void InstallView::runApps(std::vector<AppFilePtr>& apps) { |
| 56 | ImGui::PushFont(GlobalSettings::largeFont); |
| 57 | ImGui::Dummy(ImVec2(0.0f, this->extraVerticalSpacing)); |
| 58 | SAFE_IMGUI_TEXT(c_getTranslation(Msg::INSTALLVIEW_DEMO_TITLE)); |
| 59 | ImGui::PopFont(); |
| 60 | |
| 61 | ImVec2 size = ImGui::GetWindowContentRegionMax(); |
| 62 | size.y -= ImGui::GetCursorPosY() + GlobalSettings::scaleFloatUI(8.0f); |
| 63 | |
| 64 | ImGui::PushFont(GlobalSettings::mediumFont); |
| 65 | //ImGui::BeginChildFrame(401, size); |
| 66 | ImGui::Dummy(ImVec2(0.0f, this->extraVerticalSpacing)); |
| 67 | for (auto& app : apps) { |
| 68 | ImGui::Dummy(ImVec2(this->extraVerticalSpacing, 0.0f)); |
| 69 | ImGui::SameLine(); |
| 70 | ImVec2 pos = ImGui::GetCursorPos(); |
| 71 | pos.y += this->extraVerticalSpacing; |
| 72 | ImGui::SetCursorPos(pos); |
| 73 | |
| 74 | BString buttonLabel = B("Install"); |
| 75 | ImGui::PushID(&app); |
| 76 | if (ImGui::Button(buttonLabel.c_str())) { |
| 77 | if (Fs::doesNativePathExist(app->localFilePath)) { |
| 78 | app->install(); |
| 79 | } else { |
| 80 | GlobalSettings::downloadFile(app->filePath, app->localFilePath, app->name, app->size, [&app](bool sucess) { |
| 81 | app->install(); |
| 82 | }); |
| 83 | } |
| 84 | } |
| 85 | ImGui::PopID(); |
| 86 | ImGui::SameLine(); |
| 87 | |
| 88 | //ImGui::SameLine(pos.x + this->wineButtonTotalColumnWidth); |
| 89 | BString name = app->name; |
| 90 | BString name2; |
| 91 | if (!Fs::doesNativePathExist(app->localFilePath)) { |
| 92 | name2 += "("; |
| 93 | name2 += getTranslation(Msg::INSTALLVIEW_DEMO_DOWNLOAD_SIZE); |
| 94 | name2 += app->size; |
| 95 | name2 += " MB)"; |
| 96 | } |
| 97 | if (app->iconTexture) { |
| 98 | float pad = ImGui::GetStyle().FramePadding.y; |
| 99 | ImGui::Image(app->iconTexture->getTexture(), ImVec2(ImGui::GetTextLineHeight()+pad*2, ImGui::GetTextLineHeight()+pad*2)); |
| 100 | ImGui::SameLine(); |
| 101 | } |
| 102 | SAFE_IMGUI_TEXT(name.c_str()); |
| 103 | ImGui::SameLine(); |
| 104 | ImGui::PushFont(GlobalSettings::defaultFont); |
| 105 | pos = ImGui::GetCursorPos(); |
| 106 | float y = pos.y; |
| 107 | pos.y += GlobalSettings::mediumFont->FontSize / 2 - GlobalSettings::defaultFont->FontSize / 2; |
| 108 | ImGui::SetCursorPos(pos); |
| 109 | SAFE_IMGUI_TEXT(name2.c_str()); |
| 110 | ImGui::PopFont(); |
| 111 | if (app->help.length()) { |
| 112 | pos = ImGui::GetCursorPos(); |
nothing calls this directly
no test coverage detected