From ba7bf9781f8087c5ca8ffec3fca17a4df9090a31 Mon Sep 17 00:00:00 2001
From: tobias <thinkdifferent055@gmail.com>
Date: Sat, 20 Nov 2021 17:03:09 +0100
Subject: [PATCH] #173 - Add download link to ffmpeg

---
 .../src/main/resources/lang/base_de.properties    |  4 +++-
 .../resources/view/ContentPlayerSettingsTab.fxml  | 15 +++++++++++----
 .../ContentPlayerSettingsViewController.scala     | 10 ++++++++++
 3 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/resources/lang/base_de.properties b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/resources/lang/base_de.properties
index a73bac89..bebc781b 100644
--- a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/resources/lang/base_de.properties
+++ b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/resources/lang/base_de.properties
@@ -20,4 +20,6 @@ plugin.content.pad.settings.zone=Zonen
 plugin.content.pad.settings.zone.addAll=Alle anw\u00E4hlen
 plugin.content.pad.settings.zone.removeAll=Alle abw\u00E4hlen
 plugin.content.player.settings.ffmpeg=ffmpeg
-plugin.content.player.settings.ffprobe=ffprobe
\ No newline at end of file
+plugin.content.player.settings.ffprobe=ffprobe
+plugin.content.player.settings.ffmpeg_download=Download
+plugin.content.player.settings.ffmpeg_link=https://www.gyan.dev/ffmpeg/builds/
\ No newline at end of file
diff --git a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/resources/view/ContentPlayerSettingsTab.fxml b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/resources/view/ContentPlayerSettingsTab.fxml
index 1fda86c3..05125907 100644
--- a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/resources/view/ContentPlayerSettingsTab.fxml
+++ b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/resources/view/ContentPlayerSettingsTab.fxml
@@ -4,6 +4,7 @@
 <?import javafx.geometry.Insets?>
 <?import javafx.scene.control.Button?>
 <?import javafx.scene.control.ComboBox?>
+<?import javafx.scene.control.Hyperlink?>
 <?import javafx.scene.control.Label?>
 <?import javafx.scene.control.ListView?>
 <?import javafx.scene.control.Separator?>
@@ -11,24 +12,30 @@
 <?import javafx.scene.layout.HBox?>
 <?import javafx.scene.layout.VBox?>
 
-<VBox xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
+<VBox spacing="14.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
    <children>
-      <HBox alignment="CENTER_LEFT" maxHeight="50.0" prefHeight="50.0" spacing="14.0">
+      <HBox alignment="CENTER_LEFT" maxHeight="50.0" spacing="14.0">
          <children>
             <Label alignment="CENTER_RIGHT" contentDisplay="RIGHT" prefWidth="150.0" text="%plugin.content.player.settings.ffmpeg" />
             <TextField fx:id="ffmpegTextField" prefWidth="300.0" HBox.hgrow="ALWAYS" />
             <Button fx:id="ffmpegButton" mnemonicParsing="false" onAction="#onFfmpegHandle" />
          </children>
       </HBox>
-      <HBox alignment="CENTER_LEFT" maxHeight="50.0" prefHeight="50.0" spacing="14.0">
+      <HBox alignment="CENTER_LEFT" maxHeight="50.0" spacing="14.0">
          <children>
             <Label alignment="CENTER_RIGHT" contentDisplay="RIGHT" prefWidth="150.0" text="%plugin.content.player.settings.ffprobe" />
             <TextField fx:id="ffprobeTextField" prefWidth="300.0" HBox.hgrow="ALWAYS" />
             <Button fx:id="ffprobeButton" mnemonicParsing="false" onAction="#onFfprobeHandle" />
          </children>
       </HBox>
+      <HBox alignment="CENTER_LEFT" spacing="14.0">
+         <children>
+            <Label alignment="CENTER_RIGHT" contentDisplay="RIGHT" prefWidth="150.0" text="%plugin.content.player.settings.ffmpeg_download" />
+            <Hyperlink fx:id="ffmpegDownloadLink" onAction="#onFfmpegDownloadLink" />
+         </children>
+      </HBox>
       <Separator prefWidth="200.0" />
-      <HBox alignment="CENTER_LEFT" maxHeight="50.0" prefHeight="50.0" spacing="14.0">
+      <HBox alignment="CENTER_LEFT" maxHeight="50.0" spacing="14.0">
          <children>
             <Label alignment="CENTER_RIGHT" contentDisplay="RIGHT" prefWidth="150.0" text="%plugin.content.player.settings.screen" />
             <ComboBox fx:id="screenComboBox" prefWidth="200.0" />
diff --git a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/settings/ContentPlayerSettingsViewController.scala b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/settings/ContentPlayerSettingsViewController.scala
index 0fe294fe..69b9e0e5 100644
--- a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/settings/ContentPlayerSettingsViewController.scala
+++ b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/settings/ContentPlayerSettingsViewController.scala
@@ -15,6 +15,9 @@ import javafx.scene.control._
 import javafx.stage.FileChooser
 import nativecontentplayerwindows.{ContentPlayerWindow, ContentScreen}
 
+import java.awt.Desktop
+import java.net.URI
+
 class ContentPlayerSettingsViewController extends ProfileSettingsTabViewController with IProfileReloadTask {
 
 	import javafx.fxml.FXML
@@ -23,6 +26,7 @@ class ContentPlayerSettingsViewController extends ProfileSettingsTabViewControll
 	@FXML var ffmpegTextField: TextField = _
 	@FXML var ffprobeButton: Button = _
 	@FXML var ffprobeTextField: TextField = _
+	@FXML var ffmpegDownloadLink: Hyperlink = _
 
 	@FXML
 	var screenComboBox: ComboBox[SelectableContentScreen] = _
@@ -81,6 +85,8 @@ class ContentPlayerSettingsViewController extends ProfileSettingsTabViewControll
 
 		ffmpegButton.setGraphic(new FontIcon(FontAwesomeType.FOLDER))
 		ffprobeButton.setGraphic(new FontIcon(FontAwesomeType.FOLDER))
+
+		ffmpegDownloadLink.setText(Localization.getString("plugin.content.player.settings.ffmpeg_link"))
 	}
 
 	private def saveSettingsToZone(zone: Zone): Unit = {
@@ -124,6 +130,10 @@ class ContentPlayerSettingsViewController extends ProfileSettingsTabViewControll
 		}
 	}
 
+	@FXML def  onFfmpegDownloadLink(event: ActionEvent): Unit = {
+		Desktop.getDesktop.browse(URI.create(ffmpegDownloadLink.getText))
+	}
+
 	@FXML
 	def onAddHandle(): Unit = {
 		val newConfiguration = new Zone
-- 
GitLab