MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / setCurrentContainer

Method setCurrentContainer

source/ui/controls/containersView.cpp:709–826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

707}
708
709void ContainersView::setCurrentContainer(BoxedContainer* container) {
710 this->currentContainer = container;
711 this->currentContainerChanged = false;
712 this->currentContainerMountChanged = false;
713 section->setTitle(container->getName());
714 BString fsName = container->getFileSystemName();
715 bool fsNameFound = false;
716
717 std::vector<ComboboxItem> wineVersions;
718 for (auto& ver : GlobalSettings::getFileSystemVersions()) {
719 wineVersions.push_back(ComboboxItem(ver->name));
720 if (ver->name == fsName) {
721 fsNameFound = true;
722 }
723 }
724 if (!fsNameFound) {
725 wineVersions.push_back(ComboboxItem(fsName+"*", fsName));
726 }
727 containerFileSystemControl->setOptions(wineVersions);
728 containerFileSystemControl->setSelectionStringValue(fsName);
729 containerWindowsVersionControl->setSelectionByLabel(container->getWindowsVersion());
730 containerNameControl->setText(container->getName());
731 containerLocationControl->setText(container->getDir());
732
733 container->updateCachedSize();
734 std::shared_ptr<FileSystemZip> fs = container->getFileSystem().lock();
735 bool hasWine = fs && fs->hasWine();
736
737 containerMountDriveControl->setRowHidden(!hasWine);
738 containerGdiControl->setRowHidden(!hasWine);
739 containerRendererControl->setRowHidden(!hasWine);
740
741#ifdef _DEBUG
742 videoMemorySizeControl->setRowHidden(!hasWine);
743#endif
744 containerMouseWarpControl->setRowHidden(!hasWine);
745 componentsControl->setRowHidden(!hasWine);
746 containerWindowsVersionControl->setRowHidden(!hasWine);
747
748 if (hasWine) {
749 if (!container->getMounts().size() || !container->getMounts()[0].wine || container->getMounts()[0].localPath.length() != 1) {
750 containerMountDriveControl->setSelection(0);
751 containerMountPathControl->setText(B(""));
752 } else {
753 const MountInfo& mount = container->getMounts()[0];
754 BString lowerCase = mount.localPath.toLowerCase();
755 containerMountDriveControl->setSelectionStringValue(lowerCase);
756 containerMountPathControl->setText(mount.nativePath);
757 }
758
759 std::shared_ptr<FileSystemZip> fileSystem = GlobalSettings::getInstalledFileSystemFromName(this->containerFileSystemControl->getSelectionStringValue());
760 if (fileSystem->wineVersion > 500) {
761 containerGdiControl->setCheck(false);
762 containerRendererControl->setSelectionStringValue(container->getRenderer());
763
764 containerGdiControl->setRowHidden(true);
765 containerRendererControl->setRowHidden(false);
766 } else {

Callers 1

ContainersViewMethod · 0.95

Calls 15

ComboboxItemClass · 0.85
BFunction · 0.85
getFileSystemNameMethod · 0.80
setOptionsMethod · 0.80
setSelectionByLabelMethod · 0.80
getWindowsVersionMethod · 0.80
getDirMethod · 0.80
updateCachedSizeMethod · 0.80
getFileSystemMethod · 0.80
hasWineMethod · 0.80
setRowHiddenMethod · 0.80

Tested by

no test coverage detected