From 46c5394713a49473691ede6a4e822c7893e63463 Mon Sep 17 00:00:00 2001 From: tobias <tobias.ullerich@icloud.com> Date: Tue, 9 Aug 2016 20:53:04 +0200 Subject: [PATCH] Extract Pad Settings into new class PadSettings --- .../src/de/tobias/playpad/PlayPadMain.java | 8 +- .../PadPositionWarningListener.java | 6 +- .../cartaction/PadStatusFeedbackListener.java | 7 +- .../playpad/audio/ClipAudioHandler.java | 4 +- .../playpad/audio/JavaFXAudioHandler.java | 2 +- .../playpad/audio/TinyAudioHandler.java | 4 +- .../design/classic/ClassicGlobalDesign.java | 7 +- .../design/modern/ModernCartDesign.java | 5 +- .../design/modern/ModernGlobalDesign.java | 9 +- .../DesktopMenuToolbarViewController.java | 28 +-- .../layout/desktop/DesktopPadView.java | 25 ++- .../desktop/DesktopPadViewController.java | 9 +- .../layout/touch/TouchPadViewController.java | 7 +- .../playpad/pad/content/AudioContent.java | 32 ++- .../pad/listener/PadPositionListener.java | 18 +- .../main/BasicMenuToolbarViewController.java | 2 +- .../pad/DesignPadTabViewController.java | 20 +- .../pad/GeneralPadTabViewController.java | 33 +-- .../pad/PlayerPadTabViewController.java | 37 ++-- .../pad/TriggerPadTabViewController.java | 2 +- .../WarningFeedbackViewController.java | 6 +- .../action/feedback/ColorAdjuster.java | 4 +- .../src/de/tobias/playpad/pad/Pad.java | 205 +---------------- .../de/tobias/playpad/pad/PadSerializer.java | 54 ++--- .../de/tobias/playpad/pad/PadSettings.java | 208 ++++++++++++++++++ .../tobias/playpad/pad/PadStatusListener.java | 12 +- .../PadTriggerDurationListener.java | 7 +- .../PadTriggerStatusListener.java | 10 +- .../mediaplugin/video/VideoContent.java | 18 +- .../VideoPadSettingsTabViewController.java | 6 +- 30 files changed, 444 insertions(+), 351 deletions(-) create mode 100644 PlayWallCore/src/de/tobias/playpad/pad/PadSettings.java diff --git a/PlayWall/src/de/tobias/playpad/PlayPadMain.java b/PlayWall/src/de/tobias/playpad/PlayPadMain.java index db41cdcf..cdec5baf 100644 --- a/PlayWall/src/de/tobias/playpad/PlayPadMain.java +++ b/PlayWall/src/de/tobias/playpad/PlayPadMain.java @@ -164,9 +164,11 @@ public class PlayPadMain extends Application implements LocalizationDelegate { // Auto Open Project if (getParameters().getRaw().size() > 0) { - UUID uuid = UUID.fromString(getParameters().getNamed().get("project")); - impl.openProject(Project.load(ProjectReference.getProject(uuid), true, null)); - return; + if (getParameters().getNamed().containsKey("project")) { + UUID uuid = UUID.fromString(getParameters().getNamed().get("project")); + impl.openProject(Project.load(ProjectReference.getProject(uuid), true, null)); + return; + } } ViewController.create(LaunchDialog.class, stage); diff --git a/PlayWall/src/de/tobias/playpad/action/cartaction/PadPositionWarningListener.java b/PlayWall/src/de/tobias/playpad/action/cartaction/PadPositionWarningListener.java index 0a3de4b7..7bd14fdc 100644 --- a/PlayWall/src/de/tobias/playpad/action/cartaction/PadPositionWarningListener.java +++ b/PlayWall/src/de/tobias/playpad/action/cartaction/PadPositionWarningListener.java @@ -2,6 +2,7 @@ package de.tobias.playpad.action.cartaction; import de.tobias.playpad.action.feedback.FeedbackMessage; import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.pad.conntent.play.Durationable; import de.tobias.playpad.settings.Warning; import javafx.beans.value.ChangeListener; @@ -29,11 +30,12 @@ public class PadPositionWarningListener implements ChangeListener<Duration> { if (pad != null && pad.isPadVisible()) { if (pad.getContent() instanceof Durationable) { Durationable durationable = (Durationable) pad.getContent(); + PadSettings padSettings = pad.getPadSettings(); // Warning nur wenn kein Loop - if (!pad.isLoop()) { + if (!padSettings.isLoop()) { // Warning - Warning warning = pad.getWarning(); + Warning warning = padSettings.getWarning(); Duration totalDuration = durationable.getDuration(); if (totalDuration != null) { Duration rest = totalDuration.subtract(newValue); diff --git a/PlayWall/src/de/tobias/playpad/action/cartaction/PadStatusFeedbackListener.java b/PlayWall/src/de/tobias/playpad/action/cartaction/PadStatusFeedbackListener.java index 4c5f2fa0..dfafdc97 100644 --- a/PlayWall/src/de/tobias/playpad/action/cartaction/PadStatusFeedbackListener.java +++ b/PlayWall/src/de/tobias/playpad/action/cartaction/PadStatusFeedbackListener.java @@ -2,6 +2,7 @@ package de.tobias.playpad.action.cartaction; import de.tobias.playpad.action.feedback.FeedbackMessage; import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.pad.PadStatus; import de.tobias.playpad.pad.conntent.play.Durationable; import de.tobias.playpad.settings.Warning; @@ -37,8 +38,10 @@ public class PadStatusFeedbackListener implements ChangeListener<PadStatus> { try { if (pad.getContent() instanceof Durationable) { Durationable durationable = (Durationable) pad.getContent(); - if (!pad.isLoop()) { - Warning warning = pad.getWarning(); + PadSettings padSettings = pad.getPadSettings(); + + if (!padSettings.isLoop()) { + Warning warning = padSettings.getWarning(); Duration rest = durationable.getDuration().subtract(durationable.getPosition()); double seconds = rest.toSeconds(); diff --git a/PlayWall/src/de/tobias/playpad/audio/ClipAudioHandler.java b/PlayWall/src/de/tobias/playpad/audio/ClipAudioHandler.java index c31a8bb2..64b3de3e 100644 --- a/PlayWall/src/de/tobias/playpad/audio/ClipAudioHandler.java +++ b/PlayWall/src/de/tobias/playpad/audio/ClipAudioHandler.java @@ -69,7 +69,7 @@ public class ClipAudioHandler extends AudioHandler { if (handler.clip != null) { if (handler.clip.getMicrosecondLength() == handler.clip.getMicrosecondPosition() || !handler.pause || handler.stop) { - if (!pad.isLoop()) { + if (!pad.getPadSettings().isLoop()) { pad.setEof(true); // Remove from Loop and Stop @@ -107,7 +107,7 @@ public class ClipAudioHandler extends AudioHandler { } stop = false; - if (getContent().getPad().isLoop()) + if (getContent().getPad().getPadSettings().isLoop()) clip.loop(Clip.LOOP_CONTINUOUSLY); // Loop else clip.start(); // Einfach Play diff --git a/PlayWall/src/de/tobias/playpad/audio/JavaFXAudioHandler.java b/PlayWall/src/de/tobias/playpad/audio/JavaFXAudioHandler.java index c2424837..4792e37a 100644 --- a/PlayWall/src/de/tobias/playpad/audio/JavaFXAudioHandler.java +++ b/PlayWall/src/de/tobias/playpad/audio/JavaFXAudioHandler.java @@ -134,7 +134,7 @@ public class JavaFXAudioHandler extends AudioHandler implements Equalizable { }); player.setOnEndOfMedia(() -> { - if (!getContent().getPad().isLoop()) { + if (!getContent().getPad().getPadSettings().isLoop()) { getContent().getPad().setEof(true); getContent().getPad().setStatus(PadStatus.STOP); } else { diff --git a/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandler.java b/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandler.java index 88a9b8d2..7bf652f8 100644 --- a/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandler.java +++ b/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandler.java @@ -66,7 +66,7 @@ public class TinyAudioHandler extends AudioHandler { if (handler.music != null) { if (!handler.music.playing()) { - if (!pad.isLoop()) { + if (!pad.getPadSettings().isLoop()) { pad.setEof(true); // Remove from Loop and Stop @@ -126,7 +126,7 @@ public class TinyAudioHandler extends AudioHandler { public void play() { if (music != null) { if (!pause) { - if (!getContent().getPad().isLoop()) { + if (!getContent().getPad().getPadSettings().isLoop()) { music.play(false); // Kein Loop } else { music.play(true); // Mit Loop diff --git a/PlayWall/src/de/tobias/playpad/design/classic/ClassicGlobalDesign.java b/PlayWall/src/de/tobias/playpad/design/classic/ClassicGlobalDesign.java index a8d6a00d..93bfe076 100644 --- a/PlayWall/src/de/tobias/playpad/design/classic/ClassicGlobalDesign.java +++ b/PlayWall/src/de/tobias/playpad/design/classic/ClassicGlobalDesign.java @@ -11,6 +11,7 @@ import de.tobias.playpad.design.CartDesign; import de.tobias.playpad.design.Design; import de.tobias.playpad.design.GlobalDesign; import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.pad.view.IPadViewV2; import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; import de.tobias.playpad.project.Project; @@ -324,8 +325,10 @@ public class ClassicGlobalDesign extends Design implements GlobalDesign { // Pad Spezelles Layout immer for (Pad pad : project.getPads().values()) { - if (pad.isCustomLayout()) { - CartDesign layoutOpt = pad.getLayout(); + PadSettings padSettings = pad.getPadSettings(); + + if (padSettings.isCustomLayout()) { + CartDesign layoutOpt = padSettings.getLayout(); css += "\n" + layoutOpt.convertToCss(String.valueOf(pad.getIndex()), true); } } diff --git a/PlayWall/src/de/tobias/playpad/design/modern/ModernCartDesign.java b/PlayWall/src/de/tobias/playpad/design/modern/ModernCartDesign.java index bc5d49f3..a669ac9f 100644 --- a/PlayWall/src/de/tobias/playpad/design/modern/ModernCartDesign.java +++ b/PlayWall/src/de/tobias/playpad/design/modern/ModernCartDesign.java @@ -96,8 +96,9 @@ public class ModernCartDesign extends Design implements CartDesign, DesignColorA Pad pad = controller.getPad(); if (pad.getContent() instanceof Durationable) { - if (warnDuration.greaterThan(((Durationable) pad.getContent()).getDuration())) { - warnDuration = ((Durationable) pad.getContent()).getDuration(); + Duration padDuration = ((Durationable) pad.getContent()).getDuration(); + if (warnDuration.greaterThan(padDuration)) { + warnDuration = padDuration; } } diff --git a/PlayWall/src/de/tobias/playpad/design/modern/ModernGlobalDesign.java b/PlayWall/src/de/tobias/playpad/design/modern/ModernGlobalDesign.java index 70558a0a..1a274e58 100644 --- a/PlayWall/src/de/tobias/playpad/design/modern/ModernGlobalDesign.java +++ b/PlayWall/src/de/tobias/playpad/design/modern/ModernGlobalDesign.java @@ -13,6 +13,7 @@ import de.tobias.playpad.design.DesignColorAssociator; import de.tobias.playpad.design.FadeableColor; import de.tobias.playpad.design.GlobalDesign; import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.pad.conntent.play.Durationable; import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; import de.tobias.playpad.project.Project; @@ -105,7 +106,7 @@ public class ModernGlobalDesign extends Design implements GlobalDesign, DesignCo playColor = ModernColor.RED1; isWarnAnimation = true; - + infoFontSize = 14; titleFontSize = 16; } @@ -195,8 +196,10 @@ public class ModernGlobalDesign extends Design implements GlobalDesign, DesignCo // Pad Spezelles Layout immer for (Pad pad : project.getPads().values()) { - if (pad.isCustomLayout()) { - CartDesign layoutOpt = pad.getLayout(Profile.currentProfile().getProfileSettings().getLayoutType()); + PadSettings padSettings = pad.getPadSettings(); + + if (padSettings.isCustomLayout()) { + CartDesign layoutOpt = padSettings.getLayout(Profile.currentProfile().getProfileSettings().getLayoutType()); css += "\n" + layoutOpt.convertToCss(String.valueOf(pad.getIndex()), true); } } diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java index 4ddc191b..8ee475ff 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java @@ -15,6 +15,7 @@ import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.Strings; import de.tobias.playpad.midi.Midi; +import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.PadStatus; import de.tobias.playpad.pad.view.IPadViewV2; import de.tobias.playpad.project.Project; @@ -116,6 +117,7 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro @Override public void init() { + super.init(); toolbarHBox.prefWidthProperty().bind(toolbar.widthProperty().subtract(25)); toolbarHBox.prefHeightProperty().bind(toolbar.minHeightProperty()); @@ -184,20 +186,20 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro @Override public void loadKeybinding(KeyCollection keys) { - setKeyBindinfForMenu(newProjectMenuItem, keys.getKey("new_proj")); - setKeyBindinfForMenu(openProjectMenuItem, keys.getKey("open_proj")); - setKeyBindinfForMenu(saveProjectMenuItem, keys.getKey("save_proj")); - setKeyBindinfForMenu(printProjectMenuItem, keys.getKey("print_proj")); + setKeyBindingForMenu(newProjectMenuItem, keys.getKey("new_proj")); + setKeyBindingForMenu(openProjectMenuItem, keys.getKey("open_proj")); + setKeyBindingForMenu(saveProjectMenuItem, keys.getKey("save_proj")); + setKeyBindingForMenu(printProjectMenuItem, keys.getKey("print_proj")); - setKeyBindinfForMenu(dndModeMenuItem, keys.getKey("dnd")); - setKeyBindinfForMenu(errorMenu, keys.getKey("errors")); - setKeyBindinfForMenu(pluginMenu, keys.getKey("plugins")); - setKeyBindinfForMenu(settingsMenuItem, keys.getKey("profile_settings")); - setKeyBindinfForMenu(globalSettingsMenuItem, keys.getKey("global_settings")); + setKeyBindingForMenu(dndModeMenuItem, keys.getKey("dnd")); + setKeyBindingForMenu(errorMenu, keys.getKey("errors")); + setKeyBindingForMenu(pluginMenu, keys.getKey("plugins")); + setKeyBindingForMenu(settingsMenuItem, keys.getKey("profile_settings")); + setKeyBindingForMenu(globalSettingsMenuItem, keys.getKey("global_settings")); - setKeyBindinfForMenu(fullScreenMenuItem, keys.getKey("window_fullscreen")); - setKeyBindinfForMenu(alwaysOnTopItem, keys.getKey("window_top")); - setKeyBindinfForMenu(searchPadMenuItem, keys.getKey("search_pad")); + setKeyBindingForMenu(fullScreenMenuItem, keys.getKey("window_fullscreen")); + setKeyBindingForMenu(alwaysOnTopItem, keys.getKey("window_top")); + setKeyBindingForMenu(searchPadMenuItem, keys.getKey("search_pad")); newProjectMenuItem.setDisable(false); openProjectMenuItem.setDisable(false); @@ -544,7 +546,7 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro // Auto Complete Project currentProject = PlayPadMain.getProgramInstance().getCurrentProject(); - Set<String> names = currentProject.getPads().values().stream().filter(p -> p.getStatus() != PadStatus.EMPTY).map(p -> p.getName()) + Set<String> names = currentProject.getPads().values().stream().filter(p -> p.getStatus() != PadStatus.EMPTY).map(Pad::getName) .collect(Collectors.toSet()); TextFields.bindAutoCompletion(field, names); } diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadView.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadView.java index 9ffa83c1..5d7a4f79 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadView.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadView.java @@ -2,9 +2,6 @@ package de.tobias.playpad.layout.desktop; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.PseudoClasses; -import de.tobias.playpad.design.FadeableColor; -import de.tobias.playpad.design.modern.ModernColor; -import de.tobias.playpad.design.modern.ModernDesignAnimator; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.PadContentRegistry; import de.tobias.playpad.pad.conntent.PadContent; @@ -18,6 +15,7 @@ import de.tobias.playpad.view.EmptyPadView; import de.tobias.utils.ui.icon.FontAwesomeType; import de.tobias.utils.ui.icon.FontIcon; import de.tobias.utils.ui.scene.BusyView; +import de.tobias.utils.ui.translation.PulseTranslation; import javafx.beans.property.Property; import javafx.css.PseudoClass; import javafx.geometry.Pos; @@ -31,7 +29,6 @@ import javafx.scene.layout.Priority; import javafx.scene.layout.Region; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; -import javafx.util.Duration; public class DesktopPadView implements IPadViewV2 { @@ -368,10 +365,22 @@ public class DesktopPadView implements IPadViewV2 { @Override public void highlightView(int milliSecounds) { - FadeableColor stopColor = new FadeableColor(ModernColor.GRAY1.getColorHi(), ModernColor.GRAY1.getColorLow()); - FadeableColor playColor = new FadeableColor(ModernColor.BLUE1.getColorHi(), ModernColor.BLUE1.getColorLow()); - - ModernDesignAnimator.animateWarn(controller, stopColor, playColor, Duration.seconds(2)); + // FadeableColor stopColor = new FadeableColor(ModernColor.GRAY1.getColorHi(), ModernColor.GRAY1.getColorLow()); + // FadeableColor playColor = new FadeableColor(ModernColor.BLUE1.getColorHi(), ModernColor.BLUE1.getColorLow()); + // + // ModernDesignAnimator.animateWarn(controller, stopColor, playColor, Duration.seconds(3)); + // Pad pad = controller.getPad(); + // + // Warning warning = pad.getWarning(); + // + // if (pad.isCustomLayout()) { + // pad.getLayout().handleWarning(controller, warning, Profile.currentProfile().currentLayout()); + // } else { + // Profile.currentProfile().currentLayout().handleWarning(controller, warning); + // } + + PulseTranslation pulseTranslation = new PulseTranslation(superRoot, null, 0.1); + pulseTranslation.play(); } public void clearIndex() { diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java index a7781820..0ae505cf 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java @@ -91,9 +91,8 @@ public class DesktopPadViewController implements IPadViewControllerV2, EventHand try { // Settings padView.setIndex(pad.getIndexReadable()); - padView.loopLabelVisibleProperty().bind(pad.loopProperty()); - - padView.setTriggerLabelActive(pad.hasTriggerItems()); + padView.loopLabelVisibleProperty().bind(pad.getPadSettings().loopProperty()); + padView.setTriggerLabelActive(pad.getPadSettings().hasTriggerItems()); // Update Listener padContentListener.setPad(pad); @@ -270,7 +269,7 @@ public class DesktopPadViewController implements IPadViewControllerV2, EventHand padSettingsViewController.getStage().setOnHiding(ev -> { if (padView != null && pad != null) - padView.setTriggerLabelActive(pad.hasTriggerItems()); + padView.setTriggerLabelActive(pad.getPadSettings().hasTriggerItems()); }); } padSettingsViewController.getStage().show(); @@ -294,7 +293,7 @@ public class DesktopPadViewController implements IPadViewControllerV2, EventHand padView.getPlayBar().setProgress(0); } else { // Play/Gesamtzeit anzeigen - TimeMode timeMode = pad.getTimeMode(); + TimeMode timeMode = pad.getPadSettings().getTimeMode(); if (timeMode == TimeMode.REST) { Duration leftTime = duration.subtract(position); diff --git a/PlayWall/src/de/tobias/playpad/layout/touch/TouchPadViewController.java b/PlayWall/src/de/tobias/playpad/layout/touch/TouchPadViewController.java index 021a68a2..0e93545f 100644 --- a/PlayWall/src/de/tobias/playpad/layout/touch/TouchPadViewController.java +++ b/PlayWall/src/de/tobias/playpad/layout/touch/TouchPadViewController.java @@ -72,9 +72,8 @@ public class TouchPadViewController implements IPadViewControllerV2, EventHandle try { // Settings padView.setIndex(pad.getIndexReadable()); - padView.loopLabelVisibleProperty().bind(pad.loopProperty()); - - padView.setTriggerLabelActive(pad.hasTriggerItems()); + padView.loopLabelVisibleProperty().bind(pad.getPadSettings().loopProperty()); + padView.setTriggerLabelActive(pad.getPadSettings().hasTriggerItems()); // Update Listener padContentListener.setPad(pad); @@ -176,7 +175,7 @@ public class TouchPadViewController implements IPadViewControllerV2, EventHandle padView.getPlayBar().setProgress(0); } else { // Play/Gesamtzeit anzeigen - TimeMode timeMode = pad.getTimeMode(); + TimeMode timeMode = pad.getPadSettings().getTimeMode(); if (timeMode == TimeMode.REST) { Duration leftTime = duration.subtract(position); diff --git a/PlayWall/src/de/tobias/playpad/pad/content/AudioContent.java b/PlayWall/src/de/tobias/playpad/pad/content/AudioContent.java index 04c87a95..f9fc5e94 100644 --- a/PlayWall/src/de/tobias/playpad/pad/content/AudioContent.java +++ b/PlayWall/src/de/tobias/playpad/pad/content/AudioContent.java @@ -12,6 +12,7 @@ import de.tobias.playpad.audio.AudioHandler; import de.tobias.playpad.audio.AudioRegistry; import de.tobias.playpad.audio.Equalizable; import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.pad.PadStatus; import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.pad.conntent.path.SinglePathContent; @@ -21,6 +22,7 @@ import de.tobias.playpad.pad.conntent.play.Pauseable; import de.tobias.playpad.project.ProjectExporter; import de.tobias.playpad.registry.NoSuchComponentException; import de.tobias.playpad.settings.Profile; +import de.tobias.playpad.settings.ProfileSettings; import de.tobias.utils.util.ZipFile; import javafx.animation.Transition; import javafx.application.Platform; @@ -51,11 +53,13 @@ public class AudioContent extends PadContent implements Pauseable, Durationable, super(pad); volumeListener = (a, b, c) -> { - audioHandler.setVolume(c.doubleValue(), Profile.currentProfile().getProfileSettings().getVolume(), pad.getCustomVolume()); + ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings(); + audioHandler.setVolume(c.doubleValue(), profileSettings.getVolume(), pad.getCustomVolume()); }; customVolumeListener = (a, b, c) -> { - audioHandler.setVolume(pad.getVolume(), Profile.currentProfile().getProfileSettings().getVolume(), c.doubleValue()); + ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings(); + audioHandler.setVolume(pad.getPadSettings().getVolume(), profileSettings.getVolume(), c.doubleValue()); }; } @@ -78,7 +82,7 @@ public class AudioContent extends PadContent implements Pauseable, Durationable, @Override public void setMasterVolume(double masterVolume) { if (audioHandler != null) { - audioHandler.setVolume(getPad().getVolume(), masterVolume, getPad().getCustomVolume()); + audioHandler.setVolume(getPad().getPadSettings().getVolume(), masterVolume, getPad().getCustomVolume()); } } @@ -113,18 +117,18 @@ public class AudioContent extends PadContent implements Pauseable, Durationable, Pad pad = getPad(); - if (pad.getFade().getFadeIn().toMillis() > 0) { + if (pad.getPadSettings().getFade().getFadeIn().toMillis() > 0) { double masterVolume = Profile.currentProfile().getProfileSettings().getVolume(); audioHandler.setVolume(0, masterVolume, pad.getCustomVolume()); transition = new Transition() { { - setCycleDuration(pad.getFade().getFadeIn()); + setCycleDuration(pad.getPadSettings().getFade().getFadeIn()); } @Override protected void interpolate(double frac) { - audioHandler.setVolume(frac * pad.getVolume(), masterVolume, pad.getCustomVolume()); + audioHandler.setVolume(frac * pad.getPadSettings().getVolume(), masterVolume, pad.getCustomVolume()); } }; transition.setOnFinished(e -> @@ -141,17 +145,19 @@ public class AudioContent extends PadContent implements Pauseable, Durationable, transition.stop(); } - if (getPad().getFade().getFadeOut().toMillis() > 0) { + if (getPad().getPadSettings().getFade().getFadeOut().toMillis() > 0) { transition = new Transition() { { - setCycleDuration(getPad().getFade().getFadeOut()); + setCycleDuration(getPad().getPadSettings().getFade().getFadeOut()); } @Override protected void interpolate(double frac) { double masterVolume = Profile.currentProfile().getProfileSettings().getVolume(); - audioHandler.setVolume(getPad().getVolume() - frac * getPad().getVolume(), masterVolume, getPad().getCustomVolume()); + PadSettings padSettings = getPad().getPadSettings(); + + audioHandler.setVolume(padSettings.getVolume() - frac * padSettings.getVolume(), masterVolume, getPad().getCustomVolume()); } }; transition.setOnFinished(event -> @@ -159,7 +165,9 @@ public class AudioContent extends PadContent implements Pauseable, Durationable, onFinish.run(); double masterVolume = Profile.currentProfile().getProfileSettings().getVolume(); - audioHandler.setVolume(getPad().getVolume(), masterVolume, getPad().getCustomVolume()); + PadSettings padSettings = getPad().getPadSettings(); + + audioHandler.setVolume(padSettings.getVolume(), masterVolume, getPad().getCustomVolume()); transition = null; }); transition.play(); @@ -221,7 +229,7 @@ public class AudioContent extends PadContent implements Pauseable, Durationable, durationProperty.bind(audioHandler.durationProperty()); positionProperty.bind(audioHandler.positionProperty()); - getPad().volumeProperty().addListener(volumeListener); + getPad().getPadSettings().volumeProperty().addListener(volumeListener); getPad().customVolumeProperty().addListener(customVolumeListener); } else { getPad().throwException(path, new FileNotFoundException()); @@ -233,7 +241,7 @@ public class AudioContent extends PadContent implements Pauseable, Durationable, durationProperty.unbind(); positionProperty.unbind(); - getPad().volumeProperty().removeListener(volumeListener); + getPad().getPadSettings().volumeProperty().removeListener(volumeListener); getPad().customVolumeProperty().removeListener(customVolumeListener); if (audioHandler != null) diff --git a/PlayWall/src/de/tobias/playpad/pad/listener/PadPositionListener.java b/PlayWall/src/de/tobias/playpad/pad/listener/PadPositionListener.java index 27b674a5..1f8b3486 100644 --- a/PlayWall/src/de/tobias/playpad/pad/listener/PadPositionListener.java +++ b/PlayWall/src/de/tobias/playpad/pad/listener/PadPositionListener.java @@ -1,6 +1,7 @@ package de.tobias.playpad.pad.listener; import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.pad.PadStatus; import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.pad.conntent.play.Durationable; @@ -63,9 +64,9 @@ public class PadPositionListener implements Runnable, IPadPositionListener { // Warning nur wenn kein Loop und nur wenn Play, da sonst schon anderer Zustand und Warning nicht mehr richtig Reseted // wird - if (!pad.isLoop() && pad.getStatus() == PadStatus.PLAY) { + if (!pad.getPadSettings().isLoop() && pad.getStatus() == PadStatus.PLAY) { // Warning - Warning warning = pad.getWarning(); + Warning warning = pad.getPadSettings().getWarning(); Duration rest = durationable.getDuration().subtract(newValue); double seconds = rest.toSeconds(); @@ -86,10 +87,11 @@ public class PadPositionListener implements Runnable, IPadPositionListener { */ @Override public void run() { - Warning warning = pad.getWarning(); + PadSettings padSettings = pad.getPadSettings(); + Warning warning = padSettings.getWarning(); - if (pad.isCustomLayout()) { - pad.getLayout().handleWarning(controller, warning, Profile.currentProfile().currentLayout()); + if (padSettings.isCustomLayout()) { + padSettings.getLayout().handleWarning(controller, warning, Profile.currentProfile().currentLayout()); } else { Profile.currentProfile().currentLayout().handleWarning(controller, warning); } @@ -110,8 +112,10 @@ public class PadPositionListener implements Runnable, IPadPositionListener { warningThread = null; } - if (pad.isCustomLayout()) { - pad.getLayout().stopWarning(controller); + PadSettings padSettings = pad.getPadSettings(); + + if (padSettings.isCustomLayout()) { + padSettings.getLayout().stopWarning(controller); } else { Profile.currentProfile().currentLayout().stopWarning(controller); } diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/main/BasicMenuToolbarViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/main/BasicMenuToolbarViewController.java index 7f02c063..b8dc9a9b 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/main/BasicMenuToolbarViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/main/BasicMenuToolbarViewController.java @@ -62,7 +62,7 @@ public abstract class BasicMenuToolbarViewController extends MenuToolbarViewCont } } - protected void setKeyBindinfForMenu(MenuItem menuItem, Key key) { + protected void setKeyBindingForMenu(MenuItem menuItem, Key key) { if (key != null) { if (!key.getKeyCode().isEmpty()) { KeyCombination keyCode = KeyCombination.valueOf(key.getKeyCode()); 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 91a2011c..ad920ab0 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/DesignPadTabViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/DesignPadTabViewController.java @@ -11,6 +11,7 @@ import de.tobias.playpad.action.connect.CartActionConnect; import de.tobias.playpad.design.CartDesign; import de.tobias.playpad.design.DesignConnect; import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.registry.NoSuchComponentException; import de.tobias.playpad.settings.Profile; import de.tobias.playpad.viewcontroller.CartDesignViewController; @@ -48,12 +49,13 @@ public class DesignPadTabViewController extends PadSettingsTabViewController { public void init() { enableLayoutCheckBox.selectedProperty().addListener((a, b, c) -> { - if (c && !pad.isCustomLayout()) { + PadSettings padSettings = pad.getPadSettings(); + if (c && !padSettings.isCustomLayout()) { try { - pad.setCustomLayout(true); + padSettings.setCustomLayout(true); String layoutType = Profile.currentProfile().getProfileSettings().getLayoutType(); - CartDesign layout = pad.getLayout(layoutType); + CartDesign layout = padSettings.getLayout(layoutType); layout.copyGlobalLayout(Profile.currentProfile().getLayout(layoutType)); setLayoutViewController(pad); @@ -61,8 +63,8 @@ public class DesignPadTabViewController extends PadSettingsTabViewController { showErrorMessage(Localization.getString(Strings.Error_Standard_Gen, e.getLocalizedMessage())); e.printStackTrace(); } - } else if (!c && pad.isCustomLayout()) { - pad.setCustomLayout(false); + } else if (!c && padSettings.isCustomLayout()) { + padSettings.setCustomLayout(false); setLayoutController(null); } }); @@ -75,8 +77,10 @@ public class DesignPadTabViewController extends PadSettingsTabViewController { @Override public void loadSettings(Pad pad) { - enableLayoutCheckBox.setSelected(pad.isCustomLayout()); - if (pad.isCustomLayout()) { + PadSettings padSettings = pad.getPadSettings(); + + enableLayoutCheckBox.setSelected(padSettings.isCustomLayout()); + if (padSettings.isCustomLayout()) { setLayoutViewController(pad); } } @@ -84,7 +88,7 @@ public class DesignPadTabViewController extends PadSettingsTabViewController { private void setLayoutViewController(Pad pad) { try { String layoutType = Profile.currentProfile().getProfileSettings().getLayoutType(); - CartDesign layout = pad.getLayout(layoutType); + CartDesign layout = pad.getPadSettings().getLayout(layoutType); DesignConnect component = PlayPadPlugin.getRegistryCollection().getDesigns().getComponent(layoutType); CartDesignViewController controller = component.getCartDesignViewController(layout); diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/GeneralPadTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/GeneralPadTabViewController.java index b42cd884..ea172c2a 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/GeneralPadTabViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/GeneralPadTabViewController.java @@ -3,6 +3,7 @@ package de.tobias.playpad.viewcontroller.option.pad; import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.Strings; import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.pad.PadStatus; import de.tobias.playpad.pad.TimeMode; import de.tobias.playpad.viewcontroller.PadSettingsTabViewController; @@ -36,7 +37,7 @@ public class GeneralPadTabViewController extends PadSettingsTabViewController { public GeneralPadTabViewController(Pad pad) { super("generalTab", "de/tobias/playpad/assets/view/option/pad/", PlayPadMain.getUiResourceBundle()); this.pad = pad; - + if (pad.getStatus() == PadStatus.PLAY || pad.getStatus() == PadStatus.PAUSE) { deleteButton.setDisable(true); } @@ -45,17 +46,19 @@ public class GeneralPadTabViewController extends PadSettingsTabViewController { @Override public void init() { // Init Listener - volumeListener = (a, b, c) -> pad.setVolume(c.doubleValue() / 100.0); + volumeListener = (a, b, c) -> pad.getPadSettings().setVolume(c.doubleValue() / 100.0); volumeSlider.valueProperty().addListener(volumeListener); customTimeDisplayCheckBox.selectedProperty().addListener((a, b, c) -> { + PadSettings padSettings = pad.getPadSettings(); + timeDisplayComboBox.setDisable(!c); - if (c && !pad.isCustomTimeMode()) - pad.setTimeMode(TimeMode.REST); - else if (b && pad.isCustomTimeMode()) - pad.setTimeMode(null); + if (c && !padSettings.isCustomTimeMode()) + padSettings.setTimeMode(TimeMode.REST); + else if (b && padSettings.isCustomTimeMode()) + padSettings.setTimeMode(null); }); timeDisplayComboBox.getItems().addAll(TimeMode.values()); @@ -70,25 +73,29 @@ public class GeneralPadTabViewController extends PadSettingsTabViewController { @Override public void loadSettings(Pad pad) { + PadSettings padSettings = pad.getPadSettings(); + // Bindings titleTextField.textProperty().bindBidirectional(pad.nameProperty()); - repeatCheckBox.selectedProperty().bindBidirectional(pad.loopProperty()); - timeDisplayComboBox.valueProperty().bindBidirectional(pad.timeModeProperty()); + repeatCheckBox.selectedProperty().bindBidirectional(padSettings.loopProperty()); + timeDisplayComboBox.valueProperty().bindBidirectional(padSettings.timeModeProperty()); - volumeSlider.setValue(pad.getVolume() * 100); + volumeSlider.setValue(padSettings.getVolume() * 100); // is Custom TimeMode Actvie - customTimeDisplayCheckBox.setSelected(pad.isCustomTimeMode()); - if (!pad.isCustomTimeMode()) { + customTimeDisplayCheckBox.setSelected(padSettings.isCustomTimeMode()); + if (!padSettings.isCustomTimeMode()) { timeDisplayComboBox.setDisable(true); } } @Override public void saveSettings(Pad pad) { + PadSettings padSettings = pad.getPadSettings(); + titleTextField.textProperty().unbindBidirectional(pad.nameProperty()); - repeatCheckBox.selectedProperty().unbindBidirectional(pad.loopProperty()); - timeDisplayComboBox.valueProperty().unbindBidirectional(pad.timeModeProperty()); + repeatCheckBox.selectedProperty().unbindBidirectional(padSettings.loopProperty()); + timeDisplayComboBox.valueProperty().unbindBidirectional(padSettings.timeModeProperty()); } // Listener diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/PlayerPadTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/PlayerPadTabViewController.java index 4cae57b1..87575437 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/PlayerPadTabViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/PlayerPadTabViewController.java @@ -3,6 +3,7 @@ package de.tobias.playpad.viewcontroller.option.pad; import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.Strings; import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.settings.Fade; import de.tobias.playpad.settings.Warning; import de.tobias.playpad.viewcontroller.PadSettingsTabViewController; @@ -42,22 +43,26 @@ public class PlayerPadTabViewController extends PadSettingsTabViewController { customFadeCheckBox.selectedProperty().addListener((a, b, c) -> { fadeContainer.setDisable(!c); - if (c && !pad.isCustomFade()) - pad.setFade(new Fade()); - else if (!c && pad.isCustomFade()) - pad.setFade(null); + PadSettings padSettings = pad.getPadSettings(); + + if (c && !padSettings.isCustomFade()) + padSettings.setFade(new Fade()); + else if (!c && padSettings.isCustomFade()) + padSettings.setFade(null); if (c) - fadeViewController.setFade(pad.getFade()); + fadeViewController.setFade(padSettings.getFade()); }); warningEnableCheckBox.selectedProperty().addListener((a, b, c) -> { warningFeedbackContainer.setDisable(!c); - if (c && !pad.isCustomWarning()) - pad.setWarning(new Warning()); - else if (!c && pad.isCustomWarning()) - pad.setWarning(null); + PadSettings padSettings = pad.getPadSettings(); + + if (c && !padSettings.isCustomWarning()) + padSettings.setWarning(new Warning()); + else if (!c && padSettings.isCustomWarning()) + padSettings.setWarning(null); if (c) warningFeedbackViewController.setPadWarning(pad); @@ -71,16 +76,18 @@ public class PlayerPadTabViewController extends PadSettingsTabViewController { @Override public void loadSettings(Pad pad) { - if (pad.isCustomFade()) - fadeViewController.setFade(pad.getFade()); + PadSettings padSettings = pad.getPadSettings(); + + if (padSettings.isCustomFade()) + fadeViewController.setFade(padSettings.getFade()); - customFadeCheckBox.setSelected(pad.isCustomFade()); - if (!pad.isCustomFade()) { + customFadeCheckBox.setSelected(padSettings.isCustomFade()); + if (!padSettings.isCustomFade()) { fadeContainer.setDisable(true); } - warningEnableCheckBox.setSelected(pad.isCustomWarning()); - if (!pad.isCustomWarning()) { + warningEnableCheckBox.setSelected(padSettings.isCustomWarning()); + if (!padSettings.isCustomWarning()) { warningFeedbackContainer.setDisable(true); } } diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/TriggerPadTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/TriggerPadTabViewController.java index 6f28cfd4..49df6c48 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/TriggerPadTabViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/pad/TriggerPadTabViewController.java @@ -39,7 +39,7 @@ public class TriggerPadTabViewController extends PadSettingsTabViewController im } private void createTreeView() { - HashMap<TriggerPoint, Trigger> triggers = pad.getTriggers(); + HashMap<TriggerPoint, Trigger> triggers = pad.getPadSettings().getTriggers(); TreeItem<TriggerUIWrapper> rootItem = new TreeItem<>(); // Sort the tpyes for the treeview diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/settings/WarningFeedbackViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/settings/WarningFeedbackViewController.java index f09d2e2d..ff0bb390 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/settings/WarningFeedbackViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/settings/WarningFeedbackViewController.java @@ -48,14 +48,14 @@ public class WarningFeedbackViewController extends ContentViewController { } public void setPadWarning(Pad pad) { - if (pad.getWarning() != null) { - warningFeedbackTimeSlider.setValue(pad.getWarning().getTime().toSeconds()); + if (pad.getPadSettings().getWarning() != null) { + warningFeedbackTimeSlider.setValue(pad.getPadSettings().getWarning().getTime().toSeconds()); setTimeLabel(); } warningFeedbackTimeSlider.valueProperty().addListener((a, b, c) -> { - pad.getWarning().setTime(Duration.seconds(c.doubleValue())); + pad.getPadSettings().getWarning().setTime(Duration.seconds(c.doubleValue())); }); } } diff --git a/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjuster.java b/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjuster.java index 2a5c0b1d..8de61e0d 100644 --- a/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjuster.java +++ b/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjuster.java @@ -61,8 +61,8 @@ public class ColorAdjuster { Color layoutStdColor = null; Color layoutEvColor = null; - if (pad.isCustomLayout()) { - CartDesign layout = pad.getLayout(); + if (pad.getPadSettings().isCustomLayout()) { + CartDesign layout = pad.getPadSettings().getLayout(); if (layout instanceof DesignColorAssociator) { DesignColorAssociator associator = (DesignColorAssociator) layout; layoutStdColor = associator.getAssociatedStandardColor(); diff --git a/PlayWallCore/src/de/tobias/playpad/pad/Pad.java b/PlayWallCore/src/de/tobias/playpad/pad/Pad.java index 585cba77..7d80ebb5 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/Pad.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/Pad.java @@ -1,11 +1,7 @@ package de.tobias.playpad.pad; import java.nio.file.Path; -import java.util.HashMap; -import de.tobias.playpad.PlayPadPlugin; -import de.tobias.playpad.design.CartDesign; -import de.tobias.playpad.design.DesignConnect; import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.pad.conntent.play.Pauseable; import de.tobias.playpad.pad.triggerlistener.PadTriggerContentListener; @@ -13,20 +9,11 @@ import de.tobias.playpad.pad.triggerlistener.PadTriggerDurationListener; import de.tobias.playpad.pad.triggerlistener.PadTriggerStatusListener; import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; import de.tobias.playpad.project.Project; -import de.tobias.playpad.registry.DefaultRegistry; import de.tobias.playpad.registry.NoSuchComponentException; -import de.tobias.playpad.settings.Fade; -import de.tobias.playpad.settings.Profile; -import de.tobias.playpad.settings.Warning; -import de.tobias.playpad.tigger.Trigger; -import de.tobias.playpad.tigger.TriggerPoint; -import javafx.beans.binding.BooleanBinding; -import javafx.beans.property.BooleanProperty; import javafx.beans.property.DoubleProperty; import javafx.beans.property.IntegerProperty; import javafx.beans.property.ObjectProperty; import javafx.beans.property.ReadOnlyIntegerProperty; -import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleDoubleProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleObjectProperty; @@ -35,26 +22,16 @@ import javafx.beans.property.StringProperty; public class Pad { + // Verwaltung private IntegerProperty indexProperty = new SimpleIntegerProperty(); private StringProperty nameProperty = new SimpleStringProperty(); private ObjectProperty<PadStatus> statusProperty = new SimpleObjectProperty<>(PadStatus.EMPTY); + // Content private ObjectProperty<PadContent> contentProperty = new SimpleObjectProperty<>(); // Settings - private DoubleProperty volumeProperty = new SimpleDoubleProperty(1.0); - private BooleanProperty loopProperty = new SimpleBooleanProperty(false); - private ObjectProperty<TimeMode> timeModeProperty = new SimpleObjectProperty<>(); - private ObjectProperty<Fade> fadeProperty = new SimpleObjectProperty<>(); - private ObjectProperty<Warning> warningProperty = new SimpleObjectProperty<>(); - - private BooleanProperty customLayoutProperty = new SimpleBooleanProperty(false); - private HashMap<String, CartDesign> layouts = new HashMap<>(); - - private HashMap<String, Object> customSettings = new HashMap<>(); - - // Trigger - private HashMap<TriggerPoint, Trigger> triggers = new HashMap<>(); + private PadSettings padSettings; // Custom Volume private transient DoubleProperty customVolumeProperty = new SimpleDoubleProperty(1.0); @@ -75,6 +52,7 @@ public class Pad { public Pad(Project project) { this.project = project; + padSettings = new PadSettings(); initPadListener(); // Update Trigger ist nicht notwendig, da es in load(Element) ausgerufen wird @@ -82,11 +60,13 @@ public class Pad { public Pad(Project project, int index) { this.project = project; + padSettings = new PadSettings(); + setIndex(index); setStatus(PadStatus.EMPTY); initPadListener(); - updateTrigger(); + padSettings.updateTrigger(); } public Pad(Project project, int index, String name, PadContent content) { @@ -106,6 +86,7 @@ public class Pad { // Das ist für die Position Listener notwendig, wenn sich der Content ändert padTriggerContentListener = new PadTriggerContentListener(this); + contentProperty.addListener(padTriggerContentListener); padTriggerContentListener.changed(contentProperty, null, getContent()); } @@ -181,12 +162,8 @@ public class Pad { return contentProperty; } - public double getVolume() { - return volumeProperty.get(); - } - - public void setVolume(double volume) { - volumeProperty.set(volume); + public PadSettings getPadSettings() { + return padSettings; } public void setMasterVolume(double volume) { @@ -195,135 +172,6 @@ public class Pad { } } - public DoubleProperty volumeProperty() { - return volumeProperty; - } - - public boolean isLoop() { - return loopProperty.get(); - } - - public void setLoop(boolean loop) { - this.loopProperty.set(loop); - } - - public BooleanProperty loopProperty() { - return loopProperty; - } - - public boolean isCustomTimeMode() { - return timeModeProperty.isNotNull().get(); - } - - public BooleanBinding customTimeModeProperty() { - return timeModeProperty.isNotNull(); - } - - public TimeMode getTimeMode() { - if (timeModeProperty.isNull().get()) { - if (Profile.currentProfile() != null) { - return Profile.currentProfile().getProfileSettings().getPlayerTimeDisplayMode(); - } - } - return timeModeProperty.get(); - } - - public void setTimeMode(TimeMode timeMode) { - this.timeModeProperty.set(timeMode); - } - - public ObjectProperty<TimeMode> timeModeProperty() { - return timeModeProperty; - } - - public boolean isCustomFade() { - return fadeProperty.isNotNull().get(); - } - - public BooleanBinding customFadeProperty() { - return fadeProperty.isNotNull(); - } - - /** - * Returns either the fade settings of this pad or the global settings - * - * @return Fade - */ - public Fade getFade() { - if (fadeProperty.isNull().get()) { - if (Profile.currentProfile() != null) { - return Profile.currentProfile().getProfileSettings().getFade(); - } - } - return fadeProperty.get(); - } - - public void setFade(Fade fade) { - this.fadeProperty.set(fade); - } - - public ObjectProperty<Fade> fadeProperty() { - return fadeProperty; - } - - public boolean isCustomWarning() { - return warningProperty.isNotNull().get(); - } - - public BooleanBinding customWarningProperty() { - return warningProperty.isNotNull(); - } - - public Warning getWarning() { - if (warningProperty.isNull().get()) { - if (Profile.currentProfile() != null) { - return Profile.currentProfile().getProfileSettings().getWarningFeedback(); - } - } - return warningProperty.get(); - } - - public void setWarning(Warning warning) { - this.warningProperty.set(warning); - } - - public ObjectProperty<Warning> warningProperty() { - return warningProperty; - } - - public boolean isCustomLayout() { - return customLayoutProperty.get(); - } - - public void setCustomLayout(boolean customLayout) { - this.customLayoutProperty.set(customLayout); - } - - public BooleanProperty customLayoutProperty() { - return customLayoutProperty; - } - - public CartDesign getLayout() { - return getLayout(Profile.currentProfile().getProfileSettings().getLayoutType()); - } - - public CartDesign getLayout(String type) { - if (!layouts.containsKey(type)) { - DefaultRegistry<DesignConnect> layouts2 = PlayPadPlugin.getRegistryCollection().getDesigns(); - try { - layouts.put(type, layouts2.getComponent(type).newCartDesign()); - } catch (NoSuchComponentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return layouts.get(type); - } - - public void setLayout(CartDesign layout, String type) { - this.layouts.put(type, layout); - } - public boolean isEof() { return eof; } @@ -332,18 +180,6 @@ public class Pad { this.eof = eof; } - public HashMap<String, Object> getCustomSettings() { - return customSettings; - } - - public HashMap<TriggerPoint, Trigger> getTriggers() { - return triggers; - } - - public Trigger getTrigger(TriggerPoint point) { - return triggers.get(point); - } - // Helper Methodes public void loadContent() throws NoSuchComponentException { if (contentProperty.get() != null) @@ -378,23 +214,6 @@ public class Pad { this.ignoreTrigger = ignoreTrigger; } - void updateTrigger() { - for (TriggerPoint point : TriggerPoint.values()) { - if (!triggers.containsKey(point)) { - Trigger trigger = new Trigger(point); - triggers.put(point, trigger); - } - } - } - - public boolean hasTriggerItems() { - for (Trigger trigger : triggers.values()) { - if (!trigger.getItems().isEmpty()) - return true; - } - return false; - } - public Project getProject() { return project; } @@ -444,8 +263,4 @@ public class Pad { public DoubleProperty customVolumeProperty() { return customVolumeProperty; } - - HashMap<String, CartDesign> getLayouts() { - return layouts; - } } diff --git a/PlayWallCore/src/de/tobias/playpad/pad/PadSerializer.java b/PlayWallCore/src/de/tobias/playpad/pad/PadSerializer.java index 3d89697e..ef1d1080 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/PadSerializer.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/PadSerializer.java @@ -65,22 +65,24 @@ public class PadSerializer implements XMLSerializer<Pad>, XMLDeserializer<Pad> { // Settings Element settingsElement = element.element(SETTINGS_ELEMENT); + PadSettings padSettings = pad.getPadSettings(); + if (settingsElement.element(VOLUME_ELEMENT) != null) - pad.setVolume(Double.valueOf(settingsElement.element(VOLUME_ELEMENT).getStringValue())); + padSettings.setVolume(Double.valueOf(settingsElement.element(VOLUME_ELEMENT).getStringValue())); if (settingsElement.element(LOOP_ELEMENT) != null) - pad.setLoop(Boolean.valueOf(settingsElement.element(LOOP_ELEMENT).getStringValue())); + padSettings.setLoop(Boolean.valueOf(settingsElement.element(LOOP_ELEMENT).getStringValue())); if (settingsElement.element(TIMEMODE_ELEMENT) != null) - pad.setTimeMode(TimeMode.valueOf(settingsElement.element(TIMEMODE_ELEMENT).getStringValue())); + padSettings.setTimeMode(TimeMode.valueOf(settingsElement.element(TIMEMODE_ELEMENT).getStringValue())); if (settingsElement.element(FADE_ELEMENT) != null) - pad.setFade(Fade.load(settingsElement.element(FADE_ELEMENT))); + padSettings.setFade(Fade.load(settingsElement.element(FADE_ELEMENT))); if (settingsElement.element(WARNING_ELEMENT) != null) - pad.setWarning(Warning.load(settingsElement.element(WARNING_ELEMENT))); + padSettings.setWarning(Warning.load(settingsElement.element(WARNING_ELEMENT))); // Laoyut Element layoutsElement = settingsElement.element(LAYOUTS_ELEMENT); if (layoutsElement != null) { if (layoutsElement.attributeValue(LAYOUT_ACTIVE_ATTR) != null) { - pad.setCustomLayout(Boolean.valueOf(layoutsElement.attributeValue(LAYOUT_ACTIVE_ATTR))); + padSettings.setCustomLayout(Boolean.valueOf(layoutsElement.attributeValue(LAYOUT_ACTIVE_ATTR))); } for (Object layoutObj : layoutsElement.elements(LAYOUT_ELEMENT)) { @@ -93,7 +95,7 @@ public class PadSerializer implements XMLSerializer<Pad>, XMLDeserializer<Pad> { CartDesign layout = layouts.getComponent(type).newCartDesign(); layout.load(layoutElement); - pad.setLayout(layout, type); + padSettings.setLayout(layout, type); } catch (NoSuchComponentException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -109,7 +111,7 @@ public class PadSerializer implements XMLSerializer<Pad>, XMLDeserializer<Pad> { Element item = (Element) object; String key = item.attributeValue(CUSTOM_SETTINGS_TYPE_ATTR); Object data = UserDefaults.loadElement(item); - pad.getCustomSettings().put(key, data); + padSettings.getCustomSettings().put(key, data); } } } @@ -122,11 +124,11 @@ public class PadSerializer implements XMLSerializer<Pad>, XMLDeserializer<Pad> { Element triggerElement = (Element) triggerObj; Trigger trigger = new Trigger(); trigger.load(triggerElement); - pad.getTriggers().put(trigger.getTriggerPoint(), trigger); + padSettings.getTriggers().put(trigger.getTriggerPoint(), trigger); } } } - pad.updateTrigger(); // Damit alle Points da sind + padSettings.updateTrigger(); // Damit alle Points da sind // Content Element contentElement = element.element(CONTENT_ELEMENT); @@ -160,36 +162,38 @@ public class PadSerializer implements XMLSerializer<Pad>, XMLDeserializer<Pad> { // Settings Element settingsElement = element.addElement(SETTINGS_ELEMENT); - settingsElement.addElement(VOLUME_ELEMENT).addText(String.valueOf(data.getVolume())); - settingsElement.addElement(LOOP_ELEMENT).addText(String.valueOf(data.isLoop())); - if (data.getTimeMode() != null) - settingsElement.addElement(TIMEMODE_ELEMENT).addText(String.valueOf(data.getTimeMode())); - if (data.isCustomWarning() != false) - data.getWarning().save(settingsElement.addElement(WARNING_ELEMENT)); - if (data.getFade() != null) - data.getFade().save(settingsElement.addElement(FADE_ELEMENT)); + PadSettings padSettings = data.getPadSettings(); + + settingsElement.addElement(VOLUME_ELEMENT).addText(String.valueOf(padSettings.getVolume())); + settingsElement.addElement(LOOP_ELEMENT).addText(String.valueOf(padSettings.isLoop())); + if (padSettings.getTimeMode() != null) + settingsElement.addElement(TIMEMODE_ELEMENT).addText(String.valueOf(padSettings.getTimeMode())); + if (padSettings.isCustomWarning() != false) + padSettings.getWarning().save(settingsElement.addElement(WARNING_ELEMENT)); + if (padSettings.getFade() != null) + padSettings.getFade().save(settingsElement.addElement(FADE_ELEMENT)); // Layout Element layoutsElement = settingsElement.addElement(LAYOUTS_ELEMENT); - layoutsElement.addAttribute(LAYOUT_ACTIVE_ATTR, String.valueOf(data.isCustomLayout())); - for (String layoutType : data.getLayouts().keySet()) { + layoutsElement.addAttribute(LAYOUT_ACTIVE_ATTR, String.valueOf(padSettings.isCustomLayout())); + for (String layoutType : padSettings.getLayouts().keySet()) { Element layoutElement = layoutsElement.addElement(LAYOUT_ELEMENT); layoutElement.addAttribute(LAYOUT_TYPE_ATTR, layoutType); - CartDesign cartLayout = data.getLayouts().get(layoutType); + CartDesign cartLayout = padSettings.getLayouts().get(layoutType); cartLayout.save(layoutElement); } Element userInfoElement = settingsElement.addElement(CUSTOM_SETTINGS_ELEMENT); - for (String key : data.getCustomSettings().keySet()) { + for (String key : padSettings.getCustomSettings().keySet()) { Element itemElement = userInfoElement.addElement(CUSTOM_SETTINGS_ITEM_ELEMENT); - UserDefaults.save(itemElement, data.getCustomSettings().get(key), key); + UserDefaults.save(itemElement, padSettings.getCustomSettings().get(key), key); } // Trigger Element triggersElement = element.addElement("Triggers"); - for (TriggerPoint point : data.getTriggers().keySet()) { - Trigger trigger = data.getTriggers().get(point); + for (TriggerPoint point : padSettings.getTriggers().keySet()) { + Trigger trigger = padSettings.getTriggers().get(point); Element triggerElement = triggersElement.addElement("Trigger"); trigger.save(triggerElement); } diff --git a/PlayWallCore/src/de/tobias/playpad/pad/PadSettings.java b/PlayWallCore/src/de/tobias/playpad/pad/PadSettings.java new file mode 100644 index 00000000..7c46e1ac --- /dev/null +++ b/PlayWallCore/src/de/tobias/playpad/pad/PadSettings.java @@ -0,0 +1,208 @@ +package de.tobias.playpad.pad; + +import java.util.HashMap; + +import de.tobias.playpad.PlayPadPlugin; +import de.tobias.playpad.design.CartDesign; +import de.tobias.playpad.design.DesignConnect; +import de.tobias.playpad.registry.DefaultRegistry; +import de.tobias.playpad.registry.NoSuchComponentException; +import de.tobias.playpad.settings.Fade; +import de.tobias.playpad.settings.Profile; +import de.tobias.playpad.settings.Warning; +import de.tobias.playpad.tigger.Trigger; +import de.tobias.playpad.tigger.TriggerPoint; +import javafx.beans.binding.BooleanBinding; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleBooleanProperty; +import javafx.beans.property.SimpleDoubleProperty; +import javafx.beans.property.SimpleObjectProperty; + +public class PadSettings { + + // Settings + private DoubleProperty volumeProperty = new SimpleDoubleProperty(1.0); + private BooleanProperty loopProperty = new SimpleBooleanProperty(false); + private ObjectProperty<TimeMode> timeModeProperty = new SimpleObjectProperty<>(); + private ObjectProperty<Fade> fadeProperty = new SimpleObjectProperty<>(); + private ObjectProperty<Warning> warningProperty = new SimpleObjectProperty<>(); + + private BooleanProperty customLayoutProperty = new SimpleBooleanProperty(false); + private HashMap<String, CartDesign> layouts = new HashMap<>(); + + private HashMap<TriggerPoint, Trigger> triggers = new HashMap<>(); + + private HashMap<String, Object> customSettings = new HashMap<>(); + + public double getVolume() { + return volumeProperty.get(); + } + + public void setVolume(double volume) { + volumeProperty.set(volume); + } + + public DoubleProperty volumeProperty() { + return volumeProperty; + } + + public boolean isLoop() { + return loopProperty.get(); + } + + public void setLoop(boolean loop) { + this.loopProperty.set(loop); + } + + public BooleanProperty loopProperty() { + return loopProperty; + } + + public boolean isCustomTimeMode() { + return timeModeProperty.isNotNull().get(); + } + + public BooleanBinding customTimeModeProperty() { + return timeModeProperty.isNotNull(); + } + + public TimeMode getTimeMode() { + if (timeModeProperty.isNull().get()) { + if (Profile.currentProfile() != null) { + return Profile.currentProfile().getProfileSettings().getPlayerTimeDisplayMode(); + } + } + return timeModeProperty.get(); + } + + public void setTimeMode(TimeMode timeMode) { + this.timeModeProperty.set(timeMode); + } + + public ObjectProperty<TimeMode> timeModeProperty() { + return timeModeProperty; + } + + public boolean isCustomFade() { + return fadeProperty.isNotNull().get(); + } + + public BooleanBinding customFadeProperty() { + return fadeProperty.isNotNull(); + } + + /** + * Returns either the fade settings of this pad or the global settings + * + * @return Fade + */ + public Fade getFade() { + if (fadeProperty.isNull().get()) { + if (Profile.currentProfile() != null) { + return Profile.currentProfile().getProfileSettings().getFade(); + } + } + return fadeProperty.get(); + } + + public void setFade(Fade fade) { + this.fadeProperty.set(fade); + } + + public ObjectProperty<Fade> fadeProperty() { + return fadeProperty; + } + + public boolean isCustomWarning() { + return warningProperty.isNotNull().get(); + } + + public BooleanBinding customWarningProperty() { + return warningProperty.isNotNull(); + } + + public Warning getWarning() { + if (warningProperty.isNull().get()) { + if (Profile.currentProfile() != null) { + return Profile.currentProfile().getProfileSettings().getWarningFeedback(); + } + } + return warningProperty.get(); + } + + public void setWarning(Warning warning) { + this.warningProperty.set(warning); + } + + public ObjectProperty<Warning> warningProperty() { + return warningProperty; + } + + public boolean isCustomLayout() { + return customLayoutProperty.get(); + } + + public void setCustomLayout(boolean customLayout) { + this.customLayoutProperty.set(customLayout); + } + + public BooleanProperty customLayoutProperty() { + return customLayoutProperty; + } + + public CartDesign getLayout() { + return getLayout(Profile.currentProfile().getProfileSettings().getLayoutType()); + } + + HashMap<String, CartDesign> getLayouts() { + return layouts; + } + + public CartDesign getLayout(String type) { + if (!layouts.containsKey(type)) { + DefaultRegistry<DesignConnect> layouts2 = PlayPadPlugin.getRegistryCollection().getDesigns(); + try { + layouts.put(type, layouts2.getComponent(type).newCartDesign()); + } catch (NoSuchComponentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return layouts.get(type); + } + + public void setLayout(CartDesign layout, String type) { + this.layouts.put(type, layout); + } + + public HashMap<String, Object> getCustomSettings() { + return customSettings; + } + + public HashMap<TriggerPoint, Trigger> getTriggers() { + return triggers; + } + + public Trigger getTrigger(TriggerPoint point) { + return triggers.get(point); + } + + void updateTrigger() { + for (TriggerPoint point : TriggerPoint.values()) { + if (!triggers.containsKey(point)) { + Trigger trigger = new Trigger(point); + triggers.put(point, trigger); + } + } + } + + public boolean hasTriggerItems() { + for (Trigger trigger : triggers.values()) { + if (!trigger.getItems().isEmpty()) + return true; + } + return false; + } +} diff --git a/PlayWallCore/src/de/tobias/playpad/pad/PadStatusListener.java b/PlayWallCore/src/de/tobias/playpad/pad/PadStatusListener.java index 55622b77..a355c6f9 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/PadStatusListener.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/PadStatusListener.java @@ -16,14 +16,16 @@ public class PadStatusListener implements ChangeListener<PadStatus> { @Override public void changed(ObservableValue<? extends PadStatus> observable, PadStatus oldValue, PadStatus newValue) { + PadSettings padSettings = pad.getPadSettings(); + if (newValue == PadStatus.PLAY) { if (pad.getContent() != null) { PlayPadPlugin.getImplementation().getPadListener().forEach(listener -> listener.onPlay(pad)); if (pad.getContent() instanceof Fadeable) { - if (oldValue == PadStatus.PAUSE && pad.getFade().isFadeInPause()) { + if (oldValue == PadStatus.PAUSE && padSettings.getFade().isFadeInPause()) { ((Fadeable) pad.getContent()).fadeIn(); - } else if (pad.getFade().isFadeInStart()) { + } else if (padSettings.getFade().isFadeInStart()) { ((Fadeable) pad.getContent()).fadeIn(); } } @@ -31,7 +33,7 @@ public class PadStatusListener implements ChangeListener<PadStatus> { } } else if (newValue == PadStatus.PAUSE) { if (pad.getContent() instanceof Pauseable) { - if (pad.getContent() instanceof Fadeable && pad.getFade().isFadeOutPause()) { + if (pad.getContent() instanceof Fadeable && padSettings.getFade().isFadeOutPause()) { ((Fadeable) pad.getContent()).fadeOut(() -> { ((Pauseable) pad.getContent()).pause(); @@ -44,8 +46,8 @@ public class PadStatusListener implements ChangeListener<PadStatus> { if (pad.getContent() != null) { PlayPadPlugin.getImplementation().getPadListener().forEach(listener -> listener.onStop(pad)); - if (pad.getContent() instanceof Fadeable && !pad.isEof() && pad.getFade().isFadeOutStop()) { // Fade nur wenn pad nicht am - // ende ist + if (pad.getContent() instanceof Fadeable && !pad.isEof() && padSettings.getFade().isFadeOutStop()) { // Fade nur wenn Pad + // nicht am ende ist ((Fadeable) pad.getContent()).fadeOut(() -> { pad.getContent().stop(); diff --git a/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerDurationListener.java b/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerDurationListener.java index 668f5489..632d4f9f 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerDurationListener.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerDurationListener.java @@ -2,6 +2,7 @@ package de.tobias.playpad.pad.triggerlistener; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.pad.conntent.play.Durationable; import de.tobias.playpad.settings.Profile; @@ -30,11 +31,13 @@ public class PadTriggerDurationListener implements ChangeListener<Duration> { IMainViewController mainViewController = PlayPadPlugin.getImplementation().getMainViewController(); Profile currentProfile = Profile.currentProfile(); + PadSettings padSettings = pad.getPadSettings(); - Trigger startTrigger = pad.getTrigger(TriggerPoint.START); + // Execute Triggers + Trigger startTrigger = padSettings.getTrigger(TriggerPoint.START); startTrigger.handle(pad, newValue, pad.getProject(), mainViewController, currentProfile); - Trigger endTrigger = pad.getTrigger(TriggerPoint.EOF_STOP); + Trigger endTrigger = padSettings.getTrigger(TriggerPoint.EOF_STOP); endTrigger.handle(pad, leftTime, pad.getProject(), mainViewController, currentProfile); } } diff --git a/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerStatusListener.java b/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerStatusListener.java index cd0b0dd9..013d14b5 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerStatusListener.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/triggerlistener/PadTriggerStatusListener.java @@ -2,6 +2,7 @@ package de.tobias.playpad.pad.triggerlistener; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.pad.PadStatus; import de.tobias.playpad.settings.Profile; import de.tobias.playpad.tigger.Trigger; @@ -22,12 +23,15 @@ public class PadTriggerStatusListener implements ChangeListener<PadStatus> { @Override public void changed(ObservableValue<? extends PadStatus> observable, PadStatus oldValue, PadStatus newValue) { if (!pad.isIgnoreTrigger()) { + PadSettings padSettings = pad.getPadSettings(); + + // Execute Trigger if (newValue == PadStatus.PLAY) { // TRIGGER FÜR START - executeTrigger(pad.getTriggers().get(TriggerPoint.START)); + executeTrigger(padSettings.getTriggers().get(TriggerPoint.START)); } else if (newValue == PadStatus.STOP) { // TRIGGER FÜR STOP - executeTrigger(pad.getTriggers().get(TriggerPoint.EOF_STOP)); + executeTrigger(padSettings.getTriggers().get(TriggerPoint.EOF_STOP)); } else if (oldValue == PadStatus.PLAY && newValue == PadStatus.READY && pad.isEof()) { // TRIGGER FÜR EOF - executeTrigger(pad.getTriggers().get(TriggerPoint.EOF_STOP)); + executeTrigger(padSettings.getTriggers().get(TriggerPoint.EOF_STOP)); } } else { pad.setIgnoreTrigger(false); diff --git a/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/video/VideoContent.java b/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/video/VideoContent.java index 5f7ba39e..5e5a41d2 100644 --- a/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/video/VideoContent.java +++ b/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/video/VideoContent.java @@ -8,6 +8,7 @@ import org.dom4j.Element; import de.tobias.playpad.mediaplugin.main.impl.MediaPluginImpl; import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.pad.PadStatus; import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.pad.conntent.play.Durationable; @@ -50,7 +51,8 @@ public class VideoContent extends PadContent implements Pauseable, Durationable }; customVolumeListener = (a, b, c) -> { - player.setVolume(getPad().getVolume() * Profile.currentProfile().getProfileSettings().getVolume() * c.doubleValue()); + player.setVolume( + getPad().getPadSettings().getVolume() * Profile.currentProfile().getProfileSettings().getVolume() * c.doubleValue()); }; } @@ -77,7 +79,7 @@ public class VideoContent extends PadContent implements Pauseable, Durationable @Override public void setMasterVolume(double masterVolume) { if (player != null) { - player.setVolume(getPad().getVolume() * masterVolume * getPad().getCustomVolume()); + player.setVolume(getPad().getPadSettings().getVolume() * masterVolume * getPad().getCustomVolume()); } } @@ -107,8 +109,10 @@ public class VideoContent extends PadContent implements Pauseable, Durationable @Override public boolean stop() { - if (getPad().getCustomSettings().containsKey(VIDEO_LAST_FRAME) && !holdLastFrame && getPad().isEof()) { - if ((boolean) getPad().getCustomSettings().get(VIDEO_LAST_FRAME)) { + PadSettings padSettings = getPad().getPadSettings(); + + if (padSettings.getCustomSettings().containsKey(VIDEO_LAST_FRAME) && !holdLastFrame && getPad().isEof()) { + if ((boolean) padSettings.getCustomSettings().get(VIDEO_LAST_FRAME)) { getPad().setStatus(PadStatus.PAUSE); holdLastFrame = true; return false; @@ -191,7 +195,7 @@ public class VideoContent extends PadContent implements Pauseable, Durationable }); player.setOnEndOfMedia(() -> { - if (!getPad().isLoop()) { + if (!getPad().getPadSettings().isLoop()) { getPad().setEof(true); getPad().setStatus(PadStatus.STOP); } else { @@ -203,7 +207,7 @@ public class VideoContent extends PadContent implements Pauseable, Durationable durationProperty.bind(player.totalDurationProperty()); positionProperty.bind(player.currentTimeProperty()); - getPad().volumeProperty().addListener(padVolumeListener); + getPad().getPadSettings().volumeProperty().addListener(padVolumeListener); getPad().customVolumeProperty().addListener(customVolumeListener); } } @@ -213,7 +217,7 @@ public class VideoContent extends PadContent implements Pauseable, Durationable durationProperty.unbind(); positionProperty.unbind(); - getPad().volumeProperty().removeListener(padVolumeListener); + getPad().getPadSettings().volumeProperty().removeListener(padVolumeListener); getPad().customVolumeProperty().removeListener(customVolumeListener); player = null; diff --git a/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/video/VideoPadSettingsTabViewController.java b/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/video/VideoPadSettingsTabViewController.java index b7a0f059..a430bbb6 100644 --- a/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/video/VideoPadSettingsTabViewController.java +++ b/PlayWallPlugins/mediaplugin/de/tobias/playpad/mediaplugin/video/VideoPadSettingsTabViewController.java @@ -21,13 +21,13 @@ public class VideoPadSettingsTabViewController extends PadSettingsTabViewControl @Override public void loadSettings(Pad pad) { - if (pad.getCustomSettings().containsKey(VideoContent.VIDEO_LAST_FRAME)) - lastFrameCheckBox.setSelected((boolean) pad.getCustomSettings().get(VideoContent.VIDEO_LAST_FRAME)); + if (pad.getPadSettings().getCustomSettings().containsKey(VideoContent.VIDEO_LAST_FRAME)) + lastFrameCheckBox.setSelected((boolean) pad.getPadSettings().getCustomSettings().get(VideoContent.VIDEO_LAST_FRAME)); } @Override public void saveSettings(Pad pad) { - pad.getCustomSettings().put(VideoContent.VIDEO_LAST_FRAME, lastFrameCheckBox.isSelected()); + pad.getPadSettings().getCustomSettings().put(VideoContent.VIDEO_LAST_FRAME, lastFrameCheckBox.isSelected()); } } -- GitLab