Search in sources :

Example 11 with ContainerDTO

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;
}
Also used : ContainerInformationPanel(org.phoenicis.javafx.components.container.control.ContainerInformationPanel) ContainerDTO(org.phoenicis.containers.dto.ContainerDTO) OpenDetailsPanel(org.phoenicis.javafx.components.common.panelstates.OpenDetailsPanel) DetailsPanel(org.phoenicis.javafx.components.common.control.DetailsPanel) Observable(javafx.beans.Observable)

Example 12 with ContainerDTO

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();
    }
}
Also used : MappedList(org.phoenicis.javafx.collections.MappedList) SortedList(javafx.collections.transformation.SortedList) FilteredList(javafx.collections.transformation.FilteredList) List(java.util.List) ObservableList(javafx.collections.ObservableList) ConcatenatedList(org.phoenicis.javafx.collections.ConcatenatedList) ContainerDTO(org.phoenicis.containers.dto.ContainerDTO)

Example 13 with ContainerDTO

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);
    }
}
Also used : ContainerCategoryDTO(org.phoenicis.containers.dto.ContainerCategoryDTO) ConfigFile(org.phoenicis.tools.config.ConfigFile) ArrayList(java.util.ArrayList) WinePrefixContainerDTO(org.phoenicis.containers.dto.WinePrefixContainerDTO) ContainerDTO(org.phoenicis.containers.dto.ContainerDTO) File(java.io.File) ConfigFile(org.phoenicis.tools.config.ConfigFile)

Example 14 with ContainerDTO

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);
}
Also used : Consumer(java.util.function.Consumer) RegistryWriter(org.phoenicis.win32.registry.RegistryWriter) RegistryParameter(org.phoenicis.containers.wine.parameters.RegistryParameter) Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) WinePrefixContainerDTO(org.phoenicis.containers.dto.WinePrefixContainerDTO) ScriptInterpreter(org.phoenicis.scripts.interpreter.ScriptInterpreter) ScriptObjectMirror(jdk.nashorn.api.scripting.ScriptObjectMirror) InteractiveScriptSession(org.phoenicis.scripts.interpreter.InteractiveScriptSession) ContainerDTO(org.phoenicis.containers.dto.ContainerDTO) ScriptObjectMirror(jdk.nashorn.api.scripting.ScriptObjectMirror) InteractiveScriptSession(org.phoenicis.scripts.interpreter.InteractiveScriptSession)

Example 15 with ContainerDTO

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);
    }
}
Also used : ContainerCategoryDTO(org.phoenicis.containers.dto.ContainerCategoryDTO) ArrayList(java.util.ArrayList) ContainerDTO(org.phoenicis.containers.dto.ContainerDTO) WinePrefixContainerDTO(org.phoenicis.containers.dto.WinePrefixContainerDTO) File(java.io.File) ConfigFile(org.phoenicis.tools.config.ConfigFile)

Aggregations

ContainerDTO (org.phoenicis.containers.dto.ContainerDTO)21 File (java.io.File)12 WinePrefixContainerDTO (org.phoenicis.containers.dto.WinePrefixContainerDTO)12 ContainerCategoryDTO (org.phoenicis.containers.dto.ContainerCategoryDTO)11 ArrayList (java.util.ArrayList)10 ConfigFile (org.phoenicis.tools.config.ConfigFile)10 List (java.util.List)9 Consumer (java.util.function.Consumer)8 ScriptInterpreter (org.phoenicis.scripts.interpreter.ScriptInterpreter)8 Logger (org.slf4j.Logger)8 LoggerFactory (org.slf4j.LoggerFactory)8 IOException (java.io.IOException)7 Collectors (java.util.stream.Collectors)7 TypeReference (com.fasterxml.jackson.core.type.TypeReference)6 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 Collections (java.util.Collections)6 Map (java.util.Map)6 ScriptObjectMirror (jdk.nashorn.api.scripting.ScriptObjectMirror)6 Safe (org.phoenicis.configuration.security.Safe)6 LibraryManager (org.phoenicis.library.LibraryManager)6