From b2be6f413a60f1990e9055a37206f605c39113b5 Mon Sep 17 00:00:00 2001 From: tobias <tobias.ullerich@icloud.com> Date: Tue, 9 Aug 2016 23:31:16 +0200 Subject: [PATCH] Start rewriting settings split into project, profile and global settings change cart action (mapping) unsing x and y (no longer id) --- .../view/option/{ => profile}/audioTab.fxml | 0 .../view/option/{ => profile}/generalTab.fxml | 0 .../view/option/{ => profile}/layoutTab.fxml | 0 .../view/option/{ => profile}/mapping.fxml | 0 .../view/option/{ => profile}/midiTab.fxml | 0 .../view/option/{ => profile}/playerTab.fxml | 0 .../option/{ => profile}/settingsView.fxml | 0 .../src/de/tobias/playpad/PlayPadImpl.java | 4 +- .../src/de/tobias/playpad/VersionUpdater.java | 226 +----------- .../playpad/action/cartaction/CartAction.java | 54 ++- .../action/connect/CartActionConnect.java | 12 +- .../action/connect/PageActionConnect.java | 6 +- .../DesktopMenuToolbarViewController.java | 22 +- .../touch/TouchMenuToolbarViewController.java | 7 +- .../pad/content/AudioContentConnect.java | 6 +- .../actions/CartActionsViewController.java | 28 +- .../viewcontroller/dialog/PrintDialog.java | 21 +- .../main/BasicMenuToolbarViewController.java | 7 + .../main/MainViewControllerV2.java | 42 ++- .../option/GeneralTabViewController.java | 345 ------------------ .../pad/DesignPadTabViewController.java | 2 +- .../{ => profile}/AudioTabViewController.java | 7 +- .../DesignTabViewController.java | 7 +- .../profile/GeneralTabViewController.java | 200 ++++++++++ .../MappingTabViewController.java | 7 +- .../{ => profile}/MidiTabViewController.java | 7 +- .../PlayerTabViewController.java | 7 +- .../{ => profile}/SettingsViewController.java | 24 +- .../project/GeneralTabViewController.java | 196 ++++++++++ .../ProjectSettingsViewController.java | 121 ++++++ .../tobias/playpad/action/ActionConnect.java | 2 + .../src/de/tobias/playpad/action/Mapping.java | 5 +- .../de/tobias/playpad/action/MappingList.java | 6 +- .../action/feedback/ColorAdjustable.java | 4 +- .../action/feedback/ColorAdjuster.java | 2 +- .../src/de/tobias/playpad/pad/Pad.java | 6 +- .../pad/conntent/PadContentConnect.java | 4 +- .../trigger}/PadTriggerContentListener.java | 2 +- .../trigger}/PadTriggerDurationListener.java | 2 +- .../trigger}/PadTriggerStatusListener.java | 2 +- .../de/tobias/playpad/project/Project.java | 36 +- .../playpad/project/ProjectSettings.java | 74 ++++ .../playpad/settings/ProfileSettings.java | 58 --- .../main/MenuToolbarViewController.java | 11 +- ...va => IProfileSettingsViewController.java} | 4 +- .../IProjectSettingsViewController.java | 20 + ... => ProfileSettingsTabViewController.java} | 4 +- .../ProjectSettingsTabViewController.java | 86 +++++ .../src/de/tobias/playpad/xml/XMLHandler.java | 9 + .../impl/MediaSettingsTabViewController.java | 4 +- .../video/VideoContentConntect.java | 4 +- 51 files changed, 936 insertions(+), 767 deletions(-) rename PlayWall/assets/de/tobias/playpad/assets/view/option/{ => profile}/audioTab.fxml (100%) rename PlayWall/assets/de/tobias/playpad/assets/view/option/{ => profile}/generalTab.fxml (100%) rename PlayWall/assets/de/tobias/playpad/assets/view/option/{ => profile}/layoutTab.fxml (100%) rename PlayWall/assets/de/tobias/playpad/assets/view/option/{ => profile}/mapping.fxml (100%) rename PlayWall/assets/de/tobias/playpad/assets/view/option/{ => profile}/midiTab.fxml (100%) rename PlayWall/assets/de/tobias/playpad/assets/view/option/{ => profile}/playerTab.fxml (100%) rename PlayWall/assets/de/tobias/playpad/assets/view/option/{ => profile}/settingsView.fxml (100%) delete mode 100644 PlayWall/src/de/tobias/playpad/viewcontroller/option/GeneralTabViewController.java rename PlayWall/src/de/tobias/playpad/viewcontroller/option/{ => profile}/AudioTabViewController.java (90%) rename PlayWall/src/de/tobias/playpad/viewcontroller/option/{ => profile}/DesignTabViewController.java (89%) create mode 100644 PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/GeneralTabViewController.java rename PlayWall/src/de/tobias/playpad/viewcontroller/option/{ => profile}/MappingTabViewController.java (94%) rename PlayWall/src/de/tobias/playpad/viewcontroller/option/{ => profile}/MidiTabViewController.java (91%) rename PlayWall/src/de/tobias/playpad/viewcontroller/option/{ => profile}/PlayerTabViewController.java (88%) rename PlayWall/src/de/tobias/playpad/viewcontroller/option/{ => profile}/SettingsViewController.java (82%) create mode 100644 PlayWall/src/de/tobias/playpad/viewcontroller/option/project/GeneralTabViewController.java create mode 100644 PlayWall/src/de/tobias/playpad/viewcontroller/option/project/ProjectSettingsViewController.java rename PlayWallCore/src/de/tobias/playpad/pad/{triggerlistener => listener/trigger}/PadTriggerContentListener.java (95%) rename PlayWallCore/src/de/tobias/playpad/pad/{triggerlistener => listener/trigger}/PadTriggerDurationListener.java (97%) rename PlayWallCore/src/de/tobias/playpad/pad/{triggerlistener => listener/trigger}/PadTriggerStatusListener.java (97%) create mode 100644 PlayWallCore/src/de/tobias/playpad/project/ProjectSettings.java rename PlayWallCore/src/de/tobias/playpad/viewcontroller/option/{ISettingsViewController.java => IProfileSettingsViewController.java} (65%) create mode 100644 PlayWallCore/src/de/tobias/playpad/viewcontroller/option/IProjectSettingsViewController.java rename PlayWallCore/src/de/tobias/playpad/viewcontroller/option/{SettingsTabViewController.java => ProfileSettingsTabViewController.java} (91%) create mode 100644 PlayWallCore/src/de/tobias/playpad/viewcontroller/option/ProjectSettingsTabViewController.java diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/option/audioTab.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/option/profile/audioTab.fxml similarity index 100% rename from PlayWall/assets/de/tobias/playpad/assets/view/option/audioTab.fxml rename to PlayWall/assets/de/tobias/playpad/assets/view/option/profile/audioTab.fxml diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/option/generalTab.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/option/profile/generalTab.fxml similarity index 100% rename from PlayWall/assets/de/tobias/playpad/assets/view/option/generalTab.fxml rename to PlayWall/assets/de/tobias/playpad/assets/view/option/profile/generalTab.fxml diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/option/layoutTab.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/option/profile/layoutTab.fxml similarity index 100% rename from PlayWall/assets/de/tobias/playpad/assets/view/option/layoutTab.fxml rename to PlayWall/assets/de/tobias/playpad/assets/view/option/profile/layoutTab.fxml diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/option/mapping.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/option/profile/mapping.fxml similarity index 100% rename from PlayWall/assets/de/tobias/playpad/assets/view/option/mapping.fxml rename to PlayWall/assets/de/tobias/playpad/assets/view/option/profile/mapping.fxml diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/option/midiTab.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/option/profile/midiTab.fxml similarity index 100% rename from PlayWall/assets/de/tobias/playpad/assets/view/option/midiTab.fxml rename to PlayWall/assets/de/tobias/playpad/assets/view/option/profile/midiTab.fxml diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/option/playerTab.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/option/profile/playerTab.fxml similarity index 100% rename from PlayWall/assets/de/tobias/playpad/assets/view/option/playerTab.fxml rename to PlayWall/assets/de/tobias/playpad/assets/view/option/profile/playerTab.fxml diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/option/settingsView.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/option/profile/settingsView.fxml similarity index 100% rename from PlayWall/assets/de/tobias/playpad/assets/view/option/settingsView.fxml rename to PlayWall/assets/de/tobias/playpad/assets/view/option/profile/settingsView.fxml diff --git a/PlayWall/src/de/tobias/playpad/PlayPadImpl.java b/PlayWall/src/de/tobias/playpad/PlayPadImpl.java index 1cf6ca0f..122153c9 100644 --- a/PlayWall/src/de/tobias/playpad/PlayPadImpl.java +++ b/PlayWall/src/de/tobias/playpad/PlayPadImpl.java @@ -22,7 +22,7 @@ import de.tobias.playpad.settings.GlobalSettings; import de.tobias.playpad.viewcontroller.IPadSettingsViewController; import de.tobias.playpad.viewcontroller.main.IMainViewController; import de.tobias.playpad.viewcontroller.main.MainViewControllerV2; -import de.tobias.playpad.viewcontroller.option.ISettingsViewController; +import de.tobias.playpad.viewcontroller.option.IProfileSettingsViewController; import de.tobias.utils.application.ApplicationUtils; import de.tobias.utils.application.container.PathType; import de.tobias.utils.util.Worker; @@ -35,7 +35,7 @@ public class PlayPadImpl implements PlayPad { private static final String PLUGIN_INFO_TXT = "pluginInfo.txt"; protected List<WindowListener<IMainViewController>> mainViewListeners = new ArrayList<>(); - protected List<WindowListener<ISettingsViewController>> settingsViewListeners = new ArrayList<>(); + protected List<WindowListener<IProfileSettingsViewController>> settingsViewListeners = new ArrayList<>(); protected List<WindowListener<IPadSettingsViewController>> padSettingsViewListeners = new ArrayList<>(); protected List<SettingsListener> settingsListeners = new ArrayList<>(); protected List<PadListener> padListeners = new ArrayList<>(); diff --git a/PlayWall/src/de/tobias/playpad/VersionUpdater.java b/PlayWall/src/de/tobias/playpad/VersionUpdater.java index 6cfb762b..6ad83209 100644 --- a/PlayWall/src/de/tobias/playpad/VersionUpdater.java +++ b/PlayWall/src/de/tobias/playpad/VersionUpdater.java @@ -1,237 +1,13 @@ package de.tobias.playpad; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.dom4j.Document; -import org.dom4j.DocumentException; -import org.dom4j.DocumentHelper; -import org.dom4j.Element; -import org.dom4j.io.OutputFormat; -import org.dom4j.io.SAXReader; -import org.dom4j.io.XMLWriter; - -import de.tobias.playpad.action.Mapping; -import de.tobias.playpad.action.MappingSerializer; -import de.tobias.playpad.action.cartaction.CartAction; -import de.tobias.playpad.action.cartaction.CartAction.ControlMode; -import de.tobias.playpad.action.mapper.MidiMapper; -import de.tobias.playpad.action.mapper.feedback.DoubleMidiFeedback; -import de.tobias.playpad.project.Project; -import de.tobias.playpad.project.ProjectReference; -import de.tobias.playpad.settings.ProfileReference; import de.tobias.utils.application.App; -import de.tobias.utils.application.ApplicationUtils; -import de.tobias.utils.application.container.PathType; import de.tobias.utils.application.update.UpdateService; public class VersionUpdater implements UpdateService { @Override public void update(App app, long oldVersion, long newVersion) { - update18(oldVersion); - update23(app, oldVersion); - } - - private void update23(App app, long oldVersion) { - if (oldVersion <= 23) { - Path configPath = app.getPath(PathType.CONFIGURATION); - SAXReader reader = new SAXReader(); - try { - Document document = reader.read(Files.newInputStream(configPath.resolve("Profiles.xml"))); - for (Object profileObj : document.getRootElement().elements("Profile")) { - if (profileObj instanceof Element) { - String name = ((Element) profileObj).getStringValue(); - System.out.println("Start Profile: " + name); - UUID uuid = UUID.randomUUID(); - - Path profileOldPath = app.getPath(PathType.CONFIGURATION, name); - Path profileNewPath = app.getPath(PathType.CONFIGURATION, uuid.toString()); - - Files.move(profileOldPath, profileNewPath); - - convertMidiToMapping(profileNewPath); - - ProfileReference profileReference = new ProfileReference(uuid, name); - ProfileReference.addProfile(profileReference); - System.out.println("Finish Profile: " + name + " (" + uuid + ")"); - } - } - } catch (DocumentException | IOException e1) { - e1.printStackTrace(); - } - - try { - Document document = reader.read(Files.newInputStream(configPath.resolve("Projects.xml"))); - for (Object projectObj : document.getRootElement().elements("Project")) { - if (projectObj instanceof Element) { - try { - String name = ((Element) projectObj).getStringValue(); - Path projectPath = app.getPath(PathType.DOCUMENTS, name); - System.out.println("Start Project: " + projectPath); - - UUID uuid = UUID.randomUUID(); - Path newProjectPath = ApplicationUtils.getApplication().getPath(PathType.DOCUMENTS, uuid + Project.FILE_EXTENSION); - - Files.move(projectPath, newProjectPath); - - ProjectReference projectReference = new ProjectReference(uuid, projectPath.getFileName().toString(), - ProfileReference.getProfiles().get(0)); - ProjectReference.addProject(projectReference); - - convertProject(newProjectPath); - System.out.println("End Project: " + projectPath + " (" + uuid + ")"); - } catch (DocumentException | URISyntaxException e) { - e.printStackTrace(); - } - } - } - } catch (IOException | DocumentException e) { - e.printStackTrace(); - } - try { - ProfileReference.saveProfiles(); - ProjectReference.saveProjects(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - private void update18(long oldVersion) { - if (oldVersion <= 18) { - SAXReader reader = new SAXReader(); - Path path = ApplicationUtils.getApplication().getPath(PathType.CONFIGURATION, "Profiles.xml"); - - try { - Document document = reader.read(Files.newInputStream(path)); - Element root = document.getRootElement(); - for (Object object : root.elements("Document")) { - Element element = (Element) object; - String name = element.getStringValue(); - - UUID uuid = UUID.randomUUID(); - - Path projectPath = ApplicationUtils.getApplication().getPath(PathType.DOCUMENTS, name); - Path newProjectPath = ApplicationUtils.getApplication().getPath(PathType.DOCUMENTS, uuid + Project.FILE_EXTENSION); - Files.createDirectories(newProjectPath.getParent()); - - Files.move(projectPath, newProjectPath); - - ProjectReference projectReference = new ProjectReference(uuid, name, ProfileReference.getProfiles().get(0)); - ProjectReference.addProject(projectReference); - - convertProject(newProjectPath); - } - - ProjectReference.saveProjects(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public void convertMidiToMapping(Path configPath) throws DocumentException, IOException { - SAXReader reader = new SAXReader(); - Document midiDocument = reader.read(Files.newInputStream(configPath.resolve("Midi.xml"))); - - List<Mapping> mappings = new ArrayList<>(); - - for (Object presetObj : midiDocument.getRootElement().elements("Preset")) { - Element presetElement = (Element) presetObj; - String name = presetElement.attributeValue("name"); - - Mapping mapping = new Mapping(false, null); - mapping.setName(name); - mapping.setUuid(UUID.randomUUID()); - - for (Object midiObj : presetElement.elements("Midi")) { - Element midiElement = (Element) midiObj; - int command = Integer.valueOf(midiElement.attributeValue("command")); - int key = Integer.valueOf(midiElement.attributeValue("channel")); - - if (midiElement.attributeValue("type") != null) { - if (midiElement.attributeValue("type").equals("de.tobias.playpad.model.midi.type.PlayStopActionType")) { - Element actionElement = midiElement.element("Action"); - if (actionElement.attributeValue("class").equals("de.tobias.playpad.model.midi.CartAction")) { - int cart = Integer.valueOf(actionElement.element("CartID").getStringValue()); - - CartAction action = new CartAction(cart, ControlMode.PLAY_STOP); - mapping.addActionIfNotContains(action); - - MidiMapper mapper = new MidiMapper(command, key); - action.addMapper(mapper); - - Element feedbackEventElement = actionElement.element("Feedback"); - Element feedbackDefaultElement = midiElement.element("Feedback"); - - int feedbackEvent = Integer.valueOf(feedbackEventElement.element("MidiVelocity").getStringValue()); - int feedbackDefault = Integer.valueOf(feedbackDefaultElement.element("MidiVelocity").getStringValue()); - - DoubleMidiFeedback doubleSimpleFeedback = new DoubleMidiFeedback(feedbackDefault, feedbackEvent); - mapper.setFeedback(doubleSimpleFeedback); - } - } - } - } - mappings.add(mapping); - } - - Document mappingDocument = DocumentHelper.createDocument(); - Element rootElement = mappingDocument.addElement("List"); - - for (Mapping mapping : mappings) { - Element mappingElement = rootElement.addElement("Mapping"); - - MappingSerializer mappingSerializer = new MappingSerializer(); - mappingSerializer.saveElement(mappingElement, mapping); - } - - XMLWriter writer = new XMLWriter(Files.newOutputStream(configPath.resolve("Mapping.xml")), OutputFormat.createPrettyPrint()); - writer.write(mappingDocument); - writer.close(); - - Files.delete(configPath.resolve("Midi.xml")); + } - public void convertProject(Path path) throws DocumentException, IOException, URISyntaxException { - SAXReader reader = new SAXReader(); - Document oldDocument = reader.read(Files.newInputStream(path)); - Document newDocument = DocumentHelper.createDocument(); - - Element newRootElement = newDocument.addElement("Project"); - - for (Object oldPadObj : oldDocument.getRootElement().elements("Pad")) { - try { - Element oldPadElement = (Element) oldPadObj; - Element newPadElement = newRootElement.addElement("Pad"); - - newPadElement.addAttribute("index", oldPadElement.attributeValue("index")); - newPadElement.addAttribute("name", oldPadElement.element("Title").getStringValue()); - newPadElement.addAttribute("status", oldPadElement.element("State").getStringValue()); - - String file = oldPadElement.element("Path").getStringValue(); - URI uri = new URI(file); - newPadElement.addElement("Content").addAttribute("type", "audio").addText(Paths.get(uri).toString()); - - Element newSettingsElement = newPadElement.addElement("Settings"); - newSettingsElement.addElement("Volume").addText(oldPadElement.element("Volume").getStringValue()); - newSettingsElement.addElement("Loop").addText(oldPadElement.element("Loop").getStringValue()); - if (oldPadElement.element("TimeMode") != null) - newSettingsElement.addElement("TimeMode").addText(oldPadElement.element("TimeMode").getStringValue()); - } catch (Exception e) { - } - } - - XMLWriter writer = new XMLWriter(Files.newOutputStream(path), OutputFormat.createPrettyPrint()); - writer.write(newDocument); - writer.close(); - } } diff --git a/PlayWall/src/de/tobias/playpad/action/cartaction/CartAction.java b/PlayWall/src/de/tobias/playpad/action/cartaction/CartAction.java index 4c3f5c71..b6cc56cd 100644 --- a/PlayWall/src/de/tobias/playpad/action/cartaction/CartAction.java +++ b/PlayWall/src/de/tobias/playpad/action/cartaction/CartAction.java @@ -27,7 +27,9 @@ public class CartAction extends Action implements ColorAdjustable { PLAY_HOLD; } - private int cart; + private int x; + private int y; + private ControlMode mode; private boolean autoFeedbackColors; @@ -37,23 +39,27 @@ public class CartAction extends Action implements ColorAdjustable { private transient PadPositionWarningListener padPositionListener = new PadPositionWarningListener(this); public CartAction() { - this.cart = 0; + this.x = 0; + this.y = 0; + this.mode = ControlMode.PLAY_STOP; this.autoFeedbackColors = true; } - public CartAction(int cart, ControlMode mode) { - this.cart = cart; + public CartAction(int x, int y, ControlMode mode) { + this.x = x; + this.y = y; + this.mode = mode; this.autoFeedbackColors = true; } - public int getCart() { - return cart; + public int getX() { + return x; } - public void setCart(int cart) { - this.cart = cart; + public int getY() { + return y; } public ControlMode getMode() { @@ -74,16 +80,20 @@ public class CartAction extends Action implements ColorAdjustable { } // Helper + @Override public Pad getPad() { return pad; } @Override public void initFeedback(Project project, IMainViewController controller) { - Pad pad = project.getPad(cart); - setPad(pad); - // init first feedback - padStatusFeedbackListener.changed(null, null, pad.getStatus()); + Pad pad = project.getPad(x, y, controller.getPage()); + + if (pad != null) { + setPad(pad); + // init first feedback + padStatusFeedbackListener.changed(null, null, pad.getStatus()); + } } @Override @@ -95,7 +105,7 @@ public class CartAction extends Action implements ColorAdjustable { public boolean equals(Object obj) { if (obj instanceof CartAction) { CartAction action2 = (CartAction) obj; - if (action2.cart == cart) { + if (action2.x == x && action2.y == y) { return true; } } @@ -109,7 +119,7 @@ public class CartAction extends Action implements ColorAdjustable { @Override public void performAction(InputType type, Project project, IMainViewController mainViewController) { - setPad(project.getPad(cart)); + setPad(project.getPad(x, y, mainViewController.getPage())); // wird nur ausgeführt, wenn das Pad ein Content hat und sichtbar in der GUI (Gilt für MIDI und Keyboard) if (pad.getContent() != null && pad.getContent().isPadLoaded() && pad.isPadVisible()) { @@ -163,20 +173,25 @@ public class CartAction extends Action implements ColorAdjustable { return FeedbackType.DOUBLE; } - private static final String CART_ID = "id"; + private static final String X_ATTR = "x"; + private static final String Y_ATTR = "y"; private static final String CONTROL_MDOE = "mode"; private static final String AUTO_FEEDBACK_COLORS = "autoColor"; @Override public void load(Element root) { - cart = Integer.valueOf(root.attributeValue(CART_ID)); + if (root.attributeValue(X_ATTR) != null) + x = Integer.valueOf(root.attributeValue(X_ATTR)); + if (root.attributeValue(Y_ATTR) != null) + y = Integer.valueOf(root.attributeValue(Y_ATTR)); mode = ControlMode.valueOf(root.attributeValue(CONTROL_MDOE)); autoFeedbackColors = Boolean.valueOf(root.attributeValue(AUTO_FEEDBACK_COLORS)); } @Override public void save(Element root) { - root.addAttribute(CART_ID, String.valueOf(cart)); + root.addAttribute(X_ATTR, String.valueOf(x)); + root.addAttribute(Y_ATTR, String.valueOf(y)); root.addAttribute(CONTROL_MDOE, mode.name()); root.addAttribute(AUTO_FEEDBACK_COLORS, String.valueOf(autoFeedbackColors)); } @@ -227,7 +242,8 @@ public class CartAction extends Action implements ColorAdjustable { CartAction action = (CartAction) super.clone(); action.autoFeedbackColors = autoFeedbackColors; - action.cart = cart; + action.x = x; + action.y = y; action.mode = mode; return action; @@ -236,7 +252,7 @@ public class CartAction extends Action implements ColorAdjustable { // UI Helper @Override public String toString() { - return Localization.getString(Strings.Action_Cart_toString, String.valueOf(cart + 1)); + return Localization.getString(Strings.Action_Cart_toString, String.valueOf(x) + ", " + String.valueOf(y)); } @Override diff --git a/PlayWall/src/de/tobias/playpad/action/connect/CartActionConnect.java b/PlayWall/src/de/tobias/playpad/action/connect/CartActionConnect.java index 6ceffddd..b8936b0f 100644 --- a/PlayWall/src/de/tobias/playpad/action/connect/CartActionConnect.java +++ b/PlayWall/src/de/tobias/playpad/action/connect/CartActionConnect.java @@ -10,8 +10,8 @@ import de.tobias.playpad.action.ActionType; import de.tobias.playpad.action.Mapping; import de.tobias.playpad.action.cartaction.CartAction; import de.tobias.playpad.action.cartaction.CartAction.ControlMode; +import de.tobias.playpad.project.ProjectSettings; import de.tobias.playpad.settings.Profile; -import de.tobias.playpad.settings.ProfileSettings; import de.tobias.playpad.viewcontroller.IMappingTabViewController; import de.tobias.playpad.viewcontroller.actions.CartActionsViewController; import de.tobias.utils.ui.ContentViewController; @@ -35,12 +35,12 @@ public class CartActionConnect extends ActionConnect implements ActionDisplayabl @Override public void initActionType(Mapping mapping, Profile profile) { - ProfileSettings profileSettings = profile.getProfileSettings(); - int pads = profileSettings.getColumns() * profileSettings.getRows() * profileSettings.getPageCount(); + for (int x = 0; x < ProjectSettings.MAX_COLUMNS; x++) { + for (int y = 0; y < ProjectSettings.MAX_ROWS; y++) { + CartAction action = new CartAction(x, y, ControlMode.PLAY_STOP); + mapping.addActionIfNotContains(action); + } - for (int i = 0; i < pads; i++) { - CartAction action = new CartAction(i, ControlMode.PLAY_STOP); - mapping.addActionIfNotContains(action); } } diff --git a/PlayWall/src/de/tobias/playpad/action/connect/PageActionConnect.java b/PlayWall/src/de/tobias/playpad/action/connect/PageActionConnect.java index 7323dca2..982f9799 100644 --- a/PlayWall/src/de/tobias/playpad/action/connect/PageActionConnect.java +++ b/PlayWall/src/de/tobias/playpad/action/connect/PageActionConnect.java @@ -10,8 +10,8 @@ import de.tobias.playpad.action.ActionDisplayable; import de.tobias.playpad.action.ActionType; import de.tobias.playpad.action.Mapping; import de.tobias.playpad.action.actions.PageAction; +import de.tobias.playpad.project.ProjectSettings; import de.tobias.playpad.settings.Profile; -import de.tobias.playpad.settings.ProfileSettings; import de.tobias.utils.ui.ContentViewController; import de.tobias.utils.ui.icon.FontAwesomeType; import de.tobias.utils.ui.icon.FontIcon; @@ -50,9 +50,7 @@ public class PageActionConnect extends ActionConnect implements ActionDisplayabl @Override public void initActionType(Mapping mapping, Profile profile) { - ProfileSettings profileSettings = profile.getProfileSettings(); - int pages = profileSettings.getPageCount(); - for (int i = 0; i < pages; i++) { + for (int i = 0; i < ProjectSettings.MAX_PAGES; i++) { PageAction action = new PageAction(i); mapping.addActionIfNotContains(action); } diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java index 8ee475ff..442bc599 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java @@ -40,9 +40,9 @@ import de.tobias.playpad.viewcontroller.dialog.ProjectManagerDialog; import de.tobias.playpad.viewcontroller.main.BasicMenuToolbarViewController; import de.tobias.playpad.viewcontroller.main.IMainViewController; import de.tobias.playpad.viewcontroller.option.GlobalSettingsTabViewController; -import de.tobias.playpad.viewcontroller.option.SettingsTabViewController; -import de.tobias.playpad.viewcontroller.option.SettingsViewController; +import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController; import de.tobias.playpad.viewcontroller.option.global.GlobalSettingsViewController; +import de.tobias.playpad.viewcontroller.option.profile.SettingsViewController; import de.tobias.playpad.viewcontroller.pad.PadDragListener; import de.tobias.utils.application.ApplicationInfo; import de.tobias.utils.application.ApplicationUtils; @@ -169,13 +169,22 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro }); } + @Override + public void setOpenProject(Project project) { + super.setOpenProject(project); + if (project != null) + createRecentDocumentMenuItems(); + } + @Override public void initPageButtons() { pageHBox.getChildren().clear(); - ProfileSettings settings = Profile.currentProfile().getProfileSettings(); + if (openProject == null) { + return; + } - for (int i = 0; i < settings.getPageCount(); i++) { + for (int i = 0; i < openProject.getSettings().getPageCount(); i++) { Button button = new Button(Localization.getString(Strings.UI_Window_Main_PageButton, (i + 1))); button.setUserData(i); button.setFocusTraversable(false); @@ -467,7 +476,7 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro midi.setListener(mainViewController.getMidiHandler()); boolean change = false; - for (SettingsTabViewController controller : settingsViewController.getTabs()) { + for (ProfileSettingsTabViewController controller : settingsViewController.getTabs()) { if (controller.needReload()) { change = true; controller.reload(Profile.currentProfile(), currentProject, mainViewController); @@ -599,8 +608,7 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro public void createRecentDocumentMenuItems() { recentOpenMenu.getItems().clear(); - Project currentProject = PlayPadMain.getProgramInstance().getCurrentProject(); - String project = currentProject.getRef().getName(); + String project = openProject.getRef().getName(); ProjectReference.getProjectsSorted().stream().filter(item -> !item.getName().equals(project)).limit(LAST_DOCUMENT_LIMIT).forEach(item -> { diff --git a/PlayWall/src/de/tobias/playpad/layout/touch/TouchMenuToolbarViewController.java b/PlayWall/src/de/tobias/playpad/layout/touch/TouchMenuToolbarViewController.java index ead8c3dd..214f5b3e 100644 --- a/PlayWall/src/de/tobias/playpad/layout/touch/TouchMenuToolbarViewController.java +++ b/PlayWall/src/de/tobias/playpad/layout/touch/TouchMenuToolbarViewController.java @@ -4,7 +4,6 @@ import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.Strings; import de.tobias.playpad.settings.Profile; -import de.tobias.playpad.settings.ProfileSettings; import de.tobias.playpad.settings.keys.KeyCollection; import de.tobias.playpad.view.main.MainLayoutConnect; import de.tobias.playpad.view.main.MenuType; @@ -51,9 +50,11 @@ public class TouchMenuToolbarViewController extends BasicMenuToolbarViewControll public void initPageButtons() { pageHBox.getChildren().clear(); - ProfileSettings settings = Profile.currentProfile().getProfileSettings(); + if (openProject == null) { + return; + } - for (int i = 0; i < settings.getPageCount(); i++) { + for (int i = 0; i < openProject.getSettings().getPageCount(); i++) { Button button = new Button(Localization.getString(Strings.UI_Window_Main_PageButton, (i + 1))); button.setUserData(i); button.setFocusTraversable(false); diff --git a/PlayWall/src/de/tobias/playpad/pad/content/AudioContentConnect.java b/PlayWall/src/de/tobias/playpad/pad/content/AudioContentConnect.java index 61451e40..538d4d41 100644 --- a/PlayWall/src/de/tobias/playpad/pad/content/AudioContentConnect.java +++ b/PlayWall/src/de/tobias/playpad/pad/content/AudioContentConnect.java @@ -5,8 +5,8 @@ import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.pad.conntent.PadContentConnect; import de.tobias.playpad.pad.view.IPadContentView; -import de.tobias.playpad.viewcontroller.option.AudioTabViewController; -import de.tobias.playpad.viewcontroller.option.SettingsTabViewController; +import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController; +import de.tobias.playpad.viewcontroller.option.profile.AudioTabViewController; import de.tobias.utils.ui.icon.FontAwesomeType; import de.tobias.utils.ui.icon.FontIcon; import de.tobias.utils.util.Localization; @@ -59,7 +59,7 @@ public class AudioContentConnect extends PadContentConnect { } @Override - public SettingsTabViewController getSettingsTabViewController(boolean activePlayer) { + public ProfileSettingsTabViewController getSettingsTabViewController(boolean activePlayer) { return new AudioTabViewController(activePlayer); } diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/actions/CartActionsViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/actions/CartActionsViewController.java index 6b559d47..1df903b3 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/actions/CartActionsViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/actions/CartActionsViewController.java @@ -9,8 +9,8 @@ import de.tobias.playpad.Strings; import de.tobias.playpad.action.Mapping; import de.tobias.playpad.action.cartaction.CartAction; import de.tobias.playpad.action.connect.CartActionConnect; -import de.tobias.playpad.settings.Profile; -import de.tobias.playpad.settings.ProfileSettings; +import de.tobias.playpad.project.Project; +import de.tobias.playpad.project.ProjectSettings; import de.tobias.playpad.viewcontroller.IMappingTabViewController; import de.tobias.utils.ui.ContentViewController; import de.tobias.utils.util.Localization; @@ -51,7 +51,8 @@ public class CartActionsViewController extends ContentViewController { this.mapping = mapping; this.parentController = parentController; - ProfileSettings settings = Profile.currentProfile().getProfileSettings(); + Project currentProject = PlayPadMain.getProgramInstance().getCurrentProject(); + ProjectSettings settings = currentProject.getSettings(); showCartButtons(settings, 0); VBox.setVgrow(gridPane, Priority.ALWAYS); @@ -62,7 +63,7 @@ public class CartActionsViewController extends ContentViewController { button.setOnAction(e -> { int page = Integer.valueOf(((ToggleButton) e.getSource()).getUserData().toString()); - showCartButtons(Profile.currentProfile().getProfileSettings(), page); + showCartButtons(settings, page); }); button.setUserData(i); segmentedButton.getButtons().add(button); @@ -77,7 +78,7 @@ public class CartActionsViewController extends ContentViewController { buttonVbox.minHeightProperty().bind(buttonVbox.heightProperty()); } - private void showCartButtons(ProfileSettings settings, int page) { + private void showCartButtons(ProjectSettings settings, int page) { gridPane.getChildren().clear(); gridPane.getColumnConstraints().clear(); @@ -98,25 +99,26 @@ public class CartActionsViewController extends ContentViewController { cartsToggle = new ToggleGroup(); - int startValue = (page * settings.getColumns() * settings.getRows()); + int index = 0; - for (int x = 0; x < settings.getColumns(); x++) { - for (int y = 0; y < settings.getRows(); y++) { - int index = (settings.getColumns() * y + x) + startValue; - ToggleButton button = new ToggleButton(String.valueOf(index + 1)); + for (int y = 0; y < settings.getRows(); y++) { + for (int x = 0; x < settings.getColumns(); x++) { + ToggleButton button = new ToggleButton(String.valueOf(index++ + 1)); button.setMaxWidth(Double.MAX_VALUE); - button.setUserData(index); + button.setUserData(new int[] { x, y }); button.getStyleClass().add(SegmentedButton.STYLE_CLASS_DARK); // Show the right cart settings button.selectedProperty().addListener((a, b, c) -> { if (c) { - int id = Integer.valueOf(button.getUserData().toString()); + int[] data = (int[]) button.getUserData(); + int currentX = data[0]; + int currentY = data[1]; List<CartAction> cartActions = mapping.getActions(CartActionConnect.TYPE); for (CartAction action : cartActions) { - if (action.getCart() == id) { + if (action.getX() == currentX && action.getY() == currentY) { ContentViewController actionViewController = action.getSettingsViewController(); cartActionContainer.getChildren().setAll(actionViewController.getParent()); cartActionContainer.setVisible(true); diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/PrintDialog.java b/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/PrintDialog.java index 25185126..71d6ca63 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/PrintDialog.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/PrintDialog.java @@ -12,8 +12,8 @@ import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.Strings; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.project.Project; +import de.tobias.playpad.project.ProjectSettings; import de.tobias.playpad.settings.Profile; -import de.tobias.playpad.settings.ProfileSettings; import de.tobias.utils.application.ApplicationUtils; import de.tobias.utils.ui.ViewController; import de.tobias.utils.util.Localization; @@ -45,6 +45,10 @@ public class PrintDialog extends ViewController { super("printDialog", "de/tobias/playpad/assets/dialog/project/", null, PlayPadMain.getUiResourceBundle()); this.project = project; + int pages = project.getSettings().getPageCount(); + for (int i = 0; i < pages; i++) { + pageComboBox.getItems().add(i + 1); + } pageComboBox.getSelectionModel().selectFirst(); getStage().initOwner(owner); @@ -52,11 +56,6 @@ public class PrintDialog extends ViewController { @Override public void init() { - int pages = Profile.currentProfile().getProfileSettings().getPageCount(); - for (int i = 0; i < pages; i++) { - pageComboBox.getItems().add(i + 1); - } - pageComboBox.getSelectionModel().selectedItemProperty().addListener((a, b, c) -> { createPreview(c - 1); @@ -91,16 +90,16 @@ public class PrintDialog extends ViewController { Table table = new Table(); table.setStyle("border:1px solid black;border-collapse:collapse;"); - ProfileSettings profilSettings = Profile.currentProfile().getProfileSettings(); - int i = page * profilSettings.getRows() * profilSettings.getColumns(); + ProjectSettings settings = project.getSettings(); + int i = page * settings.getRows() * settings.getColumns(); - for (int y = 0; y < profilSettings.getRows(); y++) { + for (int y = 0; y < settings.getRows(); y++) { Tr tr = new Tr(); table.appendChild(tr); - for (int x = 0; x < profilSettings.getColumns(); x++) { + for (int x = 0; x < settings.getColumns(); x++) { Td td = new Td(); - td.setStyle("border:1px solid black; width: " + 1000 / (float) profilSettings.getColumns() + td.setStyle("border:1px solid black; width: " + 1000 / (float) settings.getColumns() + "px; padding: 5px; vertical-align: center; text-align: center; min-height: 30px; min-width: 100px;"); Div div = new Div(); div.setStyle("word-break: break-all; white-space: normal;"); diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/main/BasicMenuToolbarViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/main/BasicMenuToolbarViewController.java index b8dc9a9b..04fbb3fd 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/main/BasicMenuToolbarViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/main/BasicMenuToolbarViewController.java @@ -32,6 +32,8 @@ public abstract class BasicMenuToolbarViewController extends MenuToolbarViewCont @FXML protected Slider volumeSlider; @FXML protected Label volumeDownLabel; + protected Project openProject; // REFERENCE zu MainViewController + // window references private IMainViewController mainViewController; @@ -72,4 +74,9 @@ public abstract class BasicMenuToolbarViewController extends MenuToolbarViewCont } } } + + @Override + public void setOpenProject(Project project) { + this.openProject = project; + } } diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewControllerV2.java b/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewControllerV2.java index 602e24ce..0025fa6d 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewControllerV2.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewControllerV2.java @@ -21,6 +21,7 @@ import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.view.IPadViewV2; import de.tobias.playpad.plugin.WindowListener; import de.tobias.playpad.project.Project; +import de.tobias.playpad.project.ProjectSettings; import de.tobias.playpad.registry.DefaultRegistry; import de.tobias.playpad.registry.NoSuchComponentException; import de.tobias.playpad.settings.GlobalSettings; @@ -386,6 +387,9 @@ public class MainViewControllerV2 extends ViewController implements IMainViewCon keyboardHandler.setProject(project); PadDragListener.setProject(project); + menuToolbarViewController.setOpenProject(openProject); + + createPadViews(); showPage(FIRST_PAGE); loadUserCss(); updateWindowTitle(); @@ -394,20 +398,23 @@ public class MainViewControllerV2 extends ViewController implements IMainViewCon // Pad, Pages @Override public void createPadViews() { - ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings(); + if (openProject == null) { + return; + } + ProjectSettings projectSettings = openProject.getSettings(); // Table padGridPane.getColumnConstraints().clear(); - double xPercentage = 1.0 / (double) profileSettings.getColumns(); - for (int i = 0; i < profileSettings.getColumns(); i++) { + double xPercentage = 1.0 / (double) projectSettings.getColumns(); + for (int i = 0; i < projectSettings.getColumns(); i++) { ColumnConstraints c = new ColumnConstraints(); c.setPercentWidth(xPercentage * 100); padGridPane.getColumnConstraints().add(c); } padGridPane.getRowConstraints().clear(); - double yPercentage = 1.0 / (double) profileSettings.getRows(); - for (int i = 0; i < profileSettings.getRows(); i++) { + double yPercentage = 1.0 / (double) projectSettings.getRows(); + for (int i = 0; i < projectSettings.getRows(); i++) { RowConstraints c = new RowConstraints(); c.setPercentHeight(yPercentage * 100); padGridPane.getRowConstraints().add(c); @@ -418,8 +425,8 @@ public class MainViewControllerV2 extends ViewController implements IMainViewCon removePadViews(); // Neue PadViews - for (int y = 0; y < profileSettings.getRows(); y++) { - for (int x = 0; x < profileSettings.getColumns(); x++) { + for (int y = 0; y < projectSettings.getRows(); y++) { + for (int x = 0; x < projectSettings.getColumns(); x++) { IPadViewV2 padView = mainLayout.createPadView(); padGridPane.add(padView.getRootNode(), x, y); padViews.add(padView); @@ -428,8 +435,8 @@ public class MainViewControllerV2 extends ViewController implements IMainViewCon // Min Size of window GlobalDesign currentLayout = Profile.currentProfile().currentLayout(); - double minWidth = currentLayout.getMinWidth(profileSettings.getColumns()); - double minHeight = currentLayout.getMinHeight(profileSettings.getRows()); + double minWidth = currentLayout.getMinWidth(projectSettings.getColumns()); + double minHeight = currentLayout.getMinHeight(projectSettings.getRows()); getStage().setMinWidth(minWidth); if (OS.getType() == OSType.MacOSX) { @@ -454,7 +461,7 @@ public class MainViewControllerV2 extends ViewController implements IMainViewCon * Zeigt die aktuellen Pads von einem Profil zu einer Seite in den entsprechenden Views an. */ private void addPadsToView() { - ProfileSettings settings = Profile.currentProfile().getProfileSettings(); + ProjectSettings settings = openProject.getSettings(); int index = currentPageShowing * settings.getRows() * settings.getColumns(); for (int i = 0; i < settings.getRows() * settings.getColumns(); i++) { @@ -480,20 +487,19 @@ public class MainViewControllerV2 extends ViewController implements IMainViewCon @Override public boolean showPage(int page) { - Profile profile = Profile.currentProfile(); - if (page < 0 || page >= profile.getProfileSettings().getPageCount()) { + if (openProject == null) { + return false; + } + ProjectSettings projectSettings = openProject.getSettings(); + + if (page < 0 || page >= projectSettings.getPageCount()) { return false; } // Clean removePadsFromView(); - this.currentPageShowing = page; - - if (openProject != null) { - // New - addPadsToView(); - } + addPadsToView(); if (menuToolbarViewController != null) { menuToolbarViewController.highlightPageButton(page); diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/GeneralTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/GeneralTabViewController.java deleted file mode 100644 index 594a1e1f..00000000 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/GeneralTabViewController.java +++ /dev/null @@ -1,345 +0,0 @@ -package de.tobias.playpad.viewcontroller.option; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import de.tobias.playpad.PlayPadMain; -import de.tobias.playpad.PseudoClasses; -import de.tobias.playpad.Strings; -import de.tobias.playpad.design.GlobalDesign; -import de.tobias.playpad.project.Project; -import de.tobias.playpad.settings.Profile; -import de.tobias.playpad.settings.ProfileSettings; -import de.tobias.playpad.viewcontroller.main.IMainViewController; -import de.tobias.utils.application.ApplicationUtils; -import de.tobias.utils.application.container.PathType; -import de.tobias.utils.ui.ViewController; -import de.tobias.utils.util.Localization; -import de.tobias.utils.util.NumberUtils; -import de.tobias.utils.util.Worker; -import javafx.application.Platform; -import javafx.event.ActionEvent; -import javafx.fxml.FXML; -import javafx.scene.control.Alert; -import javafx.scene.control.Alert.AlertType; -import javafx.scene.control.CheckBox; -import javafx.scene.control.Label; -import javafx.scene.control.RadioButton; -import javafx.scene.control.TextField; -import javafx.scene.control.ToggleGroup; -import javafx.stage.DirectoryChooser; -import javafx.stage.Modality; -import javafx.stage.Screen; -import javafx.stage.Stage; - -public class GeneralTabViewController extends SettingsTabViewController { - - private static final String DIGIT_POSITIV = "^[1-9]\\d*$"; - - private Screen mainWindowScreen; - private ViewController parentController; // Für Benachrichtungen - - @FXML private TextField pageCountTextField; - @FXML private TextField columnTextField; - @FXML private TextField rowTextField; - - @FXML private CheckBox liveModeCheckBox; - - @FXML private TextField cacheTextField; - @FXML private Label cacheSizeLabel; - - @FXML private RadioButton pageEnable; - @FXML private RadioButton pageDisable; - @FXML private ToggleGroup pageGroup; - @FXML private RadioButton dragEnable; - @FXML private RadioButton dragDisable; - @FXML private ToggleGroup dragGroup; - @FXML private RadioButton fileEnable; - @FXML private RadioButton fileDisable; - @FXML private ToggleGroup fileGroup; - @FXML private RadioButton settingsEnable; - @FXML private RadioButton settingsDisable; - @FXML private ToggleGroup settingsGroup; - - private boolean changeSettings; - - public GeneralTabViewController(Screen currentScreen, ViewController parentController, boolean activePlayer) { - super("generalTab", "de/tobias/playpad/assets/view/option/", PlayPadMain.getUiResourceBundle()); - this.mainWindowScreen = currentScreen; - this.parentController = parentController; - - if (activePlayer) { - rowTextField.setDisable(true); - columnTextField.setDisable(true); - pageCountTextField.setDisable(true); - } - calcCacheSize(); - } - - @Override - public void init() { - pageCountTextField.textProperty().addListener((a, b, c) -> - { - if (c.matches(DIGIT_POSITIV) && !c.isEmpty()) { - int number = Integer.valueOf(c); - if (number > ProfileSettings.MAX_PAGES) { - pageCountTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); // Zahl zu groß - } else { - pageCountTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, false); // Zahl ok - } - } else { - pageCountTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); // Negativ oder leer - } - }); - - columnTextField.textProperty().addListener((a, b, c) -> - { - if (c.matches(DIGIT_POSITIV) && !c.isEmpty()) { - if (screenValid()) { - columnTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, false); // Zahl ok - } else { - columnTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); // Zahl zu groß - } - } else { - columnTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); // Negativ oder leer - } - }); - - rowTextField.textProperty().addListener((a, b, c) -> - { - if (c.matches(DIGIT_POSITIV) && !c.isEmpty()) { - if (screenValid()) { - rowTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, false); // Zahl ok - } else { - rowTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); // Zahl zu groß - } - } else { - rowTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); // Negativ oder leer - } - }); - - pageGroup = new ToggleGroup(); - pageGroup.getToggles().addAll(pageEnable, pageDisable); - dragGroup = new ToggleGroup(); - dragGroup.getToggles().addAll(dragEnable, dragDisable); - fileGroup = new ToggleGroup(); - fileGroup.getToggles().addAll(fileEnable, fileDisable); - settingsGroup = new ToggleGroup(); - settingsGroup.getToggles().addAll(settingsEnable, settingsDisable); - - liveModeCheckBox.selectedProperty().addListener((a, b, c) -> - { - disableLiveSettings(c); - }); - } - - private void disableLiveSettings(Boolean enableLiveSettings) { - pageEnable.setDisable(!enableLiveSettings); - pageDisable.setDisable(!enableLiveSettings); - dragEnable.setDisable(!enableLiveSettings); - dragDisable.setDisable(!enableLiveSettings); - fileEnable.setDisable(!enableLiveSettings); - fileDisable.setDisable(!enableLiveSettings); - settingsEnable.setDisable(!enableLiveSettings); - settingsDisable.setDisable(!enableLiveSettings); - } - - @FXML - private void cacheChooseHandler(ActionEvent event) { - DirectoryChooser chooser = new DirectoryChooser(); - File folder = chooser.showDialog(getStage()); - if (folder != null) { - Path folderPath = folder.toPath(); - Profile.currentProfile().getProfileSettings().setCachePath(folderPath); - cacheTextField.setText(folderPath.toString()); - } - } - - @FXML - private void cacheResetButtonHandler(ActionEvent event) { - try { - int deleteFiles = 0; - for (Path path : Files.newDirectoryStream(ApplicationUtils.getApplication().getPath(PathType.CACHE))) { - if (Files.isRegularFile(path)) { - try { - Files.delete(path); - deleteFiles++; - } catch (Exception e) { - e.printStackTrace(); - } - } - } - parentController.showInfoMessage(Localization.getString(Strings.Info_Settings_CacheDelete, deleteFiles), - PlayPadMain.stageIcon.get()); - - calcCacheSize(); - } catch (IOException e) { - e.printStackTrace(); - showErrorMessage(Localization.getString(Strings.Error_Settings_CacheClear, e.getLocalizedMessage())); - } - } - - @FXML - private void resetDialogs(ActionEvent event) { - parentController.showInfoMessage(Localization.getString(Strings.Info_Settings_ResetWarning)); - } - - private void calcCacheSize() { - try { - double size = 0; - Path path = Profile.currentProfile().getProfileSettings().getCachePath(); - if (Files.notExists(path)) - Files.createDirectories(path); - - for (Path item : Files.newDirectoryStream(Profile.currentProfile().getProfileSettings().getCachePath())) { - size += Files.size(item); - } - cacheSizeLabel.setText(Localization.getString(Strings.UI_Window_Settings_Gen_CacheSize, NumberUtils.numberToString(size))); - } catch (IOException e) { - e.printStackTrace(); - parentController.showErrorMessage(Localization.getString(Strings.Error_Settings_CacheSize, e.getMessage()), PlayPadMain.stageIcon); - } - } - - private boolean screenValid() { - double width = mainWindowScreen.getVisualBounds().getMaxX() - mainWindowScreen.getVisualBounds().getMinX(); - double height = mainWindowScreen.getVisualBounds().getMaxY() - mainWindowScreen.getVisualBounds().getMinY(); - - GlobalDesign layout = Profile.currentProfile().currentLayout(); - - try { - double neededWidth = layout.getMinWidth(Integer.valueOf(columnTextField.getText())); - double neededHeight = layout.getMinHeight(Integer.valueOf(rowTextField.getText())) + 100; - - if (neededHeight <= height && neededWidth <= width) - return true; - } catch (NumberFormatException e) {} - return false; - } - - @Override - public void loadSettings(Profile profile) { - ProfileSettings profileSettings = profile.getProfileSettings(); - - pageCountTextField.setText(String.valueOf(profileSettings.getPageCount())); - columnTextField.setText(String.valueOf(profileSettings.getColumns())); - rowTextField.setText(String.valueOf(profileSettings.getRows())); - - liveModeCheckBox.setSelected(profileSettings.isLiveMode()); - cacheTextField.setText(profileSettings.getCachePath().toString()); - - if (screenValid()) { - columnTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, false); - rowTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, false); - } else { - columnTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); - rowTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); - } - - if (profileSettings.isLiveModePage() == true) - pageEnable.setSelected(true); - else - pageDisable.setSelected(true); - - if (profileSettings.isLiveModeDrag() == true) - dragEnable.setSelected(true); - else - dragDisable.setSelected(true); - - if (profileSettings.isLiveModeFile() == true) - fileEnable.setSelected(true); - else - fileDisable.setSelected(true); - - if (profileSettings.isLiveModeSettings() == true) - settingsEnable.setSelected(true); - else - settingsDisable.setSelected(true); - - disableLiveSettings(profileSettings.isLiveMode()); - } - - @Override - public void saveSettings(Profile profile) { - ProfileSettings profileSettings = profile.getProfileSettings(); - - int columns = Integer.valueOf(columnTextField.getText()); - int rows = Integer.valueOf(rowTextField.getText()); - int pageCount = Integer.valueOf(pageCountTextField.getText()); - - if (profileSettings.getColumns() != columns || profileSettings.getRows() != rows || profileSettings.getPageCount() != pageCount) - changeSettings = true; - else - changeSettings = false; - - // Copy Settings - profileSettings.setColumns(columns); - profileSettings.setRows(rows); - profileSettings.setPageCount(pageCount); - - profileSettings.setLiveMode(liveModeCheckBox.isSelected()); - profileSettings.setCachePath(Paths.get(cacheTextField.getText())); - - profileSettings.setLiveModePage(pageEnable.isSelected()); - profileSettings.setLiveModeDrag(dragEnable.isSelected()); - profileSettings.setLiveModeFile(fileEnable.isSelected()); - profileSettings.setLiveModeSettings(settingsEnable.isSelected()); - } - - @Override - public boolean needReload() { - return changeSettings; - } - - @Override - public void reload(Profile profile, Project project, IMainViewController controller) { - Alert alert = new Alert(AlertType.INFORMATION); - alert.setContentText(Localization.getString(Strings.UI_Window_Settings_Gen_Wait)); - - alert.getButtonTypes().clear(); - alert.initOwner(controller.getStage()); - alert.initModality(Modality.WINDOW_MODAL); - Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); - PlayPadMain.stageIcon.ifPresent(stage.getIcons()::add); - - alert.show(); - - Worker.runLater(() -> - { - Platform.runLater(() -> - { - controller.getMenuToolbarController().initPageButtons(); - controller.createPadViews(); - controller.showPage(controller.getPage()); - stage.close(); - }); - }); - - } - - @Override - public boolean validSettings() { - if (screenValid()) { - return true; - } else { - double width = mainWindowScreen.getVisualBounds().getMaxX() - mainWindowScreen.getVisualBounds().getMinX(); - double height = mainWindowScreen.getVisualBounds().getMaxY() - mainWindowScreen.getVisualBounds().getMinY(); - - GlobalDesign globalLayout = Profile.currentProfile().currentLayout(); - - int maxCartsX = (int) (width / globalLayout.getPadWidth()); - int maxCartsY = (int) ((height - 100) / globalLayout.getPadHeight()); - parentController.showErrorMessage(Localization.getString(Strings.Error_Profile_SmallScreen, maxCartsX, maxCartsY), - PlayPadMain.stageIcon.orElse(null)); - return false; - } - } - - @Override - public String name() { - return Localization.getString(Strings.UI_Window_Settings_Gen_Title); - } -} diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/DesignPadTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/DesignPadTabViewController.java index ad920ab0..c5919f6a 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/DesignPadTabViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/DesignPadTabViewController.java @@ -112,7 +112,7 @@ public class DesignPadTabViewController extends PadSettingsTabViewController { Mapping activeMapping = Profile.currentProfile().getMappings().getActiveMapping(); List<CartAction> actions = activeMapping.getActions(CartActionConnect.TYPE); // Update die Mapper der CartAction - actions.stream().filter(item -> item.getCart() == pad.getIndex()) + actions.stream().filter(action -> action.getPad() != null).filter(action -> action.getPad().getIndex() == pad.getIndex()) .forEach(item -> item.initFeedback(pad.getProject(), mainViewController)); } } diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/AudioTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/AudioTabViewController.java similarity index 90% rename from PlayWall/src/de/tobias/playpad/viewcontroller/option/AudioTabViewController.java rename to PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/AudioTabViewController.java index f27e3ae3..7faa367a 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/AudioTabViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/AudioTabViewController.java @@ -1,4 +1,4 @@ -package de.tobias.playpad.viewcontroller.option; +package de.tobias.playpad.viewcontroller.option.profile; import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.PlayPadPlugin; @@ -10,13 +10,14 @@ import de.tobias.playpad.settings.Profile; import de.tobias.playpad.settings.ProfileSettings; import de.tobias.playpad.viewcontroller.AudioTypeViewController; import de.tobias.playpad.viewcontroller.main.IMainViewController; +import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController; import de.tobias.utils.util.Localization; import de.tobias.utils.util.Worker; import javafx.fxml.FXML; import javafx.scene.control.ComboBox; import javafx.scene.layout.AnchorPane; -public class AudioTabViewController extends SettingsTabViewController { +public class AudioTabViewController extends ProfileSettingsTabViewController { // Audio @FXML private ComboBox<String> audioTypeComboBox; @@ -25,7 +26,7 @@ public class AudioTabViewController extends SettingsTabViewController { private boolean changeAudioSettings; public AudioTabViewController(boolean playerActive) { - super("audioTab", "de/tobias/playpad/assets/view/option/", PlayPadMain.getUiResourceBundle()); + super("audioTab", "de/tobias/playpad/assets/view/option/profile/", PlayPadMain.getUiResourceBundle()); if (playerActive) { audioTypeComboBox.setDisable(true); diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/DesignTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/DesignTabViewController.java similarity index 89% rename from PlayWall/src/de/tobias/playpad/viewcontroller/option/DesignTabViewController.java rename to PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/DesignTabViewController.java index e466e4a0..3953f127 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/DesignTabViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/DesignTabViewController.java @@ -1,4 +1,4 @@ -package de.tobias.playpad.viewcontroller.option; +package de.tobias.playpad.viewcontroller.option.profile; import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.PlayPadPlugin; @@ -11,19 +11,20 @@ import de.tobias.playpad.settings.Profile; import de.tobias.playpad.viewcontroller.GlobalDesignViewController; import de.tobias.playpad.viewcontroller.cell.DisplayableCell; import de.tobias.playpad.viewcontroller.main.IMainViewController; +import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController; import de.tobias.utils.util.Localization; import javafx.fxml.FXML; import javafx.scene.control.ComboBox; import javafx.scene.layout.VBox; -public class DesignTabViewController extends SettingsTabViewController { +public class DesignTabViewController extends ProfileSettingsTabViewController { @FXML private VBox layoutContainer; @FXML private ComboBox<DesignConnect> layoutTypeComboBox; private GlobalDesignViewController globalLayoutViewController; public DesignTabViewController() { - super("layoutTab", "de/tobias/playpad/assets/view/option/", PlayPadMain.getUiResourceBundle()); + super("layoutTab", "de/tobias/playpad/assets/view/option/profile/", PlayPadMain.getUiResourceBundle()); String layoutType = Profile.currentProfile().getProfileSettings().getLayoutType(); try { diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/GeneralTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/GeneralTabViewController.java new file mode 100644 index 00000000..ee877030 --- /dev/null +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/GeneralTabViewController.java @@ -0,0 +1,200 @@ +package de.tobias.playpad.viewcontroller.option.profile; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import de.tobias.playpad.PlayPadMain; +import de.tobias.playpad.Strings; +import de.tobias.playpad.settings.Profile; +import de.tobias.playpad.settings.ProfileSettings; +import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController; +import de.tobias.utils.application.ApplicationUtils; +import de.tobias.utils.application.container.PathType; +import de.tobias.utils.ui.Alertable; +import de.tobias.utils.util.Localization; +import de.tobias.utils.util.NumberUtils; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.scene.control.CheckBox; +import javafx.scene.control.Label; +import javafx.scene.control.RadioButton; +import javafx.scene.control.TextField; +import javafx.scene.control.ToggleGroup; +import javafx.stage.DirectoryChooser; + +public class GeneralTabViewController extends ProfileSettingsTabViewController { + + @FXML private CheckBox liveModeCheckBox; + + @FXML private TextField cacheTextField; + @FXML private Label cacheSizeLabel; + + @FXML private RadioButton pageEnable; + @FXML private RadioButton pageDisable; + @FXML private ToggleGroup pageGroup; + @FXML private RadioButton dragEnable; + @FXML private RadioButton dragDisable; + @FXML private ToggleGroup dragGroup; + @FXML private RadioButton fileEnable; + @FXML private RadioButton fileDisable; + @FXML private ToggleGroup fileGroup; + @FXML private RadioButton settingsEnable; + @FXML private RadioButton settingsDisable; + @FXML private ToggleGroup settingsGroup; + + private boolean changeSettings; + + private Alertable alertable; + + public GeneralTabViewController(Alertable alertable) { + super("generalTab", "de/tobias/playpad/assets/view/option/profile/", PlayPadMain.getUiResourceBundle()); + this.alertable = alertable; + + calcCacheSize(); + } + + @Override + public void init() { + pageGroup = new ToggleGroup(); + pageGroup.getToggles().addAll(pageEnable, pageDisable); + dragGroup = new ToggleGroup(); + dragGroup.getToggles().addAll(dragEnable, dragDisable); + fileGroup = new ToggleGroup(); + fileGroup.getToggles().addAll(fileEnable, fileDisable); + settingsGroup = new ToggleGroup(); + settingsGroup.getToggles().addAll(settingsEnable, settingsDisable); + + liveModeCheckBox.selectedProperty().addListener((a, b, c) -> + { + disableLiveSettings(c); + }); + } + + private void disableLiveSettings(Boolean enableLiveSettings) { + pageEnable.setDisable(!enableLiveSettings); + pageDisable.setDisable(!enableLiveSettings); + dragEnable.setDisable(!enableLiveSettings); + dragDisable.setDisable(!enableLiveSettings); + fileEnable.setDisable(!enableLiveSettings); + fileDisable.setDisable(!enableLiveSettings); + settingsEnable.setDisable(!enableLiveSettings); + settingsDisable.setDisable(!enableLiveSettings); + } + + @FXML + private void cacheChooseHandler(ActionEvent event) { + DirectoryChooser chooser = new DirectoryChooser(); + File folder = chooser.showDialog(getStage()); + if (folder != null) { + Path folderPath = folder.toPath(); + Profile.currentProfile().getProfileSettings().setCachePath(folderPath); + cacheTextField.setText(folderPath.toString()); + } + } + + @FXML + private void cacheResetButtonHandler(ActionEvent event) { + try { + int deleteFiles = 0; + for (Path path : Files.newDirectoryStream(ApplicationUtils.getApplication().getPath(PathType.CACHE))) { + if (Files.isRegularFile(path)) { + try { + Files.delete(path); + deleteFiles++; + } catch (Exception e) { + e.printStackTrace(); + } + } + } + alertable.showInfoMessage(Localization.getString(Strings.Info_Settings_CacheDelete, deleteFiles), PlayPadMain.stageIcon.get()); + + calcCacheSize(); + } catch (IOException e) { + e.printStackTrace(); + showErrorMessage(Localization.getString(Strings.Error_Settings_CacheClear, e.getLocalizedMessage())); + } + } + + @FXML + private void resetDialogs(ActionEvent event) { + alertable.showInfoMessage(Localization.getString(Strings.Info_Settings_ResetWarning)); + } + + private void calcCacheSize() { + try { + double size = 0; + Path path = Profile.currentProfile().getProfileSettings().getCachePath(); + if (Files.notExists(path)) + Files.createDirectories(path); + + for (Path item : Files.newDirectoryStream(Profile.currentProfile().getProfileSettings().getCachePath())) { + size += Files.size(item); + } + cacheSizeLabel.setText(Localization.getString(Strings.UI_Window_Settings_Gen_CacheSize, NumberUtils.numberToString(size))); + } catch (IOException e) { + e.printStackTrace(); + alertable.showErrorMessage(Localization.getString(Strings.Error_Settings_CacheSize, e.getMessage()), PlayPadMain.stageIcon); + } + } + + @Override + public void loadSettings(Profile profile) { + ProfileSettings profileSettings = profile.getProfileSettings(); + + liveModeCheckBox.setSelected(profileSettings.isLiveMode()); + cacheTextField.setText(profileSettings.getCachePath().toString()); + + if (profileSettings.isLiveModePage() == true) + pageEnable.setSelected(true); + else + pageDisable.setSelected(true); + + if (profileSettings.isLiveModeDrag() == true) + dragEnable.setSelected(true); + else + dragDisable.setSelected(true); + + if (profileSettings.isLiveModeFile() == true) + fileEnable.setSelected(true); + else + fileDisable.setSelected(true); + + if (profileSettings.isLiveModeSettings() == true) + settingsEnable.setSelected(true); + else + settingsDisable.setSelected(true); + + disableLiveSettings(profileSettings.isLiveMode()); + } + + @Override + public void saveSettings(Profile profile) { + ProfileSettings profileSettings = profile.getProfileSettings(); + + profileSettings.setLiveMode(liveModeCheckBox.isSelected()); + profileSettings.setCachePath(Paths.get(cacheTextField.getText())); + + profileSettings.setLiveModePage(pageEnable.isSelected()); + profileSettings.setLiveModeDrag(dragEnable.isSelected()); + profileSettings.setLiveModeFile(fileEnable.isSelected()); + profileSettings.setLiveModeSettings(settingsEnable.isSelected()); + } + + @Override + public boolean needReload() { + return changeSettings; + } + + @Override + public boolean validSettings() { + return true; + } + + @Override + public String name() { + return Localization.getString(Strings.UI_Window_Settings_Gen_Title); + } +} diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/MappingTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/MappingTabViewController.java similarity index 94% rename from PlayWall/src/de/tobias/playpad/viewcontroller/option/MappingTabViewController.java rename to PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/MappingTabViewController.java index 3f86e36e..56ad791c 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/MappingTabViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/MappingTabViewController.java @@ -1,4 +1,4 @@ -package de.tobias.playpad.viewcontroller.option; +package de.tobias.playpad.viewcontroller.option.profile; import java.util.List; import java.util.Set; @@ -22,6 +22,7 @@ import de.tobias.playpad.viewcontroller.cell.DisplayableCell; import de.tobias.playpad.viewcontroller.cell.DisplayableTreeCell; import de.tobias.playpad.viewcontroller.dialog.MappingListViewController; import de.tobias.playpad.viewcontroller.main.IMainViewController; +import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController; import de.tobias.utils.ui.ContentViewController; import de.tobias.utils.util.Localization; import javafx.event.ActionEvent; @@ -32,7 +33,7 @@ import javafx.scene.control.TreeItem; import javafx.scene.control.TreeView; import javafx.scene.layout.VBox; -public class MappingTabViewController extends SettingsTabViewController implements IMappingTabViewController { +public class MappingTabViewController extends ProfileSettingsTabViewController implements IMappingTabViewController { @FXML private ComboBox<Mapping> mappingComboBox; @FXML private Button editMappingsButton; @@ -46,7 +47,7 @@ public class MappingTabViewController extends SettingsTabViewController implemen private Mapping mapping; public MappingTabViewController() { - super("mapping", "de/tobias/playpad/assets/view/option/", PlayPadMain.getUiResourceBundle()); + super("mapping", "de/tobias/playpad/assets/view/option/profile/", PlayPadMain.getUiResourceBundle()); } @Override diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/MidiTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/MidiTabViewController.java similarity index 91% rename from PlayWall/src/de/tobias/playpad/viewcontroller/option/MidiTabViewController.java rename to PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/MidiTabViewController.java index b6eb72a7..5f1b14a0 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/MidiTabViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/MidiTabViewController.java @@ -1,4 +1,4 @@ -package de.tobias.playpad.viewcontroller.option; +package de.tobias.playpad.viewcontroller.option.profile; import javax.sound.midi.MidiDevice.Info; import javax.sound.midi.MidiUnavailableException; @@ -10,6 +10,7 @@ import de.tobias.playpad.project.Project; import de.tobias.playpad.settings.Profile; import de.tobias.playpad.settings.ProfileSettings; import de.tobias.playpad.viewcontroller.main.IMainViewController; +import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController; import de.tobias.utils.util.Localization; import javafx.event.ActionEvent; import javafx.fxml.FXML; @@ -17,7 +18,7 @@ import javafx.scene.control.CheckBox; import javafx.scene.control.ComboBox; import javafx.scene.layout.AnchorPane; -public class MidiTabViewController extends SettingsTabViewController { +public class MidiTabViewController extends ProfileSettingsTabViewController { @FXML private AnchorPane rootPane; @@ -25,7 +26,7 @@ public class MidiTabViewController extends SettingsTabViewController { @FXML private ComboBox<String> deviceComboBox; public MidiTabViewController() { - super("midiTab", "de/tobias/playpad/assets/view/option/", PlayPadMain.getUiResourceBundle()); + super("midiTab", "de/tobias/playpad/assets/view/option/profile/", PlayPadMain.getUiResourceBundle()); Info[] data = Midi.getMidiDevices(); // Gerät anzeigen - Doppelte weg diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/PlayerTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/PlayerTabViewController.java similarity index 88% rename from PlayWall/src/de/tobias/playpad/viewcontroller/option/PlayerTabViewController.java rename to PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/PlayerTabViewController.java index a8545938..a8893d91 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/PlayerTabViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/PlayerTabViewController.java @@ -1,4 +1,4 @@ -package de.tobias.playpad.viewcontroller.option; +package de.tobias.playpad.viewcontroller.option.profile; import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.Strings; @@ -8,6 +8,7 @@ import de.tobias.playpad.settings.Profile; import de.tobias.playpad.settings.ProfileSettings; import de.tobias.playpad.viewcontroller.cell.EnumCell; import de.tobias.playpad.viewcontroller.main.IMainViewController; +import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController; import de.tobias.playpad.viewcontroller.settings.FadeViewController; import de.tobias.playpad.viewcontroller.settings.WarningFeedbackViewController; import de.tobias.utils.util.Localization; @@ -15,7 +16,7 @@ import javafx.fxml.FXML; import javafx.scene.control.ComboBox; import javafx.scene.layout.VBox; -public class PlayerTabViewController extends SettingsTabViewController { +public class PlayerTabViewController extends ProfileSettingsTabViewController { // Player @FXML private VBox warningFeedbackContainer; @@ -23,7 +24,7 @@ public class PlayerTabViewController extends SettingsTabViewController { @FXML private ComboBox<TimeMode> timeDisplayComboBox; public PlayerTabViewController() { - super("playerTab", "de/tobias/playpad/assets/view/option/", PlayPadMain.getUiResourceBundle()); + super("playerTab", "de/tobias/playpad/assets/view/option/profile/", PlayPadMain.getUiResourceBundle()); // Player FadeViewController fadeViewController = new FadeViewController(); diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/SettingsViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/SettingsViewController.java similarity index 82% rename from PlayWall/src/de/tobias/playpad/viewcontroller/option/SettingsViewController.java rename to PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/SettingsViewController.java index 642c15a2..760d8c50 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/SettingsViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/SettingsViewController.java @@ -1,4 +1,4 @@ -package de.tobias.playpad.viewcontroller.option; +package de.tobias.playpad.viewcontroller.option.profile; import java.util.ArrayList; import java.util.List; @@ -12,6 +12,8 @@ import de.tobias.playpad.project.Project; import de.tobias.playpad.registry.NoSuchComponentException; import de.tobias.playpad.settings.Profile; import de.tobias.playpad.settings.ProfileSettings; +import de.tobias.playpad.viewcontroller.option.IProfileSettingsViewController; +import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController; import de.tobias.utils.ui.ViewController; import de.tobias.utils.ui.icon.FontAwesomeType; import de.tobias.utils.ui.icon.FontIcon; @@ -26,23 +28,23 @@ import javafx.stage.Screen; import javafx.stage.Stage; import javafx.stage.Window; -public class SettingsViewController extends ViewController implements ISettingsViewController { +public class SettingsViewController extends ViewController implements IProfileSettingsViewController { @FXML private TabPane tabPane; @FXML private ToggleButton lockedButton; @FXML private Button finishButton; - protected List<SettingsTabViewController> tabs = new ArrayList<>(); + protected List<ProfileSettingsTabViewController> tabs = new ArrayList<>(); private Runnable onFinish; public SettingsViewController(Midi midiHandler, Screen currentScreen, Window owner, Project project, Runnable onFinish) { - super("settingsView", "de/tobias/playpad/assets/view/option/", null, PlayPadMain.getUiResourceBundle()); + super("settingsView", "de/tobias/playpad/assets/view/option/profile/", null, PlayPadMain.getUiResourceBundle()); this.onFinish = onFinish; boolean activePlayer = project.hasPlayedPlayers(); - addTab(new GeneralTabViewController(currentScreen, this, activePlayer)); + addTab(new GeneralTabViewController(this)); addTab(new MappingTabViewController()); addTab(new MidiTabViewController()); addTab(new DesignTabViewController()); @@ -52,7 +54,7 @@ public class SettingsViewController extends ViewController implements ISettingsV for (String type : PlayPadPlugin.getRegistryCollection().getPadContents().getTypes()) { try { PadContentConnect component = PlayPadPlugin.getRegistryCollection().getPadContents().getComponent(type); - SettingsTabViewController controller = component.getSettingsTabViewController(activePlayer); + ProfileSettingsTabViewController controller = component.getSettingsTabViewController(activePlayer); if (controller != null) { addTab(controller); } @@ -109,7 +111,7 @@ public class SettingsViewController extends ViewController implements ISettingsV */ private void loadTabs() { Profile profile = Profile.currentProfile(); - for (SettingsTabViewController controller : tabs) { + for (ProfileSettingsTabViewController controller : tabs) { controller.loadSettings(profile); } } @@ -119,7 +121,7 @@ public class SettingsViewController extends ViewController implements ISettingsV */ private void saveTabs() { Profile profile = Profile.currentProfile(); - for (SettingsTabViewController controller : tabs) { + for (ProfileSettingsTabViewController controller : tabs) { controller.saveSettings(profile); } @@ -148,7 +150,7 @@ public class SettingsViewController extends ViewController implements ISettingsV * @return <code>true</code>Alle Einstellungen sind Valid. */ private boolean onFinish() { - for (SettingsTabViewController controller : tabs) { + for (ProfileSettingsTabViewController controller : tabs) { if (controller.validSettings() == false) { return false; } @@ -171,12 +173,12 @@ public class SettingsViewController extends ViewController implements ISettingsV } @Override - public void addTab(SettingsTabViewController controller) { + public void addTab(ProfileSettingsTabViewController controller) { tabs.add(controller); tabPane.getTabs().add(new Tab(controller.name(), controller.getParent())); } - public List<SettingsTabViewController> getTabs() { + public List<ProfileSettingsTabViewController> getTabs() { return tabs; } } diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/project/GeneralTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/project/GeneralTabViewController.java new file mode 100644 index 00000000..a94a860b --- /dev/null +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/project/GeneralTabViewController.java @@ -0,0 +1,196 @@ +package de.tobias.playpad.viewcontroller.option.project; + +import de.tobias.playpad.PlayPadMain; +import de.tobias.playpad.PseudoClasses; +import de.tobias.playpad.Strings; +import de.tobias.playpad.design.GlobalDesign; +import de.tobias.playpad.project.Project; +import de.tobias.playpad.project.ProjectSettings; +import de.tobias.playpad.settings.Profile; +import de.tobias.playpad.viewcontroller.main.IMainViewController; +import de.tobias.playpad.viewcontroller.option.ProjectSettingsTabViewController; +import de.tobias.utils.ui.Alertable; +import de.tobias.utils.util.Localization; +import de.tobias.utils.util.Worker; +import javafx.application.Platform; +import javafx.fxml.FXML; +import javafx.scene.control.Alert; +import javafx.scene.control.Alert.AlertType; +import javafx.scene.control.TextField; +import javafx.stage.Modality; +import javafx.stage.Screen; +import javafx.stage.Stage; + +public class GeneralTabViewController extends ProjectSettingsTabViewController { + + private static final String DIGIT_POSITIV = "^[1-9]\\d*$"; + + private Screen mainWindowScreen; + private Alertable parentController; // Für Benachrichtungen + + @FXML private TextField pageCountTextField; + @FXML private TextField columnTextField; + @FXML private TextField rowTextField; + + public GeneralTabViewController(Screen currentScreen, Alertable parentController, boolean activePlayer) { + super("generalTab", "de/tobias/playpad/assets/view/option/project/", PlayPadMain.getUiResourceBundle()); + + this.mainWindowScreen = currentScreen; + this.parentController = parentController; + + if (activePlayer) { + rowTextField.setDisable(true); + columnTextField.setDisable(true); + pageCountTextField.setDisable(true); + } + + } + + @Override + public void init() { + pageCountTextField.textProperty().addListener((a, b, c) -> + { + if (c.matches(DIGIT_POSITIV) && !c.isEmpty()) { + int number = Integer.valueOf(c); + if (number > ProjectSettings.MAX_PAGES) { + pageCountTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); // Zahl zu groß + } else { + pageCountTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, false); // Zahl ok + } + } else { + pageCountTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); // Negativ oder leer + } + }); + + columnTextField.textProperty().addListener((a, b, c) -> + { + if (c.matches(DIGIT_POSITIV) && !c.isEmpty()) { + if (screenValid()) { + columnTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, false); // Zahl ok + } else { + columnTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); // Zahl zu groß + } + } else { + columnTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); // Negativ oder leer + } + }); + + rowTextField.textProperty().addListener((a, b, c) -> + { + if (c.matches(DIGIT_POSITIV) && !c.isEmpty()) { + if (screenValid()) { + rowTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, false); // Zahl ok + } else { + rowTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); // Zahl zu groß + } + } else { + rowTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); // Negativ oder leer + } + }); + } + + private boolean screenValid() { + double width = mainWindowScreen.getVisualBounds().getMaxX() - mainWindowScreen.getVisualBounds().getMinX(); + double height = mainWindowScreen.getVisualBounds().getMaxY() - mainWindowScreen.getVisualBounds().getMinY(); + + GlobalDesign layout = Profile.currentProfile().currentLayout(); + + try { + double neededWidth = layout.getMinWidth(Integer.valueOf(columnTextField.getText())); + double neededHeight = layout.getMinHeight(Integer.valueOf(rowTextField.getText())) + 100; + + if (neededHeight <= height && neededWidth <= width) + return true; + } catch (NumberFormatException e) {} + return false; + } + + @Override + public void loadSettings(ProjectSettings settings) { + pageCountTextField.setText(String.valueOf(settings.getPageCount())); + columnTextField.setText(String.valueOf(settings.getColumns())); + rowTextField.setText(String.valueOf(settings.getRows())); + + if (screenValid()) { + columnTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, false); + rowTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, false); + } else { + columnTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); + rowTextField.pseudoClassStateChanged(PseudoClasses.ERROR_CLASS, true); + } + + } + + private boolean changeSettings = false; + + @Override + public void saveSettings(ProjectSettings settings) { + int columns = Integer.valueOf(columnTextField.getText()); + int rows = Integer.valueOf(rowTextField.getText()); + int pageCount = Integer.valueOf(pageCountTextField.getText()); + + if (settings.getColumns() != columns || settings.getRows() != rows || settings.getPageCount() != pageCount) + changeSettings = true; + else + changeSettings = false; + + // Copy Settings + settings.setColumns(columns); + settings.setRows(rows); + settings.setPageCount(pageCount); + } + + @Override + public boolean needReload() { + return changeSettings; + } + + @Override + public void reload(ProjectSettings settings, Project project, IMainViewController controller) { + Alert alert = new Alert(AlertType.INFORMATION); + alert.setContentText(Localization.getString(Strings.UI_Window_Settings_Gen_Wait)); + + alert.getButtonTypes().clear(); + alert.initOwner(controller.getStage()); + alert.initModality(Modality.WINDOW_MODAL); + Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); + PlayPadMain.stageIcon.ifPresent(stage.getIcons()::add); + + alert.show(); + + Worker.runLater(() -> + { + Platform.runLater(() -> + { + controller.getMenuToolbarController().initPageButtons(); + controller.createPadViews(); + controller.showPage(controller.getPage()); + stage.close(); + }); + }); + } + + @Override + public boolean validSettings() { + if (screenValid()) { + return true; + } else { + double width = mainWindowScreen.getVisualBounds().getMaxX() - mainWindowScreen.getVisualBounds().getMinX(); + double height = mainWindowScreen.getVisualBounds().getMaxY() - mainWindowScreen.getVisualBounds().getMinY(); + + GlobalDesign globalLayout = Profile.currentProfile().currentLayout(); + + int maxCartsX = (int) (width / globalLayout.getPadWidth()); + int maxCartsY = (int) ((height - 100) / globalLayout.getPadHeight()); + parentController.showErrorMessage(Localization.getString(Strings.Error_Profile_SmallScreen, maxCartsX, maxCartsY), + PlayPadMain.stageIcon.orElse(null)); + return false; + } + } + + @Override + public String name() { + return Localization.getString(Strings.UI_Window_Settings_Gen_Title); + } + +} diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/project/ProjectSettingsViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/project/ProjectSettingsViewController.java new file mode 100644 index 00000000..8787a0bb --- /dev/null +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/project/ProjectSettingsViewController.java @@ -0,0 +1,121 @@ +package de.tobias.playpad.viewcontroller.option.project; + +import java.util.ArrayList; +import java.util.List; + +import de.tobias.playpad.PlayPadMain; +import de.tobias.playpad.Strings; +import de.tobias.playpad.project.ProjectSettings; +import de.tobias.playpad.settings.Profile; +import de.tobias.playpad.viewcontroller.option.IProjectSettingsViewController; +import de.tobias.playpad.viewcontroller.option.ProjectSettingsTabViewController; +import de.tobias.utils.ui.ViewController; +import de.tobias.utils.util.Localization; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.scene.control.Button; +import javafx.scene.control.Tab; +import javafx.scene.control.TabPane; +import javafx.scene.control.ToggleButton; +import javafx.stage.Stage; +import javafx.stage.Window; + +public class ProjectSettingsViewController extends ViewController implements IProjectSettingsViewController { + + @FXML private TabPane tabPane; + @FXML private ToggleButton lockedButton; + @FXML private Button finishButton; + + protected List<ProjectSettingsTabViewController> tabs = new ArrayList<>(); + private ProjectSettings settings; + + private Runnable onFinish; + + public ProjectSettingsViewController(Window owner, ProjectSettings settings, Runnable onFinish) { + super("projectSettingsView", "de/tobias/playpad/assets/view/option/project/", null, PlayPadMain.getUiResourceBundle()); + this.onFinish = onFinish; + this.settings = settings; + + getStage().initOwner(owner); + + // Show Current Settings + loadTabs(settings); + } + + @Override + public void init() { + // KeyCode + addCloseKeyShortcut(() -> finishButton.fire()); + + finishButton.defaultButtonProperty().bind(finishButton.focusedProperty()); + } + + @Override + public void initStage(Stage stage) { + PlayPadMain.stageIcon.ifPresent(stage.getIcons()::add); + + stage.setMinWidth(715); + stage.setMinHeight(700); + stage.setTitle(Localization.getString(Strings.UI_Window_GlobalSettings_Title)); + + Profile.currentProfile().currentLayout().applyCss(getStage()); + } + + /** + * Zeigt die aktuellen Einstellungen für die Tabs an. + */ + private void loadTabs(ProjectSettings settings) { + + for (ProjectSettingsTabViewController controller : tabs) { + controller.loadSettings(settings); + } + } + + /** + * Speichert die Einstellungen der Tabs. + */ + private void saveTabs(ProjectSettings settings) { + for (ProjectSettingsTabViewController controller : tabs) { + controller.saveSettings(settings); + } + } + + public boolean closeRequest() { + return onFinish(); + } + + // Button Listener + @FXML + private void finishButtonHandler(ActionEvent event) { + onFinish(); + getStage().close(); + } + + /** + * Speichert alle Informationen. + * + * @return <code>true</code>Alle Einstellungen sind Valid. + */ + private boolean onFinish() { + for (ProjectSettingsTabViewController controller : tabs) { + if (controller.validSettings() == false) { + return false; + } + } + + saveTabs(settings); + if (onFinish != null) + onFinish.run(); // Reload MainViewController Settings + return true; + } + + @Override + public void addTab(ProjectSettingsTabViewController controller) { + tabs.add(controller); + tabPane.getTabs().add(new Tab(controller.name(), controller.getParent())); + } + + public List<ProjectSettingsTabViewController> getTabs() { + return tabs; + } +} diff --git a/PlayWallCore/src/de/tobias/playpad/action/ActionConnect.java b/PlayWallCore/src/de/tobias/playpad/action/ActionConnect.java index 65ba0857..cdcdff5d 100644 --- a/PlayWallCore/src/de/tobias/playpad/action/ActionConnect.java +++ b/PlayWallCore/src/de/tobias/playpad/action/ActionConnect.java @@ -35,6 +35,8 @@ public abstract class ActionConnect { * Mapping * @param profile * Profile für Einstellungen + * @param projectSettings + * Project Einstellungen */ public abstract void initActionType(Mapping mapping, Profile profile); diff --git a/PlayWallCore/src/de/tobias/playpad/action/Mapping.java b/PlayWallCore/src/de/tobias/playpad/action/Mapping.java index b4a422d8..c1292c49 100644 --- a/PlayWallCore/src/de/tobias/playpad/action/Mapping.java +++ b/PlayWallCore/src/de/tobias/playpad/action/Mapping.java @@ -30,7 +30,6 @@ public class Mapping implements Cloneable, ActionDisplayable { public Mapping(boolean init, Profile profile) { mapping = new HashMap<>(); if (init) { - initActionType(profile); name = "Default"; uuid = UUID.randomUUID(); } @@ -115,7 +114,7 @@ public class Mapping implements Cloneable, ActionDisplayable { Registry<ActionConnect> actions = PlayPadPlugin.getRegistryCollection().getActions(); for (String type : actions.getTypes()) { try { - actions.getComponent(type).initActionType(this, profile); + actions.getComponent(type).initActionType(this, profile); // TODO } catch (NoSuchComponentException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -178,7 +177,7 @@ public class Mapping implements Cloneable, ActionDisplayable { } getActions().forEach(action -> action.clearFeedback()); } - + public void adjustPadColorToMapper(Project project) { ColorAdjuster.applyColorsToMappers(project); } diff --git a/PlayWallCore/src/de/tobias/playpad/action/MappingList.java b/PlayWallCore/src/de/tobias/playpad/action/MappingList.java index e581cc64..103a680c 100644 --- a/PlayWallCore/src/de/tobias/playpad/action/MappingList.java +++ b/PlayWallCore/src/de/tobias/playpad/action/MappingList.java @@ -70,8 +70,8 @@ public class MappingList extends ArrayList<Mapping> { List<Mapping> loadMappings = handler.loadElements(MAPPING, new MappingSerializer(profile)); loadMappings.forEach(mapping -> { - mapping.initActionType(profile); // Update Actions, damit alle da sind und keine fehlt (falls eine - // gelöscht wurde auf der Datei) + mapping.initActionType(profile); // Update Actions, damit alle da sind und keine fehlt (falls eine gelöscht wurde + // auf der Datei) mapping.updateDisplayProperty(); mappings.add(mapping); }); @@ -96,7 +96,7 @@ public class MappingList extends ArrayList<Mapping> { Files.createDirectories(path.getParent()); Files.createFile(path); } - + XMLHandler<Mapping> handler = new XMLHandler<>(rootElement); handler.saveElements(MAPPING, this, new MappingSerializer()); diff --git a/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjustable.java b/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjustable.java index 4a851b77..01df8244 100644 --- a/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjustable.java +++ b/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjustable.java @@ -1,9 +1,11 @@ package de.tobias.playpad.action.feedback; +import de.tobias.playpad.pad.Pad; + public interface ColorAdjustable { public boolean isAutoFeedbackColors(); - public int getCart(); + public Pad getPad(); } diff --git a/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjuster.java b/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjuster.java index 8de61e0d..8ca7614c 100644 --- a/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjuster.java +++ b/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjuster.java @@ -57,7 +57,7 @@ public class ColorAdjuster { if (feedbackable.supportFeedback() && mapper instanceof ColorAssociator) { ColorAssociator colorAssociator = (ColorAssociator) mapper; - Pad pad = project.getPad(cartAction.getCart()); + Pad pad = cartAction.getPad(); Color layoutStdColor = null; Color layoutEvColor = null; diff --git a/PlayWallCore/src/de/tobias/playpad/pad/Pad.java b/PlayWallCore/src/de/tobias/playpad/pad/Pad.java index 7d80ebb5..b9e0ae36 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/Pad.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/Pad.java @@ -4,9 +4,9 @@ import java.nio.file.Path; import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.pad.conntent.play.Pauseable; -import de.tobias.playpad.pad.triggerlistener.PadTriggerContentListener; -import de.tobias.playpad.pad.triggerlistener.PadTriggerDurationListener; -import de.tobias.playpad.pad.triggerlistener.PadTriggerStatusListener; +import de.tobias.playpad.pad.listener.trigger.PadTriggerContentListener; +import de.tobias.playpad.pad.listener.trigger.PadTriggerDurationListener; +import de.tobias.playpad.pad.listener.trigger.PadTriggerStatusListener; import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; import de.tobias.playpad.project.Project; import de.tobias.playpad.registry.NoSuchComponentException; diff --git a/PlayWallCore/src/de/tobias/playpad/pad/conntent/PadContentConnect.java b/PlayWallCore/src/de/tobias/playpad/pad/conntent/PadContentConnect.java index eb3ebb8b..26001949 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/conntent/PadContentConnect.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/conntent/PadContentConnect.java @@ -6,7 +6,7 @@ import de.tobias.playpad.Displayable; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.view.IPadContentView; import de.tobias.playpad.viewcontroller.PadSettingsTabViewController; -import de.tobias.playpad.viewcontroller.option.SettingsTabViewController; +import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController; import de.tobias.utils.util.FileUtils; import javafx.scene.layout.Pane; @@ -19,7 +19,7 @@ public abstract class PadContentConnect implements Comparable<PadContentConnect> public abstract IPadContentView getPadContentPreview(Pad pad, Pane parentNode); - public SettingsTabViewController getSettingsTabViewController(boolean activePlayer) { + public ProfileSettingsTabViewController getSettingsTabViewController(boolean activePlayer) { return null; } diff --git a/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerContentListener.java b/PlayWallCore/src/de/tobias/playpad/pad/listener/trigger/PadTriggerContentListener.java similarity index 95% rename from PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerContentListener.java rename to PlayWallCore/src/de/tobias/playpad/pad/listener/trigger/PadTriggerContentListener.java index 9ebe753f..5af0ab78 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerContentListener.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/listener/trigger/PadTriggerContentListener.java @@ -1,4 +1,4 @@ -package de.tobias.playpad.pad.triggerlistener; +package de.tobias.playpad.pad.listener.trigger; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.conntent.PadContent; diff --git a/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerDurationListener.java b/PlayWallCore/src/de/tobias/playpad/pad/listener/trigger/PadTriggerDurationListener.java similarity index 97% rename from PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerDurationListener.java rename to PlayWallCore/src/de/tobias/playpad/pad/listener/trigger/PadTriggerDurationListener.java index 632d4f9f..5307a778 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerDurationListener.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/listener/trigger/PadTriggerDurationListener.java @@ -1,4 +1,4 @@ -package de.tobias.playpad.pad.triggerlistener; +package de.tobias.playpad.pad.listener.trigger; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.pad.Pad; diff --git a/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerStatusListener.java b/PlayWallCore/src/de/tobias/playpad/pad/listener/trigger/PadTriggerStatusListener.java similarity index 97% rename from PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerStatusListener.java rename to PlayWallCore/src/de/tobias/playpad/pad/listener/trigger/PadTriggerStatusListener.java index 013d14b5..0bb27b28 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerStatusListener.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/listener/trigger/PadTriggerStatusListener.java @@ -1,4 +1,4 @@ -package de.tobias.playpad.pad.triggerlistener; +package de.tobias.playpad.pad.listener.trigger; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.pad.Pad; diff --git a/PlayWallCore/src/de/tobias/playpad/project/Project.java b/PlayWallCore/src/de/tobias/playpad/project/Project.java index b4176e4a..bdbb2b48 100644 --- a/PlayWallCore/src/de/tobias/playpad/project/Project.java +++ b/PlayWallCore/src/de/tobias/playpad/project/Project.java @@ -49,10 +49,13 @@ public class Project { * Liste mit allen Pads. */ private HashMap<Integer, Pad> pads; + + private ProjectSettings settings; + /** * Liste mit den aktuellen Laufzeitfehlern. */ - private ObservableList<PadException> exceptions; + private transient ObservableList<PadException> exceptions; /** * Erstellt ein neues leeres Projekt mit einer Referenz. @@ -63,6 +66,8 @@ public class Project { public Project(ProjectReference ref) { this.ref = ref; this.pads = new HashMap<>(); + this.settings = new ProjectSettings(); + this.exceptions = FXCollections.observableArrayList(); } @@ -90,6 +95,23 @@ public class Project { return pads.get(index); } + public Pad getPad(int x, int y, int page) { + if (x < settings.getColumns() && y < settings.getRows() && page < settings.getPageCount()) { + int id = (y * settings.getColumns() + x) + page * settings.getColumns() * settings.getRows(); + return getPad(id); + } + return null; + } + + /** + * Gibt die Settings des Projectes zurück + * + * @return + */ + public ProjectSettings getSettings() { + return settings; + } + /** * Erstellt ein neues leeres Pad (mit Referenz zu diesem Projekt) am Index i. * @@ -119,6 +141,7 @@ public class Project { private static final String ROOT_ELEMENT = "Project"; protected static final String PAD_ELEMENT = "Pad"; + private static final String SETTINGS_ELEMENT = "Settings"; public static Project load(ProjectReference ref, boolean loadMedia, ProfileChooseable profileChooseable) throws DocumentException, IOException, ProfileNotFoundException, ProjectNotFoundException, NoSuchComponentException { @@ -134,6 +157,7 @@ public class Project { Project project = new Project(ref); + // Lädt Pads XMLHandler<Pad> handler = new XMLHandler<>(projectPath); List<Pad> pads = handler.loadElements(PAD_ELEMENT, new PadSerializer(project)); @@ -143,6 +167,11 @@ public class Project { project.pads.put(pad.getIndex(), pad); } + // Lädt die Einstellungen + Element settingsElement = handler.getRootElement().element(SETTINGS_ELEMENT); + if (settingsElement != null) + project.settings = ProjectSettings.load(settingsElement); + return project; } else { throw new ProjectNotFoundException(ref); @@ -155,9 +184,14 @@ public class Project { Element rootElement = document.addElement(ROOT_ELEMENT); + // Speichern der Pads XMLHandler<Pad> handler = new XMLHandler<>(rootElement); handler.saveElements(PAD_ELEMENT, pads.values(), new PadSerializer()); + // Speichern der Settings + Element settingsElement = rootElement.addElement(SETTINGS_ELEMENT); + settings.save(settingsElement); + if (Files.notExists(projectPath)) { Files.createDirectories(projectPath.getParent()); Files.createFile(projectPath); diff --git a/PlayWallCore/src/de/tobias/playpad/project/ProjectSettings.java b/PlayWallCore/src/de/tobias/playpad/project/ProjectSettings.java new file mode 100644 index 00000000..64dd0940 --- /dev/null +++ b/PlayWallCore/src/de/tobias/playpad/project/ProjectSettings.java @@ -0,0 +1,74 @@ +package de.tobias.playpad.project; + +import org.dom4j.Element; + +import de.tobias.utils.settings.Storable; + +public class ProjectSettings { + + public static final int MAX_PAGES = 8; + public static final int MAX_COLUMNS = 10; + public static final int MAX_ROWS = 10; + + @Storable private int pageCount = 2; + @Storable private int columns = 6; + @Storable private int rows = 5; + + public int getPageCount() { + return pageCount; + } + + /** + * Returns the value of colums (Number of cells form left to right) + * + * @return columns + */ + public int getColumns() { + return columns; + } + + /** + * Returns the value of rows (Number of cells from top to bottom + * + * @return rows + */ + public int getRows() { + return rows; + } + + public void setPageCount(int pageCount) { + if (pageCount > MAX_PAGES) + pageCount = MAX_PAGES; + this.pageCount = pageCount; + } + + public void setColumns(int columns) { + this.columns = columns; + } + + public void setRows(int rows) { + this.rows = rows; + } + + private static final String ROWS_ELEMENT = "Rows"; + private static final String COLUMNS_ELEMENT = "Columns"; + private static final String PAGE_COUNT_ELEMENT = "PageCount"; + + public static ProjectSettings load(Element element) { + ProjectSettings settings = new ProjectSettings(); + if (element.element(PAGE_COUNT_ELEMENT) != null) + settings.setPageCount(Integer.valueOf(element.element(PAGE_COUNT_ELEMENT).getStringValue())); + if (element.element(COLUMNS_ELEMENT) != null) + settings.setColumns(Integer.valueOf(element.element(COLUMNS_ELEMENT).getStringValue())); + if (element.element(ROWS_ELEMENT) != null) + settings.setRows(Integer.valueOf(element.element(ROWS_ELEMENT).getStringValue())); + + return settings; + } + + public void save(Element element) { + element.addElement(PAGE_COUNT_ELEMENT).addText(String.valueOf(pageCount)); + element.addElement(COLUMNS_ELEMENT).addText(String.valueOf(columns)); + element.addElement(ROWS_ELEMENT).addText(String.valueOf(rows)); + } +} diff --git a/PlayWallCore/src/de/tobias/playpad/settings/ProfileSettings.java b/PlayWallCore/src/de/tobias/playpad/settings/ProfileSettings.java index 676a8a8b..f31720c2 100644 --- a/PlayWallCore/src/de/tobias/playpad/settings/ProfileSettings.java +++ b/PlayWallCore/src/de/tobias/playpad/settings/ProfileSettings.java @@ -32,18 +32,11 @@ public class ProfileSettings implements SettingsSerializable { private static final long serialVersionUID = 1L; - public static final int MAX_PAGES = 8; - @Storable private BooleanProperty lockedProperty = new SimpleBooleanProperty(false); // MIDI @Storable private String midiDevice; - // GridPane - @Storable private int pageCount = 2; - @Storable private int columns = 6; - @Storable private int rows = 5; - // Audio Output // TODO Rewrite @Storable private String audioClass = PlayPadPlugin.getRegistryCollection().getAudioHandlers().getDefaultID(); @@ -89,28 +82,6 @@ public class ProfileSettings implements SettingsSerializable { return midiDevice; } - public int getPageCount() { - return pageCount; - } - - /** - * Returns the value of colums (Number of cells form left to right) - * - * @return columns - */ - public int getColumns() { - return columns; - } - - /** - * Returns the value of rows (Number of cells from top to bottom - * - * @return rows - */ - public int getRows() { - return rows; - } - public Path getCachePath() { return cachePath; } @@ -180,20 +151,6 @@ public class ProfileSettings implements SettingsSerializable { this.midiDevice = midiDevice; } - public void setPageCount(int pageCount) { - if (pageCount > MAX_PAGES) - pageCount = MAX_PAGES; - this.pageCount = pageCount; - } - - public void setColumns(int columns) { - this.columns = columns; - } - - public void setRows(int rows) { - this.rows = rows; - } - public void setCachePath(Path cachePath) { this.cachePath = cachePath; } @@ -277,9 +234,6 @@ public class ProfileSettings implements SettingsSerializable { private static final String WARNING_ELEMENT = "Warning"; private static final String LAYOUT_TYPE_ELEMENT = "LayoutType"; private static final String MAIN_LAYOUT_TYPE_ELEMENT = "MainLayoutType"; - private static final String ROWS_ELEMENT = "Rows"; - private static final String COLUMNS_ELEMENT = "Columns"; - private static final String PAGE_COUNT_ELEMENT = "PageCount"; private static final String MIDI_ACTIVE_ELEMENT = "MidiActive"; private static final String MIDI_DEVICE_ELEMENT = "MidiDevice"; @@ -299,13 +253,6 @@ public class ProfileSettings implements SettingsSerializable { if (root.element(MIDI_ACTIVE_ELEMENT) != null) profileSettings.setMidiActive(Boolean.valueOf(root.element(MIDI_ACTIVE_ELEMENT).getStringValue())); - if (root.element(PAGE_COUNT_ELEMENT) != null) - profileSettings.setPageCount(Integer.valueOf(root.element(PAGE_COUNT_ELEMENT).getStringValue())); - if (root.element(COLUMNS_ELEMENT) != null) - profileSettings.setColumns(Integer.valueOf(root.element(COLUMNS_ELEMENT).getStringValue())); - if (root.element(ROWS_ELEMENT) != null) - profileSettings.setRows(Integer.valueOf(root.element(ROWS_ELEMENT).getStringValue())); - if (root.element(LAYOUT_TYPE_ELEMENT) != null) { profileSettings.setLayoutType(root.element(LAYOUT_TYPE_ELEMENT).getStringValue()); } @@ -388,11 +335,6 @@ public class ProfileSettings implements SettingsSerializable { root.addElement(MIDI_DEVICE_ELEMENT).addText(midiDevice); root.addElement(MIDI_ACTIVE_ELEMENT).addText(String.valueOf(midiActive)); - // GirdPane - root.addElement(PAGE_COUNT_ELEMENT).addText(String.valueOf(pageCount)); - root.addElement(COLUMNS_ELEMENT).addText(String.valueOf(columns)); - root.addElement(ROWS_ELEMENT).addText(String.valueOf(rows)); - root.addElement(LAYOUT_TYPE_ELEMENT).addText(layoutType); root.addElement(MAIN_LAYOUT_TYPE_ELEMENT).addText(mainLayoutType); diff --git a/PlayWallCore/src/de/tobias/playpad/viewcontroller/main/MenuToolbarViewController.java b/PlayWallCore/src/de/tobias/playpad/viewcontroller/main/MenuToolbarViewController.java index f8369fb0..2df87e37 100644 --- a/PlayWallCore/src/de/tobias/playpad/viewcontroller/main/MenuToolbarViewController.java +++ b/PlayWallCore/src/de/tobias/playpad/viewcontroller/main/MenuToolbarViewController.java @@ -2,6 +2,7 @@ package de.tobias.playpad.viewcontroller.main; import java.util.ResourceBundle; +import de.tobias.playpad.project.Project; import de.tobias.playpad.settings.ProfileSettings; import de.tobias.playpad.settings.keys.KeyCollection; import de.tobias.playpad.view.main.MenuType; @@ -174,7 +175,15 @@ public abstract class MenuToolbarViewController extends ContentViewController { /** * Lädt das Keyboard Binding. * - * @param keys Einstellungen der Keybinding + * @param keys + * Einstellungen der Keybinding */ public abstract void loadKeybinding(KeyCollection keys); + + /** + * Setzt eine Refernce des aktuellen Projectes auf den ViewController. + * + * @param project neues Project + */ + public abstract void setOpenProject(Project project); } diff --git a/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/ISettingsViewController.java b/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/IProfileSettingsViewController.java similarity index 65% rename from PlayWallCore/src/de/tobias/playpad/viewcontroller/option/ISettingsViewController.java rename to PlayWallCore/src/de/tobias/playpad/viewcontroller/option/IProfileSettingsViewController.java index 88ad688b..e77faa89 100644 --- a/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/ISettingsViewController.java +++ b/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/IProfileSettingsViewController.java @@ -7,7 +7,7 @@ package de.tobias.playpad.viewcontroller.option; * * @since 5.0.0 */ -public interface ISettingsViewController { +public interface IProfileSettingsViewController { /** * Fügt en Tab hinzu. @@ -15,6 +15,6 @@ public interface ISettingsViewController { * @param profileSettingsTabViewController * tab */ - public void addTab(SettingsTabViewController profileSettingsTabViewController); + public void addTab(ProfileSettingsTabViewController profileSettingsTabViewController); } diff --git a/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/IProjectSettingsViewController.java b/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/IProjectSettingsViewController.java new file mode 100644 index 00000000..5ba59e58 --- /dev/null +++ b/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/IProjectSettingsViewController.java @@ -0,0 +1,20 @@ +package de.tobias.playpad.viewcontroller.option; + +/** + * Schnittstelle um die GlobalSettingsView zu ändern. + * + * @author tobias + * + * @since 5.1.0 + */ +public interface IProjectSettingsViewController { + + /** + * Fügt en Tab hinzu. + * + * @param projectSettingsTabViewController + * tab + */ + public void addTab(ProjectSettingsTabViewController projectSettingsTabViewController); + +} diff --git a/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/SettingsTabViewController.java b/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/ProfileSettingsTabViewController.java similarity index 91% rename from PlayWallCore/src/de/tobias/playpad/viewcontroller/option/SettingsTabViewController.java rename to PlayWallCore/src/de/tobias/playpad/viewcontroller/option/ProfileSettingsTabViewController.java index 96c9975d..345e903f 100644 --- a/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/SettingsTabViewController.java +++ b/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/ProfileSettingsTabViewController.java @@ -15,7 +15,7 @@ import de.tobias.utils.ui.ContentViewController; * @since 5.0.0 * */ -public abstract class SettingsTabViewController extends ContentViewController { +public abstract class ProfileSettingsTabViewController extends ContentViewController { /** * Erstellt einen neuen Tab. @@ -27,7 +27,7 @@ public abstract class SettingsTabViewController extends ContentViewController { * @param localization * ResourceBundle oder null */ - public SettingsTabViewController(String name, String path, ResourceBundle localization) { + public ProfileSettingsTabViewController(String name, String path, ResourceBundle localization) { super(name, path, localization); } diff --git a/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/ProjectSettingsTabViewController.java b/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/ProjectSettingsTabViewController.java new file mode 100644 index 00000000..c8db54b8 --- /dev/null +++ b/PlayWallCore/src/de/tobias/playpad/viewcontroller/option/ProjectSettingsTabViewController.java @@ -0,0 +1,86 @@ +package de.tobias.playpad.viewcontroller.option; + +import java.util.ResourceBundle; + +import de.tobias.playpad.project.Project; +import de.tobias.playpad.project.ProjectSettings; +import de.tobias.playpad.settings.Profile; +import de.tobias.playpad.viewcontroller.main.IMainViewController; +import de.tobias.utils.ui.ContentViewController; + +/** + * Abstracter Tab für Project Einstellungen. + * + * @author tobias + * + * @since 5.1.0 + * + * @see IProjectSettingsViewController + */ +public abstract class ProjectSettingsTabViewController extends ContentViewController { + + /** + * Erstellt einen neuen Tab. + * + * @param name + * Name der FXML + * @param path + * Pfad zu FXML (ohne Dateiname) + * @param localization + * ResourceBundle oder null + */ + public ProjectSettingsTabViewController(String name, String path, ResourceBundle localization) { + super(name, path, localization); + } + + /** + * Lädt alle Einstellungen vom Model in die GUI. + * + * @param settings + * Aktuelles Project Einstellungen + */ + public abstract void loadSettings(ProjectSettings settings); + + /** + * Speichert alle Änderungen in das Model. + * + * @param settings + * Aktuelles Project Einstellungen + */ + public abstract void saveSettings(ProjectSettings settings); + + /** + * Gibt <code>true</code> zurück, wenn im Hauptprogramm etwas neu geladen werden muss. Der eigentliche Reload wird in + * {@link #reload(Profile, Project, IMainViewController)} ausgeführt. + * + * @return <code>true</code> Benötigt Reload + */ + public abstract boolean needReload(); + + /** + * Lädt gestimmte Einstellungen für die GUI neu. + * + * @param settings + * Aktuelles Project Settings + * @param project + * Aktuelles Projekt + * @param controller + * Main View Controller + */ + public void reload(ProjectSettings settings, Project project, IMainViewController controller) {} + + /** + * Prüft ob die eingetragen Einstellungen erlaubt sind. Bei falschen Eingaben können die Einstellungen nicht geschlossen werden. + * + * @return <code>true</code> Einstellungen erlaubt. <code>false</code> Einstellungen fehlerhaft. + */ + public abstract boolean validSettings(); + + /** + * Gibt den Namen für den Tab zurück. + * + * @return Display Name des Tabs. + */ + public abstract String name(); + +} diff --git a/PlayWallCore/src/de/tobias/playpad/xml/XMLHandler.java b/PlayWallCore/src/de/tobias/playpad/xml/XMLHandler.java index f3b95a47..b106b92f 100644 --- a/PlayWallCore/src/de/tobias/playpad/xml/XMLHandler.java +++ b/PlayWallCore/src/de/tobias/playpad/xml/XMLHandler.java @@ -119,4 +119,13 @@ public class XMLHandler<T> { throw new FileNotFoundException(path.toString()); } } + + /** + * Gibt das RootElement zurück. + * + * @return Root Element + */ + public Element getRootElement() { + return rootElement; + } } diff --git a/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/main/impl/MediaSettingsTabViewController.java b/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/main/impl/MediaSettingsTabViewController.java index bdc355b7..8fc2e1df 100644 --- a/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/main/impl/MediaSettingsTabViewController.java +++ b/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/main/impl/MediaSettingsTabViewController.java @@ -8,7 +8,7 @@ import de.tobias.playpad.mediaplugin.main.VideoSettings; import de.tobias.playpad.project.Project; import de.tobias.playpad.settings.Profile; import de.tobias.playpad.viewcontroller.main.IMainViewController; -import de.tobias.playpad.viewcontroller.option.SettingsTabViewController; +import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController; import javafx.fxml.FXML; import javafx.scene.control.CheckBox; import javafx.scene.control.ComboBox; @@ -19,7 +19,7 @@ import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Screen; -public class MediaSettingsTabViewController extends SettingsTabViewController { +public class MediaSettingsTabViewController extends ProfileSettingsTabViewController { @FXML private Pane screenViewPane; @FXML private ComboBox<Integer> screenComboBox; diff --git a/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/video/VideoContentConntect.java b/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/video/VideoContentConntect.java index 43807c78..4fd611c0 100644 --- a/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/video/VideoContentConntect.java +++ b/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/video/VideoContentConntect.java @@ -8,7 +8,7 @@ import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.pad.conntent.PadContentConnect; import de.tobias.playpad.pad.view.IPadContentView; import de.tobias.playpad.viewcontroller.PadSettingsTabViewController; -import de.tobias.playpad.viewcontroller.option.SettingsTabViewController; +import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController; import de.tobias.utils.ui.icon.FontAwesomeType; import de.tobias.utils.ui.icon.FontIcon; import javafx.beans.property.SimpleStringProperty; @@ -49,7 +49,7 @@ public class VideoContentConntect extends PadContentConnect { } @Override - public SettingsTabViewController getSettingsTabViewController(boolean activePlayer) { + public ProfileSettingsTabViewController getSettingsTabViewController(boolean activePlayer) { MediaPluginImpl instance = MediaPluginImpl.getInstance(); return new MediaSettingsTabViewController(instance.getCurrentSettings()); } -- GitLab