| 21 | #include "../../../lib/imgui/addon/imguitinyfiledialogs.h" |
| 22 | |
| 23 | ContainersView::ContainersView(BString tab, BString app) : BaseView(B("ContainersView")), currentContainer(nullptr), currentContainerChanged(false), currentContainerMountChanged(false), currentApp(nullptr), currentAppChanged(false) { |
| 24 | std::shared_ptr<ImGuiLayout> model = std::make_shared<ImGuiLayout>(); |
| 25 | section = model->addSection(); |
| 26 | |
| 27 | containerNameControl = section->addTextInputRow(Msg::CONTAINER_VIEW_CONTAINER_NAME_LABEL, Msg::NONE); |
| 28 | containerNameControl->onChange = [this]() { |
| 29 | this->setTabName(this->tabIndex, this->containerNameControl->getText()); |
| 30 | currentContainer->setName(this->containerNameControl->getText()); |
| 31 | section->setTitle(currentContainer->getName()); |
| 32 | this->currentContainerChanged = true; |
| 33 | }; |
| 34 | |
| 35 | containerFileSystemControl = createFileSystemVersionCombobox(section); |
| 36 | containerFileSystemControl->onChange = [this]() { |
| 37 | this->currentContainerChanged = true; |
| 38 | std::shared_ptr<FileSystemZip> fileSystem = GlobalSettings::getInstalledFileSystemFromName(this->containerFileSystemControl->getSelectionStringValue()); |
| 39 | bool renderer = fileSystem->wineVersion > 500; |
| 40 | containerGdiControl->setRowHidden(renderer); |
| 41 | containerRendererControl->setRowHidden(!renderer); |
| 42 | #ifdef _DEBUG |
| 43 | appDirectDrawAutoRefreshControl->setReadOnly(atoi(fileSystem->fsVersion.c_str()) < 7 || !fileSystem->hasWine()); |
| 44 | #endif |
| 45 | Fs::deleteNativeDirAndAllFilesInDir(this->currentContainer->getDir() + Fs::nativePathSeperator + "root" + Fs::nativePathSeperator + "opt" + Fs::nativePathSeperator + "wine"); |
| 46 | }; |
| 47 | |
| 48 | std::shared_ptr<LayoutRow> row = section->addRow(Msg::CONTAINER_VIEW_CONTAINER_LOCATION_LABEL, Msg::NONE); |
| 49 | containerLocationControl = row->addTextInput(B(""), true); |
| 50 | std::shared_ptr<LayoutButtonControl> showButtonControl = row->addButton(getTranslation(Msg::GENERIC_OPEN_BUTTON)); |
| 51 | showButtonControl->onChange = [this]() { |
| 52 | Platform::openFileLocation(currentContainer->getDir()); |
| 53 | }; |
| 54 | |
| 55 | section->addSeparator(); |
| 56 | |
| 57 | containerWindowsVersionControl = createWindowsVersionCombobox(section); |
| 58 | containerWindowsVersionControl->onChange = [this]() { |
| 59 | this->currentContainerChanged = true; |
| 60 | }; |
| 61 | |
| 62 | |
| 63 | containerGdiControl = section->addCheckbox(Msg::CONTAINER_VIEW_GDI_RENDERER_LABEL, Msg::CONTAINER_VIEW_GDI_RENDERER_HELP, false); |
| 64 | containerGdiControl->onChange = [this]() { |
| 65 | this->currentContainerChanged = true; |
| 66 | }; |
| 67 | |
| 68 | std::vector<ComboboxItem> rendererOptions; |
| 69 | rendererOptions.push_back(ComboboxItem(B("OpenGL"), B("gl"))); |
| 70 | #ifdef BOXEDWINE_VULKAN |
| 71 | rendererOptions.push_back(ComboboxItem(B("Vulkan"), B("vulkan"))); |
| 72 | #endif |
| 73 | rendererOptions.push_back(ComboboxItem(B("GDI"), B("gdi"))); |
| 74 | containerRendererControl = section->addComboboxRow(Msg::CONTAINER_VIEW_RENDERER_LABEL, Msg::CONTAINER_VIEW_RENDERER_HELP, rendererOptions); |
| 75 | containerRendererControl->onChange = [this]() { |
| 76 | this->currentContainerChanged = true; |
| 77 | }; |
| 78 | containerRendererControl->setWidth((int)GlobalSettings::scaleFloatUIAndFont(150)); |
| 79 | |
| 80 | #ifdef _DEBUG |
nothing calls this directly
no test coverage detected