| 121 | } |
| 122 | |
| 123 | void InstallView::createInstallTab(BString initialFileOrDirPath) { |
| 124 | std::shared_ptr<ImGuiLayout> model = std::make_shared<ImGuiLayout>(); |
| 125 | std::shared_ptr<LayoutSection> section = model->addSection(Msg::INSTALLVIEW_INSTALL_TITLE); |
| 126 | |
| 127 | // Initialize Install Type Control |
| 128 | std::vector<ComboboxItem> installTypes; |
| 129 | installTypes.push_back(ComboboxItem(getTranslation(Msg::INSTALLVIEW_TYPE_SETUP))); |
| 130 | installTypes.push_back(ComboboxItem(getTranslation(Msg::INSTALLVIEW_TYPE_DIRECTORY))); |
| 131 | installTypes.push_back(ComboboxItem(getTranslation(Msg::INSTALLVIEW_TYPE_MOUNT))); |
| 132 | installTypes.push_back(ComboboxItem(getTranslation(Msg::INSTALLVIEW_TYPE_BLANK))); |
| 133 | installTypeControl = section->addComboboxRow(Msg::INSTALLVIEW_INSTALL_TYPE_LABEL, Msg::INSTALLVIEW_INSTALL_TYPE_HELP, installTypes, 0); |
| 134 | installTypeControl->onChange = [this]() { |
| 135 | int type = installTypeControl->getSelection(); |
| 136 | locationControl->setRowHidden(type == INSTALL_TYPE_BLANK); |
| 137 | containerControl->setReadOnly(type == INSTALL_TYPE_BLANK); |
| 138 | if (type == INSTALL_TYPE_SETUP) { |
| 139 | std::vector<BString> types; |
| 140 | types.push_back(B("*.exe")); |
| 141 | #ifndef BOXEDWINE_MSVC |
| 142 | types.push_back(B("*.EXE")); |
| 143 | #endif |
| 144 | locationControl->setBrowseFileButton(types); |
| 145 | locationControl->setHelpId(Msg::INSTALLVIEW_TYPE_SETUP_HELP); |
| 146 | } else if (type == INSTALL_TYPE_DIR) { |
| 147 | locationControl->setBrowseDirButton(); |
| 148 | locationControl->setHelpId(Msg::INSTALLVIEW_TYPE_DIR_HELP); |
| 149 | } else if (type == INSTALL_TYPE_MOUNT) { |
| 150 | locationControl->setBrowseDirButton(); |
| 151 | locationControl->setHelpId(Msg::INSTALLVIEW_TYPE_MOUNT_HELP); |
| 152 | } else { |
| 153 | containerControl->setSelection(0); |
| 154 | } |
| 155 | }; |
| 156 | |
| 157 | // Initialize File/Dir Location Control |
| 158 | locationControl = section->addTextInputRow(Msg::INSTALLVIEW_SETUP_FILE_LOCATION_LABEL, Msg::INSTALLVIEW_TYPE_SETUP_HELP); |
| 159 | locationControl->onBrowseFinished = [this]() { |
| 160 | if (containerNameControl->getText().length()==0) { |
| 161 | setContainerName(); |
| 162 | } |
| 163 | }; |
| 164 | |
| 165 | // Initialize Container Control |
| 166 | std::vector<ComboboxItem> containers; |
| 167 | containers.push_back(ComboboxItem(getTranslation(Msg::INSTALLVIEW_NEW_CONTAINER))); |
| 168 | for (auto& container : BoxedwineData::getContainers()) { |
| 169 | containers.push_back(ComboboxItem(container->getName())); |
| 170 | } |
| 171 | containerControl = section->addComboboxRow(Msg::INSTALLVIEW_CONTAINER_LABEL, Msg::INSTALLVIEW_CONTAINER_HELP, containers, 0); |
| 172 | |
| 173 | // Sub Section For New Container |
| 174 | containerSection = model->addSection(); |
| 175 | containerSection->setIndent(true); |
| 176 | containerControl->onChange = [this]() { |
| 177 | containerSection->setHidden(containerControl->getSelection() != 0); |
| 178 | }; |
| 179 | |
| 180 | // Initialize Container Name Control |
nothing calls this directly
no test coverage detected