From f5afeb611210df645b734baa54cd6684eceb2196 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 18 Nov 2018 21:28:14 +0700 Subject: [PATCH] Strip JFX --- source/net/filebot/Main.java | 4 +- .../net/filebot/ui/GettingStartedStage.java | 52 --------------- source/net/filebot/ui/GettingStartedUtil.java | 63 +++++++++++++++++++ 3 files changed, 65 insertions(+), 54 deletions(-) create mode 100644 source/net/filebot/ui/GettingStartedUtil.java diff --git a/source/net/filebot/Main.java b/source/net/filebot/Main.java index ba54a1d7..10eaa200 100644 --- a/source/net/filebot/Main.java +++ b/source/net/filebot/Main.java @@ -6,6 +6,7 @@ import static java.util.stream.Collectors.*; import static net.filebot.Logging.*; import static net.filebot.MediaTypes.*; import static net.filebot.Settings.*; +import static net.filebot.ui.GettingStartedUtil.*; import static net.filebot.util.FileUtilities.*; import static net.filebot.util.FileUtilities.getChildren; import static net.filebot.util.XPathUtilities.*; @@ -42,7 +43,6 @@ import net.filebot.format.ExpressionFormat; import net.filebot.platform.mac.MacAppUtilities; import net.filebot.platform.windows.WinAppUtilities; import net.filebot.ui.FileBotMenuBar; -import net.filebot.ui.GettingStartedStage; import net.filebot.ui.MainFrame; import net.filebot.ui.NotificationHandler; import net.filebot.ui.PanelBuilder; @@ -322,7 +322,7 @@ public class Main { started.flush(); // open Getting Started - SwingUtilities.invokeLater(() -> GettingStartedStage.start("show".equals(System.getProperty("application.help")))); + SwingUtilities.invokeLater(() -> openGettingStarted("show".equals(System.getProperty("application.help")))); } } diff --git a/source/net/filebot/ui/GettingStartedStage.java b/source/net/filebot/ui/GettingStartedStage.java index a49c3ae8..a7045970 100644 --- a/source/net/filebot/ui/GettingStartedStage.java +++ b/source/net/filebot/ui/GettingStartedStage.java @@ -3,9 +3,7 @@ package net.filebot.ui; import static net.filebot.Settings.*; import static net.filebot.util.ui.SwingUI.*; -import java.net.URL; import java.util.Locale; -import java.util.Optional; import javafx.animation.Interpolator; import javafx.animation.KeyFrame; @@ -13,64 +11,14 @@ import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.concurrent.Worker; import javafx.scene.Scene; -import javafx.scene.control.Alert; -import javafx.scene.control.Alert.AlertType; -import javafx.scene.control.ButtonType; -import javafx.scene.image.Image; import javafx.scene.paint.Color; import javafx.scene.web.WebEngine; import javafx.scene.web.WebView; -import javafx.stage.Modality; import javafx.stage.Stage; -import javafx.stage.StageStyle; import javafx.util.Duration; -import net.filebot.ResourceManager; public class GettingStartedStage { - public static void start(boolean show) { - invokeJavaFX(() -> { - if (show) { - create().show(); - } else { - ask(); // libjfxwebkit.dylib cannot be deployed on the MAS due to deprecated dependencies - } - }); - } - - private static void ask() { - Alert alert = new Alert(AlertType.CONFIRMATION); - alert.setTitle("FileBot"); - alert.setHeaderText("Hello! Do you need help Getting Started?"); - alert.setContentText("If you have never used FileBot before, please have a look at the video tutorials first."); - - if (isWindowsApp()) { - Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); - stage.getIcons().setAll(ResourceManager.getApplicationIconResources().map(URL::toString).map(Image::new).toArray(Image[]::new)); - } - - Optional result = alert.showAndWait(); - if (result.get() == ButtonType.OK) { - openURI(getEmbeddedHelpURL()); - } - } - - private static GettingStartedStage create() { - Stage stage = new Stage(); - stage.setResizable(true); - - if (isWindowsApp()) { - stage.getIcons().setAll(ResourceManager.getApplicationIconResources().map(URL::toString).map(Image::new).toArray(Image[]::new)); - stage.initStyle(StageStyle.DECORATED); - stage.initModality(Modality.NONE); - } else { - stage.initStyle(StageStyle.UTILITY); - stage.initModality(Modality.NONE); - } - - return new GettingStartedStage(stage); - } - private Stage stage; public GettingStartedStage(Stage stage) { diff --git a/source/net/filebot/ui/GettingStartedUtil.java b/source/net/filebot/ui/GettingStartedUtil.java new file mode 100644 index 00000000..1267d7f7 --- /dev/null +++ b/source/net/filebot/ui/GettingStartedUtil.java @@ -0,0 +1,63 @@ +package net.filebot.ui; + +import static net.filebot.Settings.*; +import static net.filebot.util.ui.SwingUI.*; + +import java.net.URL; +import java.util.Optional; + +import javafx.scene.control.Alert; +import javafx.scene.control.Alert.AlertType; +import javafx.scene.control.ButtonType; +import javafx.scene.image.Image; +import javafx.stage.Modality; +import javafx.stage.Stage; +import javafx.stage.StageStyle; +import net.filebot.ResourceManager; + +public class GettingStartedUtil { + + public static void openGettingStarted(boolean webview) { + invokeJavaFX(() -> { + if (webview) { + openEmbeddedGettingStartedPage(); + } else { + askGettingStartedHelp(); // libjfxwebkit.dylib cannot be deployed on the MAS due to deprecated dependencies + } + }); + } + + private static void askGettingStartedHelp() { + Alert alert = new Alert(AlertType.CONFIRMATION); + alert.setTitle("FileBot"); + alert.setHeaderText("Hello! Do you need help Getting Started?"); + alert.setContentText("If you have never used FileBot before, please have a look at the video tutorials first."); + + if (isWindowsApp()) { + Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); + stage.getIcons().setAll(ResourceManager.getApplicationIconResources().map(URL::toString).map(Image::new).toArray(Image[]::new)); + } + + Optional result = alert.showAndWait(); + if (result.get() == ButtonType.OK) { + openURI(getEmbeddedHelpURL()); + } + } + + private static void openEmbeddedGettingStartedPage() { + Stage stage = new Stage(); + stage.setResizable(true); + + if (isWindowsApp()) { + stage.getIcons().setAll(ResourceManager.getApplicationIconResources().map(URL::toString).map(Image::new).toArray(Image[]::new)); + stage.initStyle(StageStyle.DECORATED); + stage.initModality(Modality.NONE); + } else { + stage.initStyle(StageStyle.UTILITY); + stage.initModality(Modality.NONE); + } + + new GettingStartedStage(stage).show(); + } + +}