diff --git a/pom.xml b/pom.xml
index 9d4e913..f085e5a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,19 +27,19 @@
org.openjfx
javafx-controls
- 11.0.1
+ 12
org.openjfx
javafx-fxml
- 11.0.1
+ 12
org.openjfx
javafx-media
- 11.0.1
+ 12
@@ -57,19 +57,19 @@
org.xerial
sqlite-jdbc
- 3.25.2
+ 3.27.2.1
org.apache.logging.log4j
log4j-api
- 2.11.1
+ 2.11.2
org.apache.logging.log4j
log4j-core
- 2.11.1
+ 2.11.2
diff --git a/src/main/java/com/cemu_UI/application/Main.java b/src/main/java/com/cemu_UI/application/Main.java
index d4d5294..4c42fb6 100644
--- a/src/main/java/com/cemu_UI/application/Main.java
+++ b/src/main/java/com/cemu_UI/application/Main.java
@@ -50,14 +50,15 @@ import javafx.scene.layout.AnchorPane;
public class Main extends Application {
+ private final String gamesDBdownloadURL = "https://git.mosad.xyz/Seil0/cemu_UI/raw/branch/master/downloadContent/games.db";
private static Main main;
- private Stage primaryStage;
+ private static XMLController xmlController;
private MainWindowController mainWindowController;
private CloudController cloudController;
- private static XMLController xmlController;
+ private Stage primaryStage;
private AnchorPane pane;
private Scene scene;
- private String gamesDBdownloadURL = "https://git.mosad.xyz/Seil0/cemu_UI/raw/branch/master/downloadContent/games.db";
+
private static Logger LOGGER;
@Override
@@ -103,12 +104,12 @@ public class Main extends Application {
// check if client_secret.json is present
if (Main.class.getResourceAsStream("/client_secret.json") == null) {
LOGGER.error("client_secret is missing!!!!!");
-
+
Alert alert = new Alert(AlertType.ERROR);
- alert.setTitle("cemu_UI");
- alert.setHeaderText("Error");
- alert.setContentText("client_secret is missing! Please contact the maintainer. \nIf you compiled cemu_UI by yourself see: \nhttps://git.mosad.xyz/Seil0/cemu_UI/wiki/Documantation");
- alert.showAndWait();
+ alert.setTitle("cemu_UI");
+ alert.setHeaderText("Error");
+ alert.setContentText("client_secret is missing! Please contact the maintainer. \nIf you compiled cemu_UI by yourself see: \nhttps://git.mosad.xyz/Seil0/cemu_UI/wiki/Documantation");
+ alert.showAndWait();
}
if (!XMLController.getDirCemuUI().exists()) {
@@ -151,10 +152,8 @@ public class Main extends Application {
// if cloud sync is activated start sync
if (XMLController.isCloudSync()) {
- cloudController.initializeConnection(XMLController.getCloudService(),
- XMLController.getCemuPath());
- cloudController.sync(XMLController.getCloudService(), XMLController.getCemuPath(),
- XMLController.getDirCemuUIPath());
+ cloudController.initializeConnection(XMLController.getCloudService(), XMLController.getCemuPath());
+ cloudController.sync(XMLController.getCloudService(), XMLController.getCemuPath(), XMLController.getDirCemuUIPath());
}
} catch (IOException e) {
@@ -190,8 +189,7 @@ public class Main extends Application {
if (result.get() == ButtonType.OK) {
DirectoryChooser directoryChooser = new DirectoryChooser();
File selectedDirectory = directoryChooser.showDialog(primaryStage);
- XMLController.setCemuPath(selectedDirectory.getAbsolutePath());
-
+ XMLController.setCemuPath(selectedDirectory.getAbsolutePath());
} else {
XMLController.setCemuPath(null);
}
diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java
index 96d415e..f7ed5ca 100644
--- a/src/main/java/com/cemu_UI/application/MainWindowController.java
+++ b/src/main/java/com/cemu_UI/application/MainWindowController.java
@@ -57,7 +57,7 @@ import com.cemu_UI.datatypes.SmmdbApiDataType;
import com.cemu_UI.datatypes.UIROMDataType;
import com.cemu_UI.uiElements.JFXEditGameDialog;
import com.cemu_UI.uiElements.JFXInfoAlert;
-import com.cemu_UI.uiElements.JFXOkayCancelDialog;
+import com.cemu_UI.uiElements.JFXOkayCancelAlert;
import com.cemu_UI.uiElements.JFXTextAreaInfoDialog;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXColorPicker;
@@ -183,9 +183,7 @@ public class MainWindowController {
private XMLController xmlController;
private Stage primaryStage;
private boolean menuTrue = false;
- private boolean settingsTrue = false;
private boolean playTrue = false;
- private boolean smmdbTrue = false;
private String gameExecutePath;
private String dialogBtnStyle;
private String selectedGameTitleID;
@@ -235,38 +233,11 @@ public class MainWindowController {
// language support
private ResourceBundle bundle;
private String language;
- private String editHeadingText;
- private String editBodyText;
- private String removeHeadingText;
- private String removeBodyText;
- private String addUpdateHeadingText;
- private String addUpdateBodyText;
- private String addDLCHeadingText;
- private String addDLCBodyText;
- private String licensesLblHeadingText;
- private String licensesLblBodyText;
- private String showLicenses;
- private String aboutBtnHeadingText;
- private String aboutBtnBodyText;
- private String cloudSyncWaringHeadingText;
- private String cloudSyncWaringBodyText;
- private String cloudSyncErrorHeadingText;
- private String cloudSyncErrorBodyText;
- private String addGameBtnHeadingText;
- private String addGameBtnBodyText;
- private String addBtnReturnErrorHeadingText;
- private String addBtnReturnErrorBodyText;
private String lastPlayed;
private String today;
private String yesterday;
private String never;
- private String playBtnPlay;
- private String playBtnUpdating;
- private String playBtnCopyingFiles;
- private String smmdbDownloadBtnLoading;
- private String smmdbDownloadBtnDownload;
-
public MainWindowController(Main main) {
xmlController = new XMLController();
this.main = main;
@@ -353,6 +324,7 @@ public class MainWindowController {
if (playTrue) {
playBtnSlideOut();
}
+
if (menuTrue) {
sideMenuSlideOut();
burgerTask.setRate(-1.0);
@@ -364,16 +336,15 @@ public class MainWindowController {
burgerTask.play();
menuTrue = true;
}
- if (settingsTrue) {
+
+ if (settingsScrollPane.isVisible()) {
settingsScrollPane.setVisible(false);
xmlController.saveSettings();
- settingsTrue = false;
- }
- if (smmdbTrue) {
- smmdbAnchorPane.setVisible(false);
- smmdbTrue = false;
}
+ if (smmdbAnchorPane.isVisible()) {
+ smmdbAnchorPane.setVisible(false);
+ }
});
edit.setOnAction(new EventHandler() {
@@ -384,8 +355,8 @@ public class MainWindowController {
String[] gameInfo = dbController.getGameInfo(selectedGameTitleID);
// new edit dialog
- String headingText = editHeadingText + " \"" + selectedGameTitle + "\"";
- JFXEditGameDialog editGameDialog = new JFXEditGameDialog(headingText, editBodyText, dialogBtnStyle, 450,
+ String headingText = bundle.getString("editHeadingText") + " \"" + selectedGameTitle + "\"";
+ JFXEditGameDialog editGameDialog = new JFXEditGameDialog(headingText, bundle.getString("editBodyText"), dialogBtnStyle, 450,
300, 1, MWC, primaryStage, main.getPane());
editGameDialog.setTitle(gameInfo[0]);
editGameDialog.setCoverPath(gameInfo[1]);
@@ -403,8 +374,8 @@ public class MainWindowController {
public void handle(ActionEvent event) {
try {
LOGGER.info("remove " + selectedGameTitle + "(" + selectedGameTitleID + ")");
- String headingText = removeHeadingText + " \"" + selectedGameTitle + "\"";
- String bodyText = removeBodyText + " " + selectedGameTitle + " ?";
+ String headingText = bundle.getString("removeHeadingText") + " \"" + selectedGameTitle + "\"";
+ String bodyText = bundle.getString("removeBodyText") + " " + selectedGameTitle + " ?";
EventHandler okayAction = new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -424,10 +395,12 @@ public class MainWindowController {
LOGGER.info("Action canceld by user!");
}
};
-
- JFXOkayCancelDialog removeGameDialog = new JFXOkayCancelDialog(headingText, bodyText,
- dialogBtnStyle, 350, 170, okayAction, cancelAction, main.getPane(), bundle);
- removeGameDialog.show();
+
+ JFXOkayCancelAlert removeGameAlert = new JFXOkayCancelAlert(headingText,
+ bodyText, dialogBtnStyle, primaryStage);
+ removeGameAlert.setOkayAction(okayAction);
+ removeGameAlert.setCancelAction(cancelAction);
+ removeGameAlert.showAndWait();
} catch (Exception e) {
LOGGER.error("error while removing " + selectedGameTitle + "(" + selectedGameTitleID + ")", e);
}
@@ -439,7 +412,7 @@ public class MainWindowController {
public void handle(ActionEvent event) {
try {
LOGGER.info("update: " + selectedGameTitleID);
- String headingText = addUpdateHeadingText + " \"" + selectedGameTitle + "\"";
+
EventHandler okayAction = new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -457,10 +430,10 @@ public class MainWindowController {
try {
LOGGER.info("copying the content of " + updatePath + " to " + destDir.toString());
- playBtn.setText(playBtnUpdating);
+ playBtn.setText(bundle.getString("playBtnUpdating"));
playBtn.setDisable(true);
FileUtils.copyDirectory(srcDir, destDir);
- playBtn.setText(playBtnPlay);
+ playBtn.setText(bundle.getString("playBtnPlay"));
playBtn.setDisable(false);
LOGGER.info("copying files done!");
} catch (IOException e) {
@@ -476,9 +449,12 @@ public class MainWindowController {
}
};
- JFXOkayCancelDialog updateGameDialog = new JFXOkayCancelDialog(headingText, addUpdateBodyText,
- dialogBtnStyle, 350, 170, okayAction, cancelAction, main.getPane(), bundle);
- updateGameDialog.show();
+ String headingText = bundle.getString("addUpdateHeadingText") + " \"" + selectedGameTitle + "\"";
+ JFXOkayCancelAlert updateGameAlert = new JFXOkayCancelAlert(headingText,
+ bundle.getString("addUpdateBodyText"), dialogBtnStyle, primaryStage);
+ updateGameAlert.setOkayAction(okayAction);
+ updateGameAlert.setCancelAction(cancelAction);
+ updateGameAlert.showAndWait();
} catch (Exception e) {
LOGGER.warn("trying to update " + selectedGameTitleID + ",which is not a valid type!", e);
}
@@ -490,7 +466,7 @@ public class MainWindowController {
public void handle(ActionEvent event) {
try {
LOGGER.info("add DLC: " + selectedGameTitleID);
- String headingText = addDLCHeadingText + " \"" + selectedGameTitle + "\"";
+ String headingText = bundle.getString("addDLCHeadingText") + " \"" + selectedGameTitle + "\"";
EventHandler okayAction = new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -508,10 +484,10 @@ public class MainWindowController {
try {
LOGGER.info("copying the content of " + dlcPath + " to " + destDir.toString());
- playBtn.setText(playBtnCopyingFiles);
+ playBtn.setText(bundle.getString("playBtnCopyingFiles"));
playBtn.setDisable(true);
FileUtils.copyDirectory(srcDir, destDir);
- playBtn.setText(playBtnPlay);
+ playBtn.setText(bundle.getString("playBtnPlay"));
playBtn.setDisable(false);
LOGGER.info("copying files done!");
} catch (IOException e) {
@@ -526,10 +502,12 @@ public class MainWindowController {
LOGGER.info("Action canceld by user!");
}
};
-
- JFXOkayCancelDialog addDLCDialog = new JFXOkayCancelDialog(headingText, addDLCBodyText, dialogBtnStyle,
- 350, 170, okayAction, cancelAction, main.getPane(), bundle);
- addDLCDialog.show();
+
+ JFXOkayCancelAlert addDLCAlert = new JFXOkayCancelAlert(headingText,
+ bundle.getString("addDLCBodyText"), dialogBtnStyle, primaryStage);
+ addDLCAlert.setOkayAction(okayAction);
+ addDLCAlert.setCancelAction(cancelAction);
+ addDLCAlert.showAndWait();
} catch (Exception e) {
LOGGER.warn("trying to add a dlc to " + selectedGameTitleID + ",which is not a valid type!", e);
}
@@ -562,9 +540,7 @@ public class MainWindowController {
root.getChildren().remove(0, root.getChildren().size());
for (int i = 0; i < courses.size(); i++) {
- if (courses.get(i).getTitle().toLowerCase()
- .contains(courseSearchTextFiled.getText().toLowerCase())) {
-
+ if (courses.get(i).getTitle().toLowerCase().contains(courseSearchTextFiled.getText().toLowerCase())) {
// add data from courses to filteredCourses where title contains search input
filteredCourses.add(courses.get(i));
}
@@ -683,11 +659,13 @@ public class MainWindowController {
}
};
- JFXOkayCancelDialog licenseOverviewDialog = new JFXOkayCancelDialog(licensesLblHeadingText,
- licensesLblBodyText, dialogBtnStyle, 350, 275, okayAction, cancelAction, main.getPane(),
- bundle);
- licenseOverviewDialog.setCancelText(showLicenses);
- licenseOverviewDialog.show();
+ JFXOkayCancelAlert licenseOverviewAlert = new JFXOkayCancelAlert(
+ bundle.getString("licensesLblHeadingText"), bundle.getString("licensesLblBodyText"),
+ dialogBtnStyle, primaryStage);
+ licenseOverviewAlert.setOkayAction(okayAction);
+ licenseOverviewAlert.setCancelAction(cancelAction);
+ licenseOverviewAlert.setCancelText(bundle.getString("showLicenses"));
+ licenseOverviewAlert.showAndWait();
}
}
});
@@ -734,26 +712,19 @@ public class MainWindowController {
@FXML
private void aboutBtnAction() {
String bodyText = "cemu_UI by @Seil0 \nVersion: " + version + " (" + buildNumber + ") \"" + versionName + "\" \n"
- + aboutBtnBodyText;
+ + bundle.getString("aboutBtnBodyText");
- JFXInfoAlert infoAlert = new JFXInfoAlert(aboutBtnHeadingText, bodyText, dialogBtnStyle, primaryStage);
+ JFXInfoAlert infoAlert = new JFXInfoAlert(bundle.getString("aboutBtnHeadingText"), bodyText, dialogBtnStyle, primaryStage);
infoAlert.showAndWait();
}
@FXML
private void settingsBtnAction() {
- if (smmdbTrue) {
+ if (smmdbAnchorPane.isVisible()) {
smmdbAnchorPane.setVisible(false);
- smmdbTrue = false;
- }
- if (settingsTrue) {
- settingsScrollPane.setVisible(false);
- settingsTrue = false;
- xmlController.saveSettings();
- } else {
- settingsScrollPane.setVisible(true);
- settingsTrue = true;
}
+ settingsScrollPane.setVisible(!settingsScrollPane.isVisible());
+ xmlController.saveSettings(); // saving settings to be sure
}
@FXML
@@ -764,19 +735,15 @@ public class MainWindowController {
@FXML
private void smmdbBtnAction() {
// show smmdbAnchorPane
- if (smmdbTrue) {
- smmdbAnchorPane.setVisible(false);
- smmdbTrue = false;
- } else {
- smmdbAnchorPane.setVisible(true);
- smmdbTrue = true;
-
+ smmdbAnchorPane.setVisible(!smmdbAnchorPane.isVisible());
+
+ if (smmdbAnchorPane.isVisible()) {
// start query in new thread
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
Platform.runLater(() -> {
- smmdbDownloadBtn.setText(smmdbDownloadBtnLoading);
+ smmdbDownloadBtn.setText(bundle.getString("smmdbDownloadBtnLoading"));
smmdbDownloadBtn.setDisable(true);
root.getChildren().remove(0,root.getChildren().size());
});
@@ -790,7 +757,7 @@ public class MainWindowController {
Platform.runLater(() -> {
root.getChildren().add(new TreeItem(helpCourse)); // add data to root-node
- smmdbDownloadBtn.setText(smmdbDownloadBtnDownload);
+ smmdbDownloadBtn.setText(bundle.getString("smmdbDownloadBtnDownload"));
smmdbDownloadBtn.setDisable(false);
});
}
@@ -951,8 +918,9 @@ public class MainWindowController {
cloudSyncToggleBtn.setSelected(false);
// cloud sync init error dialog
- JFXInfoAlert cloudSyncErrorDialog = new JFXInfoAlert(cloudSyncErrorHeadingText,
- cloudSyncErrorBodyText, dialogBtnStyle, primaryStage);
+ JFXInfoAlert cloudSyncErrorDialog = new JFXInfoAlert(
+ bundle.getString("cloudSyncErrorHeadingText"),
+ bundle.getString("cloudSyncErrorBodyText"), dialogBtnStyle, primaryStage);
cloudSyncErrorDialog.showAndWait();
}
@@ -969,10 +937,12 @@ public class MainWindowController {
}
};
- JFXOkayCancelDialog cloudSyncWarningDialog = new JFXOkayCancelDialog(cloudSyncWaringHeadingText,
- cloudSyncWaringBodyText, dialogBtnStyle, 419, 140, okayAction, cancelAction, main.getPane(),
- bundle);
- cloudSyncWarningDialog.show();
+ JFXOkayCancelAlert cloudSyncWarningAlert = new JFXOkayCancelAlert(
+ bundle.getString("cloudSyncWaringHeadingText"), bundle.getString("cloudSyncWaringHeadingText"),
+ dialogBtnStyle, primaryStage);
+ cloudSyncWarningAlert.setOkayAction(okayAction);
+ cloudSyncWarningAlert.setCancelAction(cancelAction);
+ cloudSyncWarningAlert.showAndWait();
}
}
@@ -984,10 +954,9 @@ public class MainWindowController {
@FXML
private void addBtnAction() {
- String headingText = addGameBtnHeadingText;
- String bodyText = addGameBtnBodyText;
- JFXEditGameDialog addGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 450, 300, 0,
- this, primaryStage, main.getPane());
+ JFXEditGameDialog addGameDialog = new JFXEditGameDialog(bundle.getString("addGameBtnHeadingText"),
+ bundle.getString("addGameBtnBodyText"), dialogBtnStyle, 450, 300, 0, this, primaryStage,
+ main.getPane());
addGameDialog.show();
}
@@ -1005,8 +974,8 @@ public class MainWindowController {
LOGGER.info("No parameter set!");
//addGame error dialog
- JFXInfoAlert errorDialog = new JFXInfoAlert(addBtnReturnErrorHeadingText, addBtnReturnErrorBodyText,
- dialogBtnStyle, primaryStage);
+ JFXInfoAlert errorDialog = new JFXInfoAlert(bundle.getString("addBtnReturnErrorHeadingText"),
+ bundle.getString("addBtnReturnErrorBodyText"), dialogBtnStyle, primaryStage);
errorDialog.showAndWait();
} else {
@@ -1204,17 +1173,20 @@ public class MainWindowController {
// set the selected local strings to all needed elements
void setUILanguage(){
switch(XMLController.getUsrLocal()){
- case "en_US":
- bundle = ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.US); //us_English
+ case "en_US":
+ XMLController.setLocalBundle(ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.US)); // us_English
+ bundle = ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.US); // us_English
languageChoisBox.getSelectionModel().select(0);
break;
- case "de_DE":
- bundle = ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.GERMAN); //German
- languageChoisBox.getSelectionModel().select(1);
+ case "de_DE":
+ XMLController.setLocalBundle(ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.GERMAN)); // German
+ bundle = ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.GERMAN); // German
+ languageChoisBox.getSelectionModel().select(1);
break;
- default:
- bundle = ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.US); //default local
- languageChoisBox.getSelectionModel().select(0);
+ default:
+ XMLController.setLocalBundle(ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.US)); // default local
+ bundle = ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.US); // default local
+ languageChoisBox.getSelectionModel().select(0);
break;
}
@@ -1251,37 +1223,10 @@ public class MainWindowController {
timeColumn.setText(bundle.getString("timeColumn"));
// Strings
- editHeadingText = bundle.getString("editHeadingText");
- editBodyText = bundle.getString("editBodyText");
- removeHeadingText = bundle.getString("removeHeadingText");
- removeBodyText = bundle.getString("removeBodyText");
- addUpdateHeadingText = bundle.getString("addUpdateHeadingText");
- addUpdateBodyText = bundle.getString("addUpdateBodyText");
- addDLCHeadingText = bundle.getString("addDLCHeadingText");
- addDLCBodyText = bundle.getString("addDLCBodyText");
- licensesLblHeadingText = bundle.getString("licensesLblHeadingText");
- licensesLblBodyText = bundle.getString("licensesLblBodyText");
- showLicenses = bundle.getString("showLicenses");
- aboutBtnHeadingText = bundle.getString("aboutBtnHeadingText");
- aboutBtnBodyText = bundle.getString("aboutBtnBodyText");
- cloudSyncWaringHeadingText = bundle.getString("cloudSyncWaringHeadingText");
- cloudSyncWaringBodyText = bundle.getString("cloudSyncWaringBodyText");
- cloudSyncErrorHeadingText = bundle.getString("cloudSyncErrorHeadingText");
- cloudSyncErrorBodyText = bundle.getString("cloudSyncErrorBodyText");
- addGameBtnHeadingText = bundle.getString("addGameBtnHeadingText");
- addGameBtnBodyText = bundle.getString("addGameBtnBodyText");
- addBtnReturnErrorHeadingText = bundle.getString("addBtnReturnErrorHeadingText");
- addBtnReturnErrorBodyText = bundle.getString("addBtnReturnErrorBodyText");
lastPlayed = bundle.getString("lastPlayed");
today = bundle.getString("today");
yesterday = bundle.getString("yesterday");
never = bundle.getString("never");
-
- playBtnPlay = bundle.getString("playBtnPlay");
- playBtnUpdating = bundle.getString("playBtnUpdating");
- playBtnCopyingFiles = bundle.getString("playBtnCopyingFiles");
- smmdbDownloadBtnLoading = bundle.getString("smmdbDownloadBtnLoading");
- smmdbDownloadBtnDownload = bundle.getString("smmdbDownloadBtnDownload");
}
// if AutoUpdate, then check for updates
diff --git a/src/main/java/com/cemu_UI/application/playGame.java b/src/main/java/com/cemu_UI/application/playGame.java
index 78ec3e6..8930493 100644
--- a/src/main/java/com/cemu_UI/application/playGame.java
+++ b/src/main/java/com/cemu_UI/application/playGame.java
@@ -31,7 +31,7 @@ import com.cemu_UI.controller.XMLController;
import javafx.application.Platform;
-public class playGame extends Thread{
+public class playGame extends Thread {
private MainWindowController mainWindowController;
private DBController dbController;
diff --git a/src/main/java/com/cemu_UI/controller/UpdateController.java b/src/main/java/com/cemu_UI/controller/UpdateController.java
index 4fa6929..074aa0e 100644
--- a/src/main/java/com/cemu_UI/controller/UpdateController.java
+++ b/src/main/java/com/cemu_UI/controller/UpdateController.java
@@ -39,6 +39,7 @@ import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue;
+
import javafx.application.Platform;
public class UpdateController implements Runnable {
@@ -70,7 +71,7 @@ public class UpdateController implements Runnable {
public void run() {
LOGGER.info("beta:" + useBeta + "; checking for updates ...");
Platform.runLater(() -> {
- mainWindowController.getUpdateBtn().setText(mainWindowController.getBundle().getString("updateBtnChecking"));
+ mainWindowController.getUpdateBtn().setText(XMLController.getLocalBundle().getString("updateBtnChecking"));
});
try {
@@ -111,12 +112,12 @@ public class UpdateController implements Runnable {
*/
if (buildNumber >= updateBuildNumber) {
Platform.runLater(() -> {
- mainWindowController.getUpdateBtn().setText(mainWindowController.getBundle().getString("updateBtnNoUpdateAvailable"));
+ mainWindowController.getUpdateBtn().setText(XMLController.getLocalBundle().getString("updateBtnNoUpdateAvailable"));
});
LOGGER.info("no update available");
} else {
Platform.runLater(() -> {
- mainWindowController.getUpdateBtn().setText(mainWindowController.getBundle().getString("updateBtnUpdateAvailable"));
+ mainWindowController.getUpdateBtn().setText(XMLController.getLocalBundle().getString("updateBtnUpdateAvailable"));
});
LOGGER.info("update available");
browserDownloadUrl = objectAsset.getString("browser_download_url", "");
diff --git a/src/main/java/com/cemu_UI/controller/XMLController.java b/src/main/java/com/cemu_UI/controller/XMLController.java
index 8a1180b..210fcb6 100644
--- a/src/main/java/com/cemu_UI/controller/XMLController.java
+++ b/src/main/java/com/cemu_UI/controller/XMLController.java
@@ -26,7 +26,9 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.Locale;
import java.util.Properties;
+import java.util.ResourceBundle;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -57,6 +59,7 @@ public class XMLController {
private static boolean useBeta = false;
private static boolean fullscreen = false;
private static boolean cloudSync = false;
+ private static ResourceBundle localBundle = ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.US);
private static String cemuPath;
private static String romDirectoryPath;
@@ -344,6 +347,14 @@ public class XMLController {
public static void setCloudSync(boolean cloudSync) {
XMLController.cloudSync = cloudSync;
}
+
+ public static ResourceBundle getLocalBundle() {
+ return localBundle;
+ }
+
+ public static void setLocalBundle(ResourceBundle localBundle) {
+ XMLController.localBundle = localBundle;
+ }
public static String getCemuPath() {
return cemuPath;
diff --git a/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java b/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java
index 78ba990..8aef197 100644
--- a/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java
+++ b/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java
@@ -1,7 +1,7 @@
/**
* cemu_UI
*
- * Copyright 2017-2018 <@Seil0>
+ * Copyright 2017-2019 <@Seil0>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,11 +18,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
+
package com.cemu_UI.uiElements;
import java.io.File;
import com.cemu_UI.application.MainWindowController;
+import com.cemu_UI.controller.XMLController;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXDialog;
import com.jfoenix.controls.JFXDialogLayout;
@@ -88,13 +90,13 @@ public class JFXEditGameDialog {
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
TextField gameTitleTF = new TextField();
- gameTitleTF.setPromptText(mwc.getBundle().getString("gameTitle"));
+ gameTitleTF.setPromptText(XMLController.getLocalBundle().getString("gameTitle"));
TextField gameTitleIDTF = new TextField();
- gameTitleIDTF.setPromptText(mwc.getBundle().getString("titleID"));
+ gameTitleIDTF.setPromptText(XMLController.getLocalBundle().getString("titleID"));
TextField romPathTF = new TextField();
- romPathTF.setPromptText(mwc.getBundle().getString("romPath"));
+ romPathTF.setPromptText(XMLController.getLocalBundle().getString("romPath"));
TextField gameCoverTF = new TextField();
- gameCoverTF.setPromptText(mwc.getBundle().getString("coverPath"));
+ gameCoverTF.setPromptText(XMLController.getLocalBundle().getString("coverPath"));
if (mode == 1) {
gameTitleTF.setText(title);
@@ -105,7 +107,7 @@ public class JFXEditGameDialog {
gameTitleIDTF.setEditable(false);
}
- JFXButton okayBtn = new JFXButton(mwc.getBundle().getString("okayBtnText"));
+ JFXButton okayBtn = new JFXButton(XMLController.getLocalBundle().getString("okayBtnText"));
okayBtn.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -115,9 +117,10 @@ public class JFXEditGameDialog {
// LOGGER.info("No parameter set!");
// addGame error dialog
- String headingTextError = mwc.getBundle().getString("editGameDialogHeadingTextError");
- String bodyTextError = mwc.getBundle().getString("editGameDialogBodyTextError");
- JFXInfoAlert errorDialog = new JFXInfoAlert(headingTextError, bodyTextError, dialogBtnStyle, stage);
+ JFXInfoAlert errorDialog = new JFXInfoAlert(
+ XMLController.getLocalBundle().getString("editGameDialogHeadingTextError"),
+ XMLController.getLocalBundle().getString("editGameDialogBodyTextError"), dialogBtnStyle,
+ stage);
errorDialog.showAndWait();
} else {
switch (mode) {
@@ -144,7 +147,7 @@ public class JFXEditGameDialog {
okayBtn.setPrefHeight(32);
okayBtn.setStyle(dialogBtnStyle);
- JFXButton cancelBtn = new JFXButton(mwc.getBundle().getString("cancelBtnText"));
+ JFXButton cancelBtn = new JFXButton(XMLController.getLocalBundle().getString("cancelBtnText"));
cancelBtn.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -155,7 +158,7 @@ public class JFXEditGameDialog {
cancelBtn.setPrefHeight(32);
cancelBtn.setStyle(dialogBtnStyle);
- JFXButton selectPathBtn = new JFXButton(mwc.getBundle().getString("editGameDialogSelectPathBtn"));
+ JFXButton selectPathBtn = new JFXButton(XMLController.getLocalBundle().getString("editGameDialogSelectPathBtn"));
selectPathBtn.setPrefWidth(110);
selectPathBtn.setStyle(dialogBtnStyle);
selectPathBtn.setOnAction(new EventHandler() {
@@ -167,7 +170,7 @@ public class JFXEditGameDialog {
}
});
- JFXButton selectCoverBtn = new JFXButton(mwc.getBundle().getString("editGameDialogSelectCoverBtn"));
+ JFXButton selectCoverBtn = new JFXButton(XMLController.getLocalBundle().getString("editGameDialogSelectCoverBtn"));
selectCoverBtn.setPrefWidth(110);
selectCoverBtn.setStyle(dialogBtnStyle);
selectCoverBtn.setOnAction(new EventHandler() {
@@ -183,14 +186,14 @@ public class JFXEditGameDialog {
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(15, 10, 10, 10));
- grid.add(new Label(mwc.getBundle().getString("gameTitle") + ":"), 0, 0);
+ grid.add(new Label(XMLController.getLocalBundle().getString("gameTitle") + ":"), 0, 0);
grid.add(gameTitleTF, 1, 0);
- grid.add(new Label(mwc.getBundle().getString("titleID") + ":"), 0, 1);
+ grid.add(new Label(XMLController.getLocalBundle().getString("titleID") + ":"), 0, 1);
grid.add(gameTitleIDTF, 1, 1);
- grid.add(new Label(mwc.getBundle().getString("romPath") + ":"), 0, 2);
+ grid.add(new Label(XMLController.getLocalBundle().getString("romPath") + ":"), 0, 2);
grid.add(romPathTF, 1, 2);
grid.add(selectPathBtn, 2, 2);
- grid.add(new Label(mwc.getBundle().getString("coverPath") + ":"), 0, 3);
+ grid.add(new Label(XMLController.getLocalBundle().getString("coverPath") + ":"), 0, 3);
grid.add(gameCoverTF, 1, 3);
grid.add(selectCoverBtn, 2, 3);
diff --git a/src/main/java/com/cemu_UI/uiElements/JFXInfoAlert.java b/src/main/java/com/cemu_UI/uiElements/JFXInfoAlert.java
index 04399aa..71b2b00 100644
--- a/src/main/java/com/cemu_UI/uiElements/JFXInfoAlert.java
+++ b/src/main/java/com/cemu_UI/uiElements/JFXInfoAlert.java
@@ -1,7 +1,7 @@
/**
* Kellerkinder Framework Alerts
*
- * Copyright 2018 <@Seil0>
+ * Copyright 2017-2019 <@Seil0>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
+
package com.cemu_UI.uiElements;
import com.jfoenix.controls.JFXAlert;
diff --git a/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelAlert.java b/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelAlert.java
new file mode 100644
index 0000000..cb90e58
--- /dev/null
+++ b/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelAlert.java
@@ -0,0 +1,127 @@
+package com.cemu_UI.uiElements;
+
+import com.cemu_UI.controller.XMLController;
+import com.jfoenix.controls.JFXAlert;
+import com.jfoenix.controls.JFXButton;
+import com.jfoenix.controls.JFXDialogLayout;
+
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
+import javafx.scene.text.Text;
+import javafx.stage.Stage;
+
+public class JFXOkayCancelAlert {
+
+ private String headingText;
+ private String bodyText;
+ private String btnStyle;
+ private Stage stage;
+
+ private EventHandler okayAction;
+ private EventHandler cancelAction;
+
+ private String okayText = XMLController.getLocalBundle().getString("okayBtnText");
+ private String cancelText = XMLController.getLocalBundle().getString("cancelBtnText");
+
+ public JFXOkayCancelAlert(String headingText, String bodyText, String btnStyle, Stage stage) {
+ setHeadingText(headingText);
+ setBodyText(bodyText);
+ setBtnStyle(btnStyle);
+ setStage(stage);
+ }
+
+ public void showAndWait( ) {
+ JFXAlert alert = new JFXAlert<>(stage);
+
+ JFXButton okayBtn = new JFXButton(okayText);
+ okayBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
+ alert.close();
+ });
+ okayBtn.addEventHandler(ActionEvent.ACTION, okayAction);
+ okayBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
+ okayBtn.setPrefHeight(32);
+ okayBtn.setStyle(btnStyle);
+
+ JFXButton cancelBtn = new JFXButton(cancelText);
+ cancelBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
+ alert.close();
+ });
+ cancelBtn.addEventHandler(ActionEvent.ACTION, cancelAction);
+ cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
+ cancelBtn.setPrefHeight(32);
+ cancelBtn.setStyle(btnStyle);
+
+
+ JFXDialogLayout content = new JFXDialogLayout();
+ content.setActions(cancelBtn, okayBtn);
+ content.setHeading(new Text(headingText));
+ content.setBody(new Text(bodyText));
+ alert.setContent(content);
+ alert.showAndWait();
+ }
+
+ public String getHeadingText() {
+ return headingText;
+ }
+
+ public void setHeadingText(String headingText) {
+ this.headingText = headingText;
+ }
+
+ public String getBodyText() {
+ return bodyText;
+ }
+
+ public void setBodyText(String bodyText) {
+ this.bodyText = bodyText;
+ }
+
+ public String getBtnStyle() {
+ return btnStyle;
+ }
+
+ public void setBtnStyle(String btnStyle) {
+ this.btnStyle = btnStyle;
+ }
+
+ public String getOkayText() {
+ return okayText;
+ }
+
+ public void setOkayText(String okayText) {
+ this.okayText = okayText;
+ }
+
+ public String getCancelText() {
+ return cancelText;
+ }
+
+ public void setCancelText(String cancelText) {
+ this.cancelText = cancelText;
+ }
+
+ public Stage getStage() {
+ return stage;
+ }
+
+ public void setStage(Stage stage) {
+ this.stage = stage;
+ }
+
+ public EventHandler getOkayAction() {
+ return okayAction;
+ }
+
+ public void setOkayAction(EventHandler okayAction) {
+ this.okayAction = okayAction;
+ }
+
+ public EventHandler getCancelAction() {
+ return cancelAction;
+ }
+
+ public void setCancelAction(EventHandler cancelAction) {
+ this.cancelAction = cancelAction;
+ }
+
+}
diff --git a/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelDialog.java b/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelDialog.java
deleted file mode 100644
index 47d2ff8..0000000
--- a/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelDialog.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/**
- * cemu_UI
- *
- * Copyright 2017-2018 <@Seil0>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package com.cemu_UI.uiElements;
-
-import java.util.ResourceBundle;
-
-import com.jfoenix.controls.JFXButton;
-import com.jfoenix.controls.JFXDialog;
-import com.jfoenix.controls.JFXDialogLayout;
-
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
-import javafx.scene.layout.AnchorPane;
-import javafx.scene.layout.Pane;
-import javafx.scene.layout.StackPane;
-import javafx.scene.text.Text;
-
-public class JFXOkayCancelDialog {
-
- private String headingText;
- private String bodyText;
- private String dialogBtnStyle;
- private String okayText;
- private String cancelText;
- private int dialogWidth;
- private int dialogHeight;
- private EventHandler okayAction;
- private EventHandler cancelAction;
- private Pane pane;
-
- /**
- * Creates a new JFoenix Dialog to show some information with okay and cancel option
- * @param headingText Heading Text, just the heading
- * @param bodyText body Text, all other text belongs here
- * @param dialogBtnStyle Style of the okay button
- * @param dialogWidth dialog width
- * @param dialogHeight dialog height
- * @param okayAction action which is performed if the okay button is clicked
- * @param cancelAction action which is performed if the cancel button is clicked
- * @param pane pane to which the dialog belongs
- */
- public JFXOkayCancelDialog(String headingText, String bodyText, String dialogBtnStyle, int dialogWidth,
- int dialogHeight, EventHandler okayAction, EventHandler cancelAction, Pane pane,
- ResourceBundle bundle) {
- this.headingText = headingText;
- this.bodyText = bodyText;
- this.dialogBtnStyle = dialogBtnStyle;
- this.dialogWidth = dialogWidth;
- this.dialogHeight = dialogHeight;
- this.okayAction = okayAction;
- this.cancelAction = cancelAction;
- this.pane = pane;
- okayText = bundle.getString("okayBtnText");
- cancelText = bundle.getString("cancelBtnText");
- }
-
- public void show() {
-
- JFXDialogLayout content = new JFXDialogLayout();
- content.setHeading(new Text(headingText));
- content.setBody(new Text(bodyText));
- StackPane stackPane = new StackPane();
- stackPane.autosize();
- JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
- JFXButton okayBtn = new JFXButton(okayText);
- okayBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
- dialog.close();
- });
- okayBtn.addEventHandler(ActionEvent.ACTION, okayAction);
- okayBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
- okayBtn.setPrefHeight(32);
- okayBtn.setStyle(dialogBtnStyle);
- JFXButton cancelBtn = new JFXButton(cancelText);
- cancelBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
- dialog.close();
- });
- cancelBtn.addEventHandler(ActionEvent.ACTION, cancelAction);
- cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
- cancelBtn.setPrefHeight(32);
- cancelBtn.setStyle(dialogBtnStyle);
- content.setActions(cancelBtn, okayBtn);
- content.setPrefSize(dialogWidth, dialogHeight);
- pane.getChildren().add(stackPane);
- AnchorPane.setTopAnchor(stackPane, (pane.getHeight()-content.getPrefHeight())/2);
- AnchorPane.setLeftAnchor(stackPane, (pane.getWidth()-content.getPrefWidth())/2);
- dialog.show();
- }
-
- public String getOkayText() {
- return okayText;
- }
-
- public void setOkayText(String okayText) {
- this.okayText = okayText;
- }
-
- public String getCancelText() {
- return cancelText;
- }
-
- public void setCancelText(String cancelText) {
- this.cancelText = cancelText;
- }
-
- public EventHandler getOkayAction() {
- return okayAction;
- }
-
- public void setOkayAction(EventHandler okayAction) {
- this.okayAction = okayAction;
- }
-
- public EventHandler getCancelAction() {
- return cancelAction;
- }
-
- public void setCancelAction(EventHandler cancelAction) {
- this.cancelAction = cancelAction;
- }
-
-}
-
diff --git a/src/main/java/com/cemu_UI/uiElements/JFXTextAreaInfoDialog.java b/src/main/java/com/cemu_UI/uiElements/JFXTextAreaInfoDialog.java
index 2831162..4e191da 100644
--- a/src/main/java/com/cemu_UI/uiElements/JFXTextAreaInfoDialog.java
+++ b/src/main/java/com/cemu_UI/uiElements/JFXTextAreaInfoDialog.java
@@ -1,7 +1,7 @@
/**
* cemu_UI
*
- * Copyright 2017-2018 <@Seil0>
+ * Copyright 2017-2019 <@Seil0>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
+
package com.cemu_UI.uiElements;
import com.jfoenix.controls.JFXButton;