diff --git a/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/pad/PlaylistTabViewController.java b/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/pad/PlaylistTabViewController.java index 8faa9b357d9364f0058ced62965a27d6ce56b3e7..6eb0738ff7092383083639ad73fc8e65bb5023f8 100644 --- a/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/pad/PlaylistTabViewController.java +++ b/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/pad/PlaylistTabViewController.java @@ -4,7 +4,6 @@ import de.thecodelabs.utils.application.system.NativeApplication; import de.thecodelabs.utils.ui.icon.FontAwesomeType; import de.thecodelabs.utils.ui.icon.FontIcon; import de.thecodelabs.utils.util.Localization; -import de.tobias.playpad.PlayPad; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.Strings; import de.tobias.playpad.layout.desktop.listener.PadNewContentListener; @@ -19,10 +18,7 @@ import javafx.beans.binding.Bindings; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.Node; -import javafx.scene.control.Button; -import javafx.scene.control.Label; -import javafx.scene.control.ListCell; -import javafx.scene.control.ListView; +import javafx.scene.control.*; import javafx.scene.layout.VBox; import java.io.File; @@ -31,6 +27,9 @@ import java.util.List; public class PlaylistTabViewController extends PadSettingsTabViewController { + @FXML + private CheckBox shuffleCheckbox; + @FXML private ListView<MediaPath> mediaPathListView; @@ -123,12 +122,12 @@ public class PlaylistTabViewController extends PadSettingsTabViewController { @Override public void loadSettings(Pad pad) { - // Not implemented + shuffleCheckbox.setSelected((Boolean) pad.getPadSettings().getCustomSettings().getOrDefault(Playlistable.SHUFFLE_SETTINGS_KEY, false)); } @Override public void saveSettings(Pad pad) { - // Not implemented + pad.getPadSettings().getCustomSettings().put(Playlistable.SHUFFLE_SETTINGS_KEY, shuffleCheckbox.isSelected()); } @FXML diff --git a/PlayWall/src/main/resources/lang/ui_de.properties b/PlayWall/src/main/resources/lang/ui_de.properties index 229c7ab2ff1364e4062a34be4058354422c0b120..39e63dfd26335cc4da829d23c3d8db732f6be10f 100755 --- a/PlayWall/src/main/resources/lang/ui_de.properties +++ b/PlayWall/src/main/resources/lang/ui_de.properties @@ -137,6 +137,8 @@ padSettings.player.label.cueIn=Intro Dauer (in s): padSettings.player.label.fade=Ein-/Ausblenden: padSettings.layout.label.custom=Eigenes Layout: padSettings.layout.checkbox.custom=Aktiviert +padSettings.playlist.settings.title=Allgemeine Einstellungen +padSettings.playlist.settings.shuffle=Zuf\u00E4llige Wiedergabe project.label.details=Projektinformationen: project.label.name=Name: project.label.profile=Profil: diff --git a/PlayWall/src/main/resources/view/option/pad/PlaylistTab.fxml b/PlayWall/src/main/resources/view/option/pad/PlaylistTab.fxml index dfa32cd75217bc0b16a69e5cd05d021074505810..f0a37ec71730d9cd7240e1d48db98fcc0aaaf24c 100644 --- a/PlayWall/src/main/resources/view/option/pad/PlaylistTab.fxml +++ b/PlayWall/src/main/resources/view/option/pad/PlaylistTab.fxml @@ -1,46 +1,67 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.geometry.Insets?> -<?import javafx.scene.control.*?> -<?import javafx.scene.layout.*?> -<HBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" spacing="14.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> - <children> - <VBox spacing="14.0"> - <children> - <ListView fx:id="mediaPathListView" prefWidth="250.0" VBox.vgrow="ALWAYS" /> - <HBox spacing="14.0"> - <children> - <Button fx:id="addButton" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onAddHandler" HBox.hgrow="ALWAYS" /> - <Button fx:id="upButton" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onUpHandler" HBox.hgrow="ALWAYS" /> - <Button fx:id="downButton" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onDownAction" HBox.hgrow="ALWAYS" /> - </children> - </HBox> - </children> - </VBox> - <VBox spacing="14.0"> - <children> - <HBox spacing="14.0"> - <children> - <Label fx:id="pathLabel" textOverrun="CENTER_ELLIPSIS" /> - </children> - </HBox> - <HBox spacing="14.0"> - <children> - <Button fx:id="showFileButton" mnemonicParsing="false" onAction="#onShowFileHandler" text="%padSettings.button.path.show" /> - <Button fx:id="deleteButton" mnemonicParsing="false" onAction="#onDeleteHandler" text="%padSettings.button.delete" /> - </children> - </HBox> - <VBox fx:id="customItemView" /> - </children> - <HBox.margin> - <Insets /> - </HBox.margin> - <padding> - <Insets bottom="14.0" left="14.0" right="14.0" top="14.0" /> - </padding> - </VBox> - </children> - <padding> - <Insets bottom="14.0" left="14.0" right="14.0" top="14.0" /> - </padding> -</HBox> +<?import javafx.scene.control.Button?> +<?import javafx.scene.control.CheckBox?> +<?import javafx.scene.control.Label?> +<?import javafx.scene.control.ListView?> +<?import javafx.scene.layout.HBox?> +<?import javafx.scene.layout.VBox?> + +<VBox xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"> + <children> + <VBox spacing="14"> + <children> + <Label styleClass="headline" text="%padSettings.playlist.settings.title" /> + <CheckBox fx:id="shuffleCheckbox" mnemonicParsing="false" text="%padSettings.playlist.settings.shuffle" /> + </children> + <VBox.margin> + <Insets /> + </VBox.margin> + <padding> + <Insets bottom="14.0" left="14.0" right="14.0" top="14.0" /> + </padding> + </VBox> + <HBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" spacing="14.0"> + <children> + <VBox spacing="14.0"> + <children> + <ListView fx:id="mediaPathListView" prefWidth="250.0" VBox.vgrow="ALWAYS" /> + <HBox spacing="14.0"> + <children> + <Button fx:id="addButton" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onAddHandler" HBox.hgrow="ALWAYS" /> + <Button fx:id="upButton" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onUpHandler" HBox.hgrow="ALWAYS" /> + <Button fx:id="downButton" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onDownAction" HBox.hgrow="ALWAYS" /> + </children> + </HBox> + </children> + </VBox> + <VBox spacing="14.0"> + <children> + <HBox spacing="14.0"> + <children> + <Label fx:id="pathLabel" textOverrun="CENTER_ELLIPSIS" /> + </children> + </HBox> + <HBox spacing="14.0"> + <children> + <Button fx:id="showFileButton" mnemonicParsing="false" onAction="#onShowFileHandler" text="%padSettings.button.path.show" /> + <Button fx:id="deleteButton" mnemonicParsing="false" onAction="#onDeleteHandler" text="%padSettings.button.delete" /> + </children> + </HBox> + <VBox fx:id="customItemView" /> + </children> + <HBox.margin> + <Insets /> + </HBox.margin> + <padding> + <Insets bottom="14.0" left="14.0" right="14.0" top="14.0" /> + </padding> + </VBox> + </children> + <padding> + <Insets bottom="14.0" left="14.0" right="14.0" top="14.0" /> + </padding> + </HBox> + </children> +</VBox> diff --git a/PlayWallCore/src/main/java/de/tobias/playpad/pad/content/Playlistable.java b/PlayWallCore/src/main/java/de/tobias/playpad/pad/content/Playlistable.java index 1d15d9ad02184a18dc076b6cce7d739f8eba9552..c787b93ce01492bab1df4f7367e2ffeb4ce11cf4 100644 --- a/PlayWallCore/src/main/java/de/tobias/playpad/pad/content/Playlistable.java +++ b/PlayWallCore/src/main/java/de/tobias/playpad/pad/content/Playlistable.java @@ -4,6 +4,9 @@ import de.tobias.playpad.pad.mediapath.MediaPath; import javafx.beans.property.IntegerProperty; public interface Playlistable { + + String SHUFFLE_SETTINGS_KEY = "shuffle"; + int getCurrentPlayingMediaIndex(); IntegerProperty currentPlayingMediaIndexProperty(); diff --git a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerMediaContainer.scala b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerMediaContainer.scala index e524e428994f4150d9f6873461cf6bce10dbbf74..93d34c1c817b3a8b92fb62facc00b0b63729d5a0 100644 --- a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerMediaContainer.scala +++ b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerMediaContainer.scala @@ -8,7 +8,7 @@ import de.tobias.playpad.plugin.content.util._ import javafx.beans.property.{ObjectProperty, ReadOnlyObjectProperty, SimpleObjectProperty} import javafx.util.Duration -import java.nio.file.Files +import java.nio.file.{Files, Path} class ContentPlayerMediaContainer(val content: ContentPlayerPadContent, private[pad] val mediaPath: MediaPath, val totalDuration: Duration) { @@ -16,17 +16,17 @@ class ContentPlayerMediaContainer(val content: ContentPlayerPadContent, private[ _totalDurationProperty.set(totalDuration) - def getPath: String = { + def getPath: Path = { val sourcePath = mediaPath.getPath.toAbsolutePath val globalSettings = PlayPadPlugin.getInstance.getGlobalSettings val convertPath = globalSettings.getCachePath.resolve(sourcePath.getFileName + ".mp4") if (Files.exists(convertPath)) { - return convertPath.toString + return convertPath } - sourcePath.toString + sourcePath } def getTotalDuration: Duration = _totalDurationProperty.get() diff --git a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerPadContent.scala b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerPadContent.scala index f6eb4ba5405c2bc4951ea23d3a767f149cd37a2c..48bf118812d6bc9b0659acca51e9711e672c9711 100644 --- a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerPadContent.scala +++ b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerPadContent.scala @@ -20,7 +20,7 @@ import nativecontentplayerwindows.ContentPlayer import java.nio.file.Files import java.util -import java.util.UUID +import java.util.{Collections, UUID} import java.util.stream.Collectors import scala.jdk.CollectionConverters._ @@ -61,6 +61,9 @@ class ContentPlayerPadContent(val pad: Pad, val `type`: String) extends PadConte if (isPause) { mediaPlayers(getCurrentPlayingMediaIndex).resume(withFadeIn) } else { + if (isShuffle) { + Collections.shuffle(mediaPlayers) + } getPad.setEof(false) mediaPlayers.head.play(withFadeIn) } @@ -296,6 +299,10 @@ class ContentPlayerPadContent(val pad: Pad, val `type`: String) extends PadConte pad.getPadSettings.getCustomSettings.getOrDefault(ContentPlayerPadContentFactory.lastFrame, false).asInstanceOf[Boolean] } + def isShuffle: Boolean = { + pad.getPadSettings.getCustomSettings.getOrDefault(Playlistable.SHUFFLE_SETTINGS_KEY, false).asInstanceOf[Boolean] + } + def getSelectedZones: Seq[Zone] = { val zoneConfiguration = Profile.currentProfile().getCustomSettings(ContentPluginMain.zoneConfigurationKey).asInstanceOf[ContentPlayerPluginConfiguration] diff --git a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerPadPreview.scala b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerPadPreview.scala index 6ff298194c1ec57c2f6e7262b8c1c96db6498476..cbc98c236cfa37aef6f74c0390dfbbe78a4820dc 100644 --- a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerPadPreview.scala +++ b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerPadPreview.scala @@ -43,7 +43,8 @@ class ContentPlayerPadPreview(pad: Pad, parent: Pane) extends VBox with IPadCont pad.getContent match { case content: ContentPlayerPadContent => subTitleLabel.textProperty().bind(Bindings.createStringBinding(() => { - if (content.getCurrentPlayingMediaIndex < 0) "" else PathUtils.getFilenameWithoutExtension(pad.getPaths.get(content.getCurrentPlayingMediaIndex).getPath.getFileName) + if (content.getCurrentPlayingMediaIndex < 0) "" + else PathUtils.getFilenameWithoutExtension(content.getMediaContainers.get(content.getCurrentPlayingMediaIndex).getPath.getFileName) }, content.currentPlayingMediaIndexProperty())) case _ => } diff --git a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/player/ContentPlayerBinding.scala b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/player/ContentPlayerBinding.scala index 44dd4a25fc6a66ef57f45b9266c38316ba16c749..9484ac9be1ede9d096d580c4fdd3b96e25756429 100644 --- a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/player/ContentPlayerBinding.scala +++ b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/player/ContentPlayerBinding.scala @@ -51,7 +51,7 @@ class ContentPlayerBinding(val nativePlayer: ContentPlayer, val zone: Zone) { currentMedia.get().content.getPad.stop() } } - nativePlayer.Play(media.getPath, withFadeIn) + nativePlayer.Play(media.getPath.toString, withFadeIn) currentMedia.set(media) }