v0.12 hotfixes & JDK11 migration.

master
Dmitry Isaenko 2019-01-05 23:25:52 +03:00
parent 4e0ba6f086
commit afb970e1cb
8 changed files with 118 additions and 93 deletions

View File

@ -16,8 +16,7 @@ Pay attention, that this lib uses Apache-2.0 license
## Requirements
JRE and JavaFX should be installed on your PC.
For example, in Debian Stretch you should install 'openjfx' package.
JRE 11 (v8 before v0.12 +JavaFX For example, in Debian Stretch you should install 'openjfx' package.) should be installed on your PC.
## Usage
@ -28,7 +27,7 @@ $ java -jar mplayer4anime.jar
## Run on windows
Step 1.
Download and install JRE (8 or later):
Download and install JRE (~~8~~ 11 or later):
http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
Step 2.

29
pom.xml
View File

@ -19,6 +19,24 @@
<version>2.8.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
@ -27,20 +45,19 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.3</version>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<mainClass>
mplayer4anime.Main
</mainClass>
<addClasspath>true</addClasspath>
<mainClass>mplayer4anime.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>

View File

@ -1,3 +1,3 @@
Manifest-Version: 1.0
Main-Class: mplayer4anime.Main
Main-Class: mplayer4anime.MainFX

View File

@ -6,7 +6,7 @@ import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import mplayer4anime.Main;
import mplayer4anime.MainFX;
import java.io.IOException;
import java.util.Locale;
@ -37,10 +37,10 @@ public class AboutWindow {
stageAbout.setTitle(resourceBundle.getString("about_AboutName"));
stageAbout.getIcons().addAll(
new Image(Main.class.getResourceAsStream("/res/app_icon32x32.png")),
new Image(Main.class.getResourceAsStream("/res/app_icon48x48.png")),
new Image(Main.class.getResourceAsStream("/res/app_icon64x64.png")),
new Image(Main.class.getResourceAsStream("/res/app_icon128x128.png"))
new Image(MainFX.class.getResourceAsStream("/res/app_icon32x32.png")),
new Image(MainFX.class.getResourceAsStream("/res/app_icon48x48.png")),
new Image(MainFX.class.getResourceAsStream("/res/app_icon64x64.png")),
new Image(MainFX.class.getResourceAsStream("/res/app_icon128x128.png"))
); // TODO: change to something reliable
stageAbout.setScene(new Scene(parentAbout, 500, 500));

View File

@ -230,7 +230,7 @@ public class Controller implements Initializable {
}
// Will be used to store lists previously opened.
// Linkage established by ohHidden in Main.java class
// Linkage established by ohHidden in MainFX.java class
void shutdown(){
appPreferences.setLastTimeUsedSubsEncoding(subPaneController.getSelectedEncoding());
appPreferences.setFullScreenSelected(fullScreen.isSelected());

View File

@ -1,77 +1,9 @@
package mplayer4anime;
/**
Name: mplayer4anime
@author Dmitry Isaenko
License: GNU GPL v.3
@version 0.12
@see https://developersu.blogspot.com/search/label/mplayer4anime
@see https://github.com/developersu/mplayer4anime
2018-2019, Russia
*/
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import mplayer4anime.IPC.SingleInstanceHandler;
// NOTE: Club of disabled congratulates new member!
import java.util.Locale;
import java.util.ResourceBundle;
//TODO: Use one copy of AppPreferences object widely
//TODO: Drag-n-drop playlist/files/audio
//TODO: remember selected
//TODO: remember position
public class Main extends Application {
public static void main(String[] args) { launch(args); }
@Override
public void start(Stage primaryStage) throws Exception{
FXMLLoader loader = new FXMLLoader(getClass().getResource("/landingPage.fxml"));
if (Locale.getDefault().getISO3Language().equals("rus")) {
loader.setResources(ResourceBundle.getBundle("locale", new Locale("ru")));
} else {
loader.setResources(ResourceBundle.getBundle("locale", new Locale("en")));
}
Parent root = loader.load();
// tmp?
Controller controller = loader.getController();
controller.setHostServices(getHostServices());
SingleInstanceHandler sih;
if (!getParameters().getUnnamed().isEmpty())
sih = new SingleInstanceHandler(controller, getParameters().getUnnamed().get(0));
else
sih = new SingleInstanceHandler(controller, null);
// end
Thread tsih = new Thread(sih);
tsih.start();
// TODO: refactor needed?
Runtime.getRuntime().addShutdownHook(new Thread(() -> tsih.interrupt()));
primaryStage.getIcons().addAll(
new Image(Main.class.getResourceAsStream("/res/app_icon32x32.png")),
new Image(Main.class.getResourceAsStream("/res/app_icon48x48.png")),
new Image(Main.class.getResourceAsStream("/res/app_icon64x64.png")),
new Image(Main.class.getResourceAsStream("/res/app_icon128x128.png"))
);
primaryStage.setTitle("mplayer4anime");
primaryStage.setMinWidth(500);
primaryStage.setMinHeight(375);
primaryStage.setScene(new Scene(root, 1200, 800));
// Make linkage to controller method to handle exit() event in there.
primaryStage.setOnHidden(e -> {
tsih.interrupt();
controller.shutdown();
});
primaryStage.show();
public class Main {
public static void main(String[] args){
MainFX.main(args);
}
}

View File

@ -0,0 +1,77 @@
package mplayer4anime;
/**
Name: mplayer4anime
@author Dmitry Isaenko
License: GNU GPL v.3
@version 0.12
@see https://developersu.blogspot.com/search/label/mplayer4anime
@see https://github.com/developersu/mplayer4anime
2018-2019, Russia
*/
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import mplayer4anime.IPC.SingleInstanceHandler;
import java.util.Locale;
import java.util.ResourceBundle;
//TODO: Use one copy of AppPreferences object widely
//TODO: Drag-n-drop playlist/files/audio
//TODO: remember selected
//TODO: remember position
public class MainFX extends Application {
public static void main(String[] args) { launch(args); }
@Override
public void start(Stage primaryStage) throws Exception{
FXMLLoader loader = new FXMLLoader(getClass().getResource("/landingPage.fxml"));
if (Locale.getDefault().getISO3Language().equals("rus")) {
loader.setResources(ResourceBundle.getBundle("locale", new Locale("ru")));
} else {
loader.setResources(ResourceBundle.getBundle("locale", new Locale("en")));
}
Parent root = loader.load();
// tmp?
Controller controller = loader.getController();
controller.setHostServices(getHostServices());
SingleInstanceHandler sih;
if (!getParameters().getUnnamed().isEmpty())
sih = new SingleInstanceHandler(controller, getParameters().getUnnamed().get(0));
else
sih = new SingleInstanceHandler(controller, null);
// end
Thread tsih = new Thread(sih);
tsih.start();
// TODO: refactor needed?
Runtime.getRuntime().addShutdownHook(new Thread(() -> tsih.interrupt()));
primaryStage.getIcons().addAll(
new Image(MainFX.class.getResourceAsStream("/res/app_icon32x32.png")),
new Image(MainFX.class.getResourceAsStream("/res/app_icon48x48.png")),
new Image(MainFX.class.getResourceAsStream("/res/app_icon64x64.png")),
new Image(MainFX.class.getResourceAsStream("/res/app_icon128x128.png"))
);
primaryStage.setTitle("mplayer4anime");
primaryStage.setMinWidth(500);
primaryStage.setMinHeight(375);
primaryStage.setScene(new Scene(root, 1200, 800));
// Make linkage to controller method to handle exit() event in there.
primaryStage.setOnHidden(e -> {
tsih.interrupt();
controller.shutdown();
});
primaryStage.show();
}
}

View File

@ -5,7 +5,7 @@ import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import mplayer4anime.Main;
import mplayer4anime.MainFX;
import java.io.IOException;
import java.util.Locale;
@ -36,10 +36,10 @@ public class SettingsWindow {
stageAbout.setTitle(resourceBundle.getString("settings_SettingsName"));
stageAbout.getIcons().addAll(
new Image(Main.class.getResourceAsStream("/res/settings_icon32x32.png")),
new Image(Main.class.getResourceAsStream("/res/settings_icon48x48.png")),
new Image(Main.class.getResourceAsStream("/res/settings_icon64x64.png")),
new Image(Main.class.getResourceAsStream("/res/settings_icon128x128.png"))
new Image(MainFX.class.getResourceAsStream("/res/settings_icon32x32.png")),
new Image(MainFX.class.getResourceAsStream("/res/settings_icon48x48.png")),
new Image(MainFX.class.getResourceAsStream("/res/settings_icon64x64.png")),
new Image(MainFX.class.getResourceAsStream("/res/settings_icon128x128.png"))
); // TODO: change to something reliable
stageAbout.setScene(new Scene(parentAbout, 570, 500));
stageAbout.show();