v0.12 hotfixes & JDK11 migration.

This commit is contained in:
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 ## Requirements
JRE and JavaFX should be installed on your PC. JRE 11 (v8 before v0.12 +JavaFX For example, in Debian Stretch you should install 'openjfx' package.) should be installed on your PC.
For example, in Debian Stretch you should install 'openjfx' package.
## Usage ## Usage
@ -28,7 +27,7 @@ $ java -jar mplayer4anime.jar
## Run on windows ## Run on windows
Step 1. 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 http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
Step 2. Step 2.

29
pom.xml
View file

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

View file

@ -1,3 +1,3 @@
Manifest-Version: 1.0 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.Scene;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.stage.Stage; import javafx.stage.Stage;
import mplayer4anime.Main; import mplayer4anime.MainFX;
import java.io.IOException; import java.io.IOException;
import java.util.Locale; import java.util.Locale;
@ -37,10 +37,10 @@ public class AboutWindow {
stageAbout.setTitle(resourceBundle.getString("about_AboutName")); stageAbout.setTitle(resourceBundle.getString("about_AboutName"));
stageAbout.getIcons().addAll( stageAbout.getIcons().addAll(
new Image(Main.class.getResourceAsStream("/res/app_icon32x32.png")), new Image(MainFX.class.getResourceAsStream("/res/app_icon32x32.png")),
new Image(Main.class.getResourceAsStream("/res/app_icon48x48.png")), new Image(MainFX.class.getResourceAsStream("/res/app_icon48x48.png")),
new Image(Main.class.getResourceAsStream("/res/app_icon64x64.png")), new Image(MainFX.class.getResourceAsStream("/res/app_icon64x64.png")),
new Image(Main.class.getResourceAsStream("/res/app_icon128x128.png")) new Image(MainFX.class.getResourceAsStream("/res/app_icon128x128.png"))
); // TODO: change to something reliable ); // TODO: change to something reliable
stageAbout.setScene(new Scene(parentAbout, 500, 500)); 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. // 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(){ void shutdown(){
appPreferences.setLastTimeUsedSubsEncoding(subPaneController.getSelectedEncoding()); appPreferences.setLastTimeUsedSubsEncoding(subPaneController.getSelectedEncoding());
appPreferences.setFullScreenSelected(fullScreen.isSelected()); appPreferences.setFullScreenSelected(fullScreen.isSelected());

View file

@ -1,77 +1,9 @@
package mplayer4anime; 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; // NOTE: Club of disabled congratulates new member!
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; public class Main {
import java.util.ResourceBundle; public static void main(String[] args){
MainFX.main(args);
//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();
} }
} }

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