use of org.phoenicis.containers.dto.ContainerDTO in project POL-POM-5 by PlayOnLinux.
the class ContainersFeaturePanelSkin method createContainerInformationDetailsPanel.
private DetailsPanel createContainerInformationDetailsPanel(ContainerInformation action) {
final ContainerDTO container = action.getContainer();
final ContainerInformationPanel containerInformationPanel = new ContainerInformationPanel();
containerInformationPanel.setContainer(container);
containerInformationPanel.enginesManagerProperty().bind(getControl().enginesManagerProperty());
containerInformationPanel.verbsManagerProperty().bind(getControl().verbsManagerProperty());
containerInformationPanel.engineToolsManagerProperty().bind(getControl().engineToolsManagerProperty());
containerInformationPanel.setOnDeleteContainer(getControl()::deleteContainer);
containerInformationPanel.setOnChangeEngineVersion(getControl()::changeEngineVersion);
containerInformationPanel.setOnOpenFileBrowser(getControl()::openFileBrowser);
getControl().getEngineSettings().addListener((Observable invalidation) -> updateEngineSettings(containerInformationPanel));
getControl().getVerbs().addListener((Observable invalidation) -> updateVerbs(containerInformationPanel));
getControl().getEngineTools().addListener((Observable invalidation) -> updateEngineTools(containerInformationPanel));
updateEngineSettings(containerInformationPanel);
updateVerbs(containerInformationPanel);
updateEngineTools(containerInformationPanel);
final DetailsPanel containerDetailsPanel = new DetailsPanel();
containerDetailsPanel.setTitle(container.getName());
containerDetailsPanel.setContent(containerInformationPanel);
containerDetailsPanel.setOnClose(getControl()::closeDetailsPanel);
containerDetailsPanel.prefWidthProperty().bind(getControl().widthProperty().divide(3));
return containerDetailsPanel;
}
use of org.phoenicis.containers.dto.ContainerDTO in project POL-POM-5 by PlayOnLinux.
the class ContainersFeaturePanelSkin method updateEngineSettings.
/**
* Applies the engine settings belonging to the currently selected container to the given
* {@link ContainerInformationPanel}
*
* @param containerInformationPanel The information panel showing the details for the currently selected container
*/
private void updateEngineSettings(final ContainerInformationPanel containerInformationPanel) {
final ObservableMap<String, List<EngineSetting>> engineSettings = getControl().getEngineSettings();
final ContainerDTO container = containerInformationPanel.getContainer();
if (container != null && engineSettings.containsKey(container.getEngine().toLowerCase())) {
containerInformationPanel.getEngineSettings().setAll(engineSettings.get(container.getEngine().toLowerCase()));
} else {
containerInformationPanel.getEngineSettings().clear();
}
}
use of org.phoenicis.containers.dto.ContainerDTO 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.ContainerDTO in project POL-POM-5 by PhoenicisOrg.
the class WinePrefixContainerController method runInContainer.
public void runInContainer(ContainerDTO container, String command, Runnable doneCallback, Consumer<Exception> errorCallback) {
final InteractiveScriptSession interactiveScriptSession = scriptInterpreter.createInteractiveSession();
interactiveScriptSession.eval("include([\"Engines\", \"" + container.getEngine() + "\", \"Engine\", \"Object\"]);", ignored -> interactiveScriptSession.eval("new " + container.getEngine() + "()", output -> {
final ScriptObjectMirror wine = (ScriptObjectMirror) output;
wine.callMember("prefix", container.getName());
wine.callMember("run", command);
wine.callMember("wait");
doneCallback.run();
}, errorCallback), errorCallback);
}
use of org.phoenicis.containers.dto.ContainerDTO 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);
}
}
Aggregations