* show Getting Started help on first start
This commit is contained in:
parent
9af6ff066b
commit
7e7cbf7e8b
|
@ -55,6 +55,7 @@ import net.filebot.cli.CmdlineOperations;
|
||||||
import net.filebot.format.ExpressionFormat;
|
import net.filebot.format.ExpressionFormat;
|
||||||
import net.filebot.mac.MacAppUtilities;
|
import net.filebot.mac.MacAppUtilities;
|
||||||
import net.filebot.ui.FileBotMenuBar;
|
import net.filebot.ui.FileBotMenuBar;
|
||||||
|
import net.filebot.ui.GettingStartedStage;
|
||||||
import net.filebot.ui.MainFrame;
|
import net.filebot.ui.MainFrame;
|
||||||
import net.filebot.ui.PanelBuilder;
|
import net.filebot.ui.PanelBuilder;
|
||||||
import net.filebot.ui.SinglePanelFrame;
|
import net.filebot.ui.SinglePanelFrame;
|
||||||
|
@ -201,6 +202,15 @@ public class Main {
|
||||||
Logger.getLogger(Main.class.getName()).log(Level.WARNING, "Failed to check for updates", e);
|
Logger.getLogger(Main.class.getName()).log(Level.WARNING, "Failed to check for updates", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if application help should be shown
|
||||||
|
if (!"skip".equals(System.getProperty("application.help"))) {
|
||||||
|
try {
|
||||||
|
checkGettingStarted();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.getLogger(Main.class.getName()).log(Level.WARNING, "Failed to show Getting Started help", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// illegal arguments => just print CLI error message and stop
|
// illegal arguments => just print CLI error message and stop
|
||||||
System.err.println(e.getMessage());
|
System.err.println(e.getMessage());
|
||||||
|
@ -355,6 +365,19 @@ public class Main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show Getting Started to new users
|
||||||
|
*/
|
||||||
|
private static void checkGettingStarted() throws Exception {
|
||||||
|
PreferencesEntry<String> started = Settings.forPackage(Main.class).entry("getting.started").defaultValue("0");
|
||||||
|
if ("0".equals(started.getValue())) {
|
||||||
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
GettingStartedStage.start();
|
||||||
|
});
|
||||||
|
started.setValue("1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void showDonationReminder() {
|
private static void showDonationReminder() {
|
||||||
PreferencesEntry<String> donation = Settings.forPackage(Main.class).entry("donation").defaultValue("0");
|
PreferencesEntry<String> donation = Settings.forPackage(Main.class).entry("donation").defaultValue("0");
|
||||||
int donationRev = Integer.parseInt(donation.getValue());
|
int donationRev = Integer.parseInt(donation.getValue());
|
||||||
|
|
|
@ -206,6 +206,10 @@ public final class Settings {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static URI getEmbeddedHelpURI() {
|
||||||
|
return URI.create("http://www.filebot.net/getting-started/embed.html#" + getApplicationDeployment());
|
||||||
|
}
|
||||||
|
|
||||||
public static Map<String, URI> getHelpURIs() {
|
public static Map<String, URI> getHelpURIs() {
|
||||||
Map<String, URI> links = new LinkedHashMap<String, URI>();
|
Map<String, URI> links = new LinkedHashMap<String, URI>();
|
||||||
links.put("Getting Started", URI.create("http://www.filebot.net/getting-started/"));
|
links.put("Getting Started", URI.create("http://www.filebot.net/getting-started/"));
|
||||||
|
|
|
@ -299,6 +299,7 @@ public class UserFiles {
|
||||||
try {
|
try {
|
||||||
// initialize JavaFX
|
// initialize JavaFX
|
||||||
new javafx.embed.swing.JFXPanel();
|
new javafx.embed.swing.JFXPanel();
|
||||||
|
javafx.application.Platform.setImplicitExit(false);
|
||||||
|
|
||||||
// run on FX Thread
|
// run on FX Thread
|
||||||
FutureTask<T> task = new FutureTask<T>(c);
|
FutureTask<T> task = new FutureTask<T>(c);
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
package net.filebot.ui;
|
||||||
|
|
||||||
|
import java.awt.Desktop;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.concurrent.Worker.State;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.web.WebEngine;
|
||||||
|
import javafx.scene.web.WebView;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import net.filebot.Main;
|
||||||
|
import net.filebot.Settings;
|
||||||
|
|
||||||
|
public class GettingStartedStage {
|
||||||
|
|
||||||
|
public static void start() {
|
||||||
|
// initialize JavaFX
|
||||||
|
new javafx.embed.swing.JFXPanel();
|
||||||
|
javafx.application.Platform.setImplicitExit(false);
|
||||||
|
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
Stage stage = new Stage();
|
||||||
|
stage.setResizable(false);
|
||||||
|
|
||||||
|
GettingStartedStage view = new GettingStartedStage(stage);
|
||||||
|
view.show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private Stage stage;
|
||||||
|
|
||||||
|
public GettingStartedStage(Stage stage) {
|
||||||
|
this.stage = stage;
|
||||||
|
|
||||||
|
WebView webview = new WebView();
|
||||||
|
webview.getEngine().load(Settings.getEmbeddedHelpURI().toString());
|
||||||
|
webview.setPrefSize(750, 480);
|
||||||
|
|
||||||
|
// intercept target _blank click events and open links in a new browser window
|
||||||
|
webview.getEngine().setCreatePopupHandler((config) -> onPopup(webview));
|
||||||
|
|
||||||
|
webview.getEngine().getLoadWorker().stateProperty().addListener((value, oldState, newState) -> {
|
||||||
|
if (newState == State.SUCCEEDED) {
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
stage.setOpacity(1);
|
||||||
|
stage.show();
|
||||||
|
stage.toFront();
|
||||||
|
stage.requestFocus();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
stage.hide();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
stage.setTitle("Getting Started");
|
||||||
|
stage.setScene(new Scene(webview, webview.getPrefWidth(), webview.getPrefHeight(), Color.BLACK));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show() {
|
||||||
|
stage.setOpacity(0);
|
||||||
|
stage.show();
|
||||||
|
stage.toBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WebEngine onPopup(WebView webview) {
|
||||||
|
// get currently select image via Galleria API
|
||||||
|
Object link = webview.getEngine().executeScript("$('.galleria').data('galleria').getData().link");
|
||||||
|
|
||||||
|
try {
|
||||||
|
Desktop.getDesktop().browse(new URI(link.toString()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.getLogger(Main.class.getName()).log(Level.WARNING, "Failed to browse URI", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// prevent current web view from opening the link
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
|
||||||
|
<script src="galleria/galleria-1.4.2.min.js"></script>
|
||||||
|
<script src="galleria/themes/classic/galleria.classic.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="galleria/themes/classic/galleria.classic.css">
|
||||||
|
<style>
|
||||||
|
body{ margin: 0; padding: 0; background: #000; }
|
||||||
|
div.galleria{ width: 100%; height: 100%; background: #000; position: absolute; top: 0; bottom: 0; }
|
||||||
|
div.galleria-thumbnails { margin: auto;}
|
||||||
|
</style>
|
||||||
|
<title>Getting Started</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="galleria">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var data = [
|
||||||
|
{ link: 'https://www.youtube.com/watch?v=RRq2_Pjyko8&index=1&list=PLdPvEJhzxLMCEJJpb1mJtVkOpS7FfALnd', image: 'images/rename.png', thumb: 'images/rename.thumb.png' },
|
||||||
|
{ link: 'https://www.youtube.com/watch?v=btNSv7AnMMw&index=2&list=PLdPvEJhzxLMCEJJpb1mJtVkOpS7FfALnd', image: 'images/episodes.png', thumb: 'images/episodes.thumb.png' },
|
||||||
|
{ link: 'https://www.youtube.com/watch?v=q-oZ_hovsTY&index=3&list=PLdPvEJhzxLMCEJJpb1mJtVkOpS7FfALnd', image: 'images/subtitle-hash-lookup.png', thumb: 'images/subtitle-hash-lookup.thumb.png' },
|
||||||
|
{ link: 'https://www.youtube.com/watch?v=R80tKtHf4zw&index=4&list=PLdPvEJhzxLMCEJJpb1mJtVkOpS7FfALnd', image: 'images/subtitle-search.png', thumb: 'images/subtitle-search.thumb.png' },
|
||||||
|
{ link: 'https://www.youtube.com/watch?v=4KWkSPr3fQY&index=5&list=PLdPvEJhzxLMCEJJpb1mJtVkOpS7FfALnd', image: 'images/sfv.png', thumb: 'images/sfv.thumb.png' },
|
||||||
|
{ image: 'images/permissions.png', thumb: 'images/permissions.thumb.png' }
|
||||||
|
];
|
||||||
|
Galleria.run('.galleria', {
|
||||||
|
dataSource: data,
|
||||||
|
maxScaleRatio: 1,
|
||||||
|
youtube: {
|
||||||
|
VQ: 'HD1080'
|
||||||
|
},
|
||||||
|
popupLinks: true
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -18,12 +18,11 @@
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var data = [
|
var data = [
|
||||||
{ video: 'http://www.youtube.com/watch?v=btNSv7AnMMw', image: 'images/rename.png', thumb: 'images/rename.thumb.png' },
|
{ video: 'http://www.youtube.com/watch?v=RRq2_Pjyko8', image: 'images/rename.png', thumb: 'images/rename.thumb.png' },
|
||||||
{ video: 'http://www.youtube.com/watch?v=GCZrz8siv4Q', image: 'images/episodes.png', thumb: 'images/episodes.thumb.png' },
|
{ video: 'http://www.youtube.com/watch?v=btNSv7AnMMw', image: 'images/episodes.png', thumb: 'images/episodes.thumb.png' },
|
||||||
{ video: 'http://www.youtube.com/watch?v=oZ_hovsTY', image: 'images/subtitle-hash-lookup.png', thumb: 'images/subtitle-hash-lookup.thumb.png' },
|
{ video: 'http://www.youtube.com/watch?v=q-oZ_hovsTY', image: 'images/subtitle-hash-lookup.png', thumb: 'images/subtitle-hash-lookup.thumb.png' },
|
||||||
{ video: 'http://www.youtube.com/watch?v=R80tKtHf4zw', image: 'images/subtitle-search.png', thumb: 'images/subtitle-search.thumb.png' },
|
{ video: 'http://www.youtube.com/watch?v=R80tKtHf4zw', image: 'images/subtitle-search.png', thumb: 'images/subtitle-search.thumb.png' },
|
||||||
{ video: 'http://www.youtube.com/watch?v=4KWkSPr3fQY', image: 'images/sfv.png', thumb: 'images/sfv.thumb.png' },
|
{ video: 'http://www.youtube.com/watch?v=4KWkSPr3fQY', image: 'images/sfv.png', thumb: 'images/sfv.thumb.png' }
|
||||||
{ image: 'images/permissions.png', thumb: 'images/permissions.thumb.png' }
|
|
||||||
];
|
];
|
||||||
Galleria.run('.galleria', {
|
Galleria.run('.galleria', {
|
||||||
dataSource: data,
|
dataSource: data,
|
||||||
|
|
Loading…
Reference in New Issue