use of org.phoenicis.containers.dto.ContainerCategoryDTO in project POL-POM-5 by PhoenicisOrg.
the class GenericContainersManager method fetchContainers.
/**
* {@inheritDoc}
* @param callback
* @param errorCallback
*/
@Override
public void fetchContainers(Consumer<List<ContainerCategoryDTO>> callback, Consumer<Exception> errorCallback) {
final File containersFile = new File(containersPath);
containersFile.mkdirs();
final File[] engineDirectories = containersFile.listFiles();
if (engineDirectories == null) {
callback.accept(Collections.emptyList());
} else {
final List<ContainerCategoryDTO> containerCategories = new ArrayList<>();
for (File engineDirectory : engineDirectories) {
final List<ContainerDTO> containers = fetchContainers(engineDirectory);
if (!CollectionUtils.isEmpty(containers)) {
containerCategories.add(new ContainerCategoryDTO.Builder().withName(engineDirectory.getName()).withContainers(containers).build());
}
}
callback.accept(containerCategories);
}
}
use of org.phoenicis.containers.dto.ContainerCategoryDTO in project POL-POM-5 by PlayOnLinux.
the class WinePrefixContainersManager method fetchContainers.
@Override
public void fetchContainers(Consumer<List<ContainerCategoryDTO>> callback, Consumer<Exception> errorCallback) {
final File winePrefixesFile = new File(winePrefixPath);
winePrefixesFile.mkdirs();
final File[] winePrefixes = winePrefixesFile.listFiles();
if (winePrefixes == null) {
callback.accept(Collections.emptyList());
} else {
final List<ContainerCategoryDTO> containerCategories = new ArrayList<>();
final List<ContainerDTO> containers = new ArrayList<>();
for (File winePrefix : winePrefixes) {
final ConfigFile configFile = compatibleConfigFileFormatFactory.open(new File(winePrefix, "phoenicis.cfg"));
final File userRegistryFile = new File(winePrefix, "user.reg");
containers.add(new WinePrefixContainerDTO.Builder().withName(winePrefix.getName()).withPath(winePrefix.getAbsolutePath()).withArchitecture(configFile.readValue("wineArchitecture", "")).withDistribution(configFile.readValue("wineDistribution", "")).withVersion(configFile.readValue("wineVersion", "")).withGlslValue(winePrefixContainerDisplayConfiguration.getGLSL(userRegistryFile)).withDirectDrawRenderer(winePrefixContainerDisplayConfiguration.getDirectDrawRenderer(userRegistryFile)).withVideoMemorySize(winePrefixContainerDisplayConfiguration.getVideoMemorySize(userRegistryFile)).withOffscreenRenderingMode(winePrefixContainerDisplayConfiguration.getOffscreenRenderingMode(userRegistryFile)).withMultisampling(winePrefixContainerDisplayConfiguration.getMultisampling(userRegistryFile)).withAlwaysOffscreen(winePrefixContainerDisplayConfiguration.getAlwaysOffscreen(userRegistryFile)).withStrictDrawOrdering(winePrefixContainerDisplayConfiguration.getStrictDrawOrdering(userRegistryFile)).withRenderTargetModeLock(winePrefixContainerDisplayConfiguration.getRenderTargetModeLock(userRegistryFile)).withMouseWarpOverride(winePrefixContainerInputConfiguration.getMouseWarpOverride(userRegistryFile)).build());
}
containers.sort(ContainerDTO.nameComparator());
containerCategories.add(new ContainerCategoryDTO.Builder().withName("Wine").withContainers(containers).build());
callback.accept(containerCategories);
}
}
use of org.phoenicis.containers.dto.ContainerCategoryDTO in project phoenicis by PhoenicisOrg.
the class GenericContainersManager method fetchContainers.
/**
* {@inheritDoc}
* @param callback
* @param errorCallback
*/
@Override
public void fetchContainers(Consumer<List<ContainerCategoryDTO>> callback, Consumer<Exception> errorCallback) {
final File containersFile = new File(containersPath);
containersFile.mkdirs();
final File[] engineDirectories = containersFile.listFiles();
if (engineDirectories == null) {
callback.accept(Collections.emptyList());
} else {
final List<ContainerCategoryDTO> containerCategories = new ArrayList<>();
for (File engineDirectory : engineDirectories) {
final List<ContainerDTO> containers = fetchContainers(engineDirectory);
if (!CollectionUtils.isEmpty(containers)) {
containerCategories.add(new ContainerCategoryDTO.Builder().withName(engineDirectory.getName()).withContainers(containers).build());
}
}
callback.accept(containerCategories);
}
}
use of org.phoenicis.containers.dto.ContainerCategoryDTO in project POL-POM-5 by PlayOnLinux.
the class ContainerSidebarSkin method createSidebarToggleGroup.
/**
* Creates a {@link ContainersSidebarToggleGroup} object containing all installed containers
*/
private ContainersSidebarToggleGroup createSidebarToggleGroup() {
final FilteredList<ContainerCategoryDTO> filteredContainerCategories = getControl().getItems().filtered(getControl().getFilter()::filter);
filteredContainerCategories.predicateProperty().bind(Bindings.createObjectBinding(() -> getControl().getFilter()::filter, getControl().searchTermProperty(), getControl().selectedContainerCategoryProperty()));
final ContainersSidebarToggleGroup sidebarToggleGroup = new ContainersSidebarToggleGroup(tr("Containers"), filteredContainerCategories);
getControl().selectedContainerCategoryProperty().bind(sidebarToggleGroup.selectedElementProperty());
return sidebarToggleGroup;
}
use of org.phoenicis.containers.dto.ContainerCategoryDTO in project POL-POM-5 by PlayOnLinux.
the class ContainersFeaturePanelSkin method createSidebar.
/**
* {@inheritDoc}
*/
@Override
public ObjectExpression<SidebarBase<?, ?, ?>> createSidebar() {
/*
* initialize the container categories by sorting them
*/
final SortedList<ContainerCategoryDTO> sortedCategories = getControl().getCategories().sorted(Comparator.comparing(ContainerCategoryDTO::getName));
final ContainerSidebar sidebar = new ContainerSidebar(getControl().getFilter(), sortedCategories, this.selectedListWidget);
// set the default selection
sidebar.setSelectedListWidget(Optional.ofNullable(getControl().getJavaFxSettingsManager()).map(JavaFxSettingsManager::getContainersListType).orElse(ListWidgetType.ICONS_LIST));
// save changes to the list widget selection to the hard drive
sidebar.selectedListWidgetProperty().addListener((observable, oldValue, newValue) -> {
final JavaFxSettingsManager javaFxSettingsManager = getControl().getJavaFxSettingsManager();
if (newValue != null) {
javaFxSettingsManager.setContainersListType(newValue);
javaFxSettingsManager.save();
}
});
return new SimpleObjectProperty<>(sidebar);
}
Aggregations