Skip to content
Snippets Groups Projects
Commit 3d81c617 authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

#173 - Improve content playlist item view layout

parent 19bbd87b
No related branches found
No related tags found
No related merge requests found
......@@ -7,13 +7,15 @@ import de.tobias.playpad.pad.mediapath.MediaPath
import de.tobias.playpad.plugin.content.util.FfmpegUtils
import javafx.application.Platform
import javafx.event.ActionEvent
import javafx.scene.control.{Button, Label}
import javafx.geometry.Pos
import javafx.scene.control.{Button, Label, ProgressIndicator, Separator}
import javafx.scene.layout.{HBox, VBox}
class ContentPlayerPlaylistView(pad: Pad, mediaPath: MediaPath) extends VBox {
var sizeLabel: Label = new Label()
var convertButton = new Button(Localization.getString("plugin.content.player.playlist.convert"))
val progressIndicator = new ProgressIndicator()
val sizeLabel: Label = new Label()
val convertButton = new Button(Localization.getString("plugin.content.player.playlist.convert"))
private val sizeTextLabel = new Label(Localization.getString("plugin.content.player.playlist.size"))
private val sizeBox = new HBox(sizeTextLabel, sizeLabel)
......@@ -22,18 +24,34 @@ class ContentPlayerPlaylistView(pad: Pad, mediaPath: MediaPath) extends VBox {
sizeBox.setSpacing(14)
convertButton.setOnAction(onConvertVStackButton)
progressIndicator.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS)
progressIndicator.setPrefSize(30, 30)
getChildren.addAll(sizeBox, convertButton)
private val actionBox = new HBox(convertButton, progressIndicator)
actionBox.setAlignment(Pos.CENTER_LEFT)
actionBox.setSpacing(14)
private val separator = new Separator()
getChildren.addAll(separator, sizeBox, actionBox)
setSpacing(14)
Worker.runLater(() => {
val resolution = FfmpegUtils.getResolution(mediaPath.getPath)
Platform.runLater(() => {
sizeLabel.setText(f"${resolution.getKey} x ${resolution.getValue}")
progressIndicator.setVisible(false)
})
})
private def onConvertVStackButton(event: ActionEvent) = {
private def onConvertVStackButton(event: ActionEvent): Unit = {
progressIndicator.setVisible(true)
Worker.runLater(() => {
FfmpegUtils.convertMediaVStack(mediaPath.getPath)
Platform.runLater(() => {
progressIndicator.setVisible(false)
})
})
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment