Skip to content
Snippets Groups Projects
Commit 41949950 authored by tobias's avatar tobias
Browse files

Multiple Pad Playing Settings und Implementierung

parent 3dded36c
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,6 @@ settings.gen.label.view=Ansicht:
settings.gen.label.pages=Anzahl der Seiten:
settings.gen.label.columns=Anzahl der Spalten:
settings.gen.label.rows=Anzahl der Reihen:
settings.gen.label.additional=Erweitert:
settings.gen.label.liveMode=Live Modus:
settings.gen.checkbox.liveMode=Aktivieren
settings.gen.label.liveMode.settings=Einstellungen ndern:
......@@ -58,6 +57,8 @@ settings.midi.label.device=Midi-Ger
settings.layout.label.type=Layout Type:
settings.player.label.modus=Wiedergabemodus:
settings.player.checkbox.modus=Mehrere Player gleichzeitig wiedergeben
settings.player.label.warning=Warnhinweise:
settings.player.label.fade=Ein-/Ausblenden:
settings.player.label.fadeIn=Einblenden (in s):
......
......@@ -5,10 +5,8 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<VBox spacing="14.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<VBox prefWidth="800.0" spacing="14.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label text="%settings.gen.label.additional" underline="true" />
<HBox spacing="14.0">
<children>
<Label alignment="BASELINE_RIGHT" maxWidth="1.7976931348623157E308" prefWidth="150.0" text="%settings.gen.label.liveMode" />
......
......@@ -7,6 +7,13 @@
<VBox spacing="14.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<HBox spacing="14.0">
<children>
<Label alignment="CENTER_RIGHT" prefWidth="150.0" text="%settings.player.label.modus" />
<CheckBox fx:id="playerModus" layoutX="150.0" mnemonicParsing="false" text="%settings.player.checkbox.modus" />
</children>
</HBox>
<Separator prefWidth="200.0" />
<Label text="%settings.player.label.fade" underline="true" />
<VBox fx:id="fadeContainer" minHeight="20.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
<Separator prefWidth="200.0" />
......
......@@ -13,11 +13,15 @@ import de.tobias.playpad.viewcontroller.settings.FadeViewController;
import de.tobias.playpad.viewcontroller.settings.WarningFeedbackViewController;
import de.tobias.utils.util.Localization;
import javafx.fxml.FXML;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.VBox;
public class PlayerTabViewController extends ProfileSettingsTabViewController {
// Modus
@FXML private CheckBox playerModus;
// Player
@FXML private VBox warningFeedbackContainer;
@FXML private VBox fadeContainer;
......@@ -52,6 +56,7 @@ public class PlayerTabViewController extends ProfileSettingsTabViewController {
public void loadSettings(Profile profile) {
ProfileSettings profileSettings = profile.getProfileSettings();
playerModus.setSelected(profile.getProfileSettings().isMultiplePlayer());
timeDisplayComboBox.setValue(profileSettings.getPlayerTimeDisplayMode());
}
......@@ -60,6 +65,7 @@ public class PlayerTabViewController extends ProfileSettingsTabViewController {
ProfileSettings profileSettings = profile.getProfileSettings();
// Player
profileSettings.setMultiplePlayer(playerModus.isSelected());
profileSettings.setPlayerTimeDisplayMode(timeDisplayComboBox.getValue());
}
......
......@@ -138,6 +138,7 @@ public class Pad {
if (status == PadStatus.STOP && getStatus() == PadStatus.READY) {
return;
}
this.statusProperty.set(status);
}
......
......@@ -3,6 +3,8 @@ package de.tobias.playpad.pad;
import de.tobias.playpad.PlayPadPlugin;
import de.tobias.playpad.pad.conntent.play.Fadeable;
import de.tobias.playpad.pad.conntent.play.Pauseable;
import de.tobias.playpad.settings.Profile;
import de.tobias.playpad.settings.ProfileSettings;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
......@@ -10,6 +12,9 @@ public class PadStatusListener implements ChangeListener<PadStatus> {
private Pad pad;
// Utils für Single Pad Playing
private static Pad currentPlayingPad; // Nur wenn ProfileSettings.isMultiplePlayer == false
public PadStatusListener(Pad pad) {
this.pad = pad;
}
......@@ -17,11 +22,22 @@ public class PadStatusListener implements ChangeListener<PadStatus> {
@Override
public void changed(ObservableValue<? extends PadStatus> observable, PadStatus oldValue, PadStatus newValue) {
PadSettings padSettings = pad.getPadSettings();
ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings();
if (newValue == PadStatus.PLAY) {
if (pad.getContent() != null) {
PlayPadPlugin.getImplementation().getPadListener().forEach(listener -> listener.onPlay(pad));
// bei Single Pad Playing wird das alte Pad beendet.
if (!profileSettings.isMultiplePlayer()) {
if (currentPlayingPad != null) {
if (currentPlayingPad.getStatus() == PadStatus.PLAY || currentPlayingPad.getStatus() == PadStatus.PAUSE) {
currentPlayingPad.setStatus(PadStatus.STOP);
}
}
currentPlayingPad = pad;
}
if (pad.getContent() instanceof Fadeable) {
if (oldValue == PadStatus.PAUSE && padSettings.getFade().isFadeInPause()) {
((Fadeable) pad.getContent()).fadeIn();
......
......@@ -47,6 +47,7 @@ public class ProfileSettings implements SettingsSerializable {
@Storable private String mainLayoutType = PlayPadPlugin.getRegistryCollection().getMainLayouts().getDefaultID();
// Cart Settings
@Storable private boolean multiplePlayer = true;
@Storable private Warning warningFeedback = new Warning(Duration.seconds(5));
@Storable private boolean midiActive = false;
......@@ -146,6 +147,10 @@ public class ProfileSettings implements SettingsSerializable {
return audioUserInfo;
}
public boolean isMultiplePlayer() {
return multiplePlayer;
}
// Setter
public void setMidiDeviceName(String midiDevice) {
this.midiDevice = midiDevice;
......@@ -211,6 +216,10 @@ public class ProfileSettings implements SettingsSerializable {
this.audioClass = audioClass;
}
public void setMultiplePlayer(boolean multiplePlayer) {
this.multiplePlayer = multiplePlayer;
}
// Properties
public DoubleProperty volumeProperty() {
return volumeProperty;
......@@ -224,6 +233,7 @@ public class ProfileSettings implements SettingsSerializable {
private static final String AUDIO_USER_INFO_ELEMENT = "AudioUserInfo";
private static final String AUDIO_CLASS_ELEMENT = "AudioClass";
private static final String WINDOW_ALWAYS_ON_TOP_ELEMENT = "WindowAlwaysOnTop";
private static final String MULTIPLE_PLAYER_ELEMENT = "MultiplePlayer";
private static final String LIVE_MODE_ELEMENT = "LiveMode";
private static final String LIVE_MODE_PAGE_ATTR = "page";
private static final String LIVE_MODE_DRAG_ATTR = "drag";
......@@ -260,6 +270,10 @@ public class ProfileSettings implements SettingsSerializable {
profileSettings.setMainLayoutType(root.element(MAIN_LAYOUT_TYPE_ELEMENT).getStringValue());
}
if (root.element(MULTIPLE_PLAYER_ELEMENT) != null) {
profileSettings.setMultiplePlayer(Boolean.valueOf(root.element(MULTIPLE_PLAYER_ELEMENT).getStringValue()));
}
if (root.element(WARNING_ELEMENT) != null) {
Warning warning = Warning.load(root.element(WARNING_ELEMENT));
if (warning != null) {
......@@ -342,6 +356,8 @@ public class ProfileSettings implements SettingsSerializable {
fade.save(root.addElement(FADE_ELEMENT));
root.addElement(TIME_DISPLAY_ELEMENT).addText(player_timeDisplayMode.name());
root.addElement(MULTIPLE_PLAYER_ELEMENT).addText(String.valueOf(multiplePlayer));
Element liveElement = root.addElement(LIVE_MODE_ELEMENT);
liveElement.addText(String.valueOf(liveMode));
liveElement.addAttribute(LIVE_MODE_PAGE_ATTR, String.valueOf(liveModePage));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment