parent
e59b14074e
commit
df33c21826
12
pom.xml
12
pom.xml
|
@ -27,19 +27,19 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-controls</artifactId>
|
<artifactId>javafx-controls</artifactId>
|
||||||
<version>11.0.1</version>
|
<version>12</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-fxml</artifactId>
|
<artifactId>javafx-fxml</artifactId>
|
||||||
<version>11.0.1</version>
|
<version>12</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-media</artifactId>
|
<artifactId>javafx-media</artifactId>
|
||||||
<version>11.0.1</version>
|
<version>12</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -57,19 +57,19 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial</groupId>
|
<groupId>org.xerial</groupId>
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.25.2</version>
|
<version>3.27.2.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-api</artifactId>
|
<artifactId>log4j-api</artifactId>
|
||||||
<version>2.11.1</version>
|
<version>2.11.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-core</artifactId>
|
<artifactId>log4j-core</artifactId>
|
||||||
<version>2.11.1</version>
|
<version>2.11.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -50,14 +50,15 @@ import javafx.scene.layout.AnchorPane;
|
||||||
|
|
||||||
public class Main extends Application {
|
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 static Main main;
|
||||||
private Stage primaryStage;
|
private static XMLController xmlController;
|
||||||
private MainWindowController mainWindowController;
|
private MainWindowController mainWindowController;
|
||||||
private CloudController cloudController;
|
private CloudController cloudController;
|
||||||
private static XMLController xmlController;
|
private Stage primaryStage;
|
||||||
private AnchorPane pane;
|
private AnchorPane pane;
|
||||||
private Scene scene;
|
private Scene scene;
|
||||||
private String gamesDBdownloadURL = "https://git.mosad.xyz/Seil0/cemu_UI/raw/branch/master/downloadContent/games.db";
|
|
||||||
private static Logger LOGGER;
|
private static Logger LOGGER;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -151,10 +152,8 @@ public class Main extends Application {
|
||||||
|
|
||||||
// if cloud sync is activated start sync
|
// if cloud sync is activated start sync
|
||||||
if (XMLController.isCloudSync()) {
|
if (XMLController.isCloudSync()) {
|
||||||
cloudController.initializeConnection(XMLController.getCloudService(),
|
cloudController.initializeConnection(XMLController.getCloudService(), XMLController.getCemuPath());
|
||||||
XMLController.getCemuPath());
|
cloudController.sync(XMLController.getCloudService(), XMLController.getCemuPath(), XMLController.getDirCemuUIPath());
|
||||||
cloudController.sync(XMLController.getCloudService(), XMLController.getCemuPath(),
|
|
||||||
XMLController.getDirCemuUIPath());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -191,7 +190,6 @@ public class Main extends Application {
|
||||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||||
File selectedDirectory = directoryChooser.showDialog(primaryStage);
|
File selectedDirectory = directoryChooser.showDialog(primaryStage);
|
||||||
XMLController.setCemuPath(selectedDirectory.getAbsolutePath());
|
XMLController.setCemuPath(selectedDirectory.getAbsolutePath());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
XMLController.setCemuPath(null);
|
XMLController.setCemuPath(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ import com.cemu_UI.datatypes.SmmdbApiDataType;
|
||||||
import com.cemu_UI.datatypes.UIROMDataType;
|
import com.cemu_UI.datatypes.UIROMDataType;
|
||||||
import com.cemu_UI.uiElements.JFXEditGameDialog;
|
import com.cemu_UI.uiElements.JFXEditGameDialog;
|
||||||
import com.cemu_UI.uiElements.JFXInfoAlert;
|
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.cemu_UI.uiElements.JFXTextAreaInfoDialog;
|
||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
import com.jfoenix.controls.JFXColorPicker;
|
import com.jfoenix.controls.JFXColorPicker;
|
||||||
|
@ -183,9 +183,7 @@ public class MainWindowController {
|
||||||
private XMLController xmlController;
|
private XMLController xmlController;
|
||||||
private Stage primaryStage;
|
private Stage primaryStage;
|
||||||
private boolean menuTrue = false;
|
private boolean menuTrue = false;
|
||||||
private boolean settingsTrue = false;
|
|
||||||
private boolean playTrue = false;
|
private boolean playTrue = false;
|
||||||
private boolean smmdbTrue = false;
|
|
||||||
private String gameExecutePath;
|
private String gameExecutePath;
|
||||||
private String dialogBtnStyle;
|
private String dialogBtnStyle;
|
||||||
private String selectedGameTitleID;
|
private String selectedGameTitleID;
|
||||||
|
@ -235,38 +233,11 @@ public class MainWindowController {
|
||||||
// language support
|
// language support
|
||||||
private ResourceBundle bundle;
|
private ResourceBundle bundle;
|
||||||
private String language;
|
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 lastPlayed;
|
||||||
private String today;
|
private String today;
|
||||||
private String yesterday;
|
private String yesterday;
|
||||||
private String never;
|
private String never;
|
||||||
|
|
||||||
private String playBtnPlay;
|
|
||||||
private String playBtnUpdating;
|
|
||||||
private String playBtnCopyingFiles;
|
|
||||||
private String smmdbDownloadBtnLoading;
|
|
||||||
private String smmdbDownloadBtnDownload;
|
|
||||||
|
|
||||||
public MainWindowController(Main main) {
|
public MainWindowController(Main main) {
|
||||||
xmlController = new XMLController();
|
xmlController = new XMLController();
|
||||||
this.main = main;
|
this.main = main;
|
||||||
|
@ -353,6 +324,7 @@ public class MainWindowController {
|
||||||
if (playTrue) {
|
if (playTrue) {
|
||||||
playBtnSlideOut();
|
playBtnSlideOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menuTrue) {
|
if (menuTrue) {
|
||||||
sideMenuSlideOut();
|
sideMenuSlideOut();
|
||||||
burgerTask.setRate(-1.0);
|
burgerTask.setRate(-1.0);
|
||||||
|
@ -364,16 +336,15 @@ public class MainWindowController {
|
||||||
burgerTask.play();
|
burgerTask.play();
|
||||||
menuTrue = true;
|
menuTrue = true;
|
||||||
}
|
}
|
||||||
if (settingsTrue) {
|
|
||||||
|
if (settingsScrollPane.isVisible()) {
|
||||||
settingsScrollPane.setVisible(false);
|
settingsScrollPane.setVisible(false);
|
||||||
xmlController.saveSettings();
|
xmlController.saveSettings();
|
||||||
settingsTrue = false;
|
|
||||||
}
|
|
||||||
if (smmdbTrue) {
|
|
||||||
smmdbAnchorPane.setVisible(false);
|
|
||||||
smmdbTrue = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (smmdbAnchorPane.isVisible()) {
|
||||||
|
smmdbAnchorPane.setVisible(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
edit.setOnAction(new EventHandler<ActionEvent>() {
|
edit.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
|
@ -384,8 +355,8 @@ public class MainWindowController {
|
||||||
String[] gameInfo = dbController.getGameInfo(selectedGameTitleID);
|
String[] gameInfo = dbController.getGameInfo(selectedGameTitleID);
|
||||||
|
|
||||||
// new edit dialog
|
// new edit dialog
|
||||||
String headingText = editHeadingText + " \"" + selectedGameTitle + "\"";
|
String headingText = bundle.getString("editHeadingText") + " \"" + selectedGameTitle + "\"";
|
||||||
JFXEditGameDialog editGameDialog = new JFXEditGameDialog(headingText, editBodyText, dialogBtnStyle, 450,
|
JFXEditGameDialog editGameDialog = new JFXEditGameDialog(headingText, bundle.getString("editBodyText"), dialogBtnStyle, 450,
|
||||||
300, 1, MWC, primaryStage, main.getPane());
|
300, 1, MWC, primaryStage, main.getPane());
|
||||||
editGameDialog.setTitle(gameInfo[0]);
|
editGameDialog.setTitle(gameInfo[0]);
|
||||||
editGameDialog.setCoverPath(gameInfo[1]);
|
editGameDialog.setCoverPath(gameInfo[1]);
|
||||||
|
@ -403,8 +374,8 @@ public class MainWindowController {
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
try {
|
try {
|
||||||
LOGGER.info("remove " + selectedGameTitle + "(" + selectedGameTitleID + ")");
|
LOGGER.info("remove " + selectedGameTitle + "(" + selectedGameTitleID + ")");
|
||||||
String headingText = removeHeadingText + " \"" + selectedGameTitle + "\"";
|
String headingText = bundle.getString("removeHeadingText") + " \"" + selectedGameTitle + "\"";
|
||||||
String bodyText = removeBodyText + " " + selectedGameTitle + " ?";
|
String bodyText = bundle.getString("removeBodyText") + " " + selectedGameTitle + " ?";
|
||||||
EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>() {
|
EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
|
@ -425,9 +396,11 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
JFXOkayCancelDialog removeGameDialog = new JFXOkayCancelDialog(headingText, bodyText,
|
JFXOkayCancelAlert removeGameAlert = new JFXOkayCancelAlert(headingText,
|
||||||
dialogBtnStyle, 350, 170, okayAction, cancelAction, main.getPane(), bundle);
|
bodyText, dialogBtnStyle, primaryStage);
|
||||||
removeGameDialog.show();
|
removeGameAlert.setOkayAction(okayAction);
|
||||||
|
removeGameAlert.setCancelAction(cancelAction);
|
||||||
|
removeGameAlert.showAndWait();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("error while removing " + selectedGameTitle + "(" + selectedGameTitleID + ")", e);
|
LOGGER.error("error while removing " + selectedGameTitle + "(" + selectedGameTitleID + ")", e);
|
||||||
}
|
}
|
||||||
|
@ -439,7 +412,7 @@ public class MainWindowController {
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
try {
|
try {
|
||||||
LOGGER.info("update: " + selectedGameTitleID);
|
LOGGER.info("update: " + selectedGameTitleID);
|
||||||
String headingText = addUpdateHeadingText + " \"" + selectedGameTitle + "\"";
|
|
||||||
EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>() {
|
EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
|
@ -457,10 +430,10 @@ public class MainWindowController {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LOGGER.info("copying the content of " + updatePath + " to " + destDir.toString());
|
LOGGER.info("copying the content of " + updatePath + " to " + destDir.toString());
|
||||||
playBtn.setText(playBtnUpdating);
|
playBtn.setText(bundle.getString("playBtnUpdating"));
|
||||||
playBtn.setDisable(true);
|
playBtn.setDisable(true);
|
||||||
FileUtils.copyDirectory(srcDir, destDir);
|
FileUtils.copyDirectory(srcDir, destDir);
|
||||||
playBtn.setText(playBtnPlay);
|
playBtn.setText(bundle.getString("playBtnPlay"));
|
||||||
playBtn.setDisable(false);
|
playBtn.setDisable(false);
|
||||||
LOGGER.info("copying files done!");
|
LOGGER.info("copying files done!");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -476,9 +449,12 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
JFXOkayCancelDialog updateGameDialog = new JFXOkayCancelDialog(headingText, addUpdateBodyText,
|
String headingText = bundle.getString("addUpdateHeadingText") + " \"" + selectedGameTitle + "\"";
|
||||||
dialogBtnStyle, 350, 170, okayAction, cancelAction, main.getPane(), bundle);
|
JFXOkayCancelAlert updateGameAlert = new JFXOkayCancelAlert(headingText,
|
||||||
updateGameDialog.show();
|
bundle.getString("addUpdateBodyText"), dialogBtnStyle, primaryStage);
|
||||||
|
updateGameAlert.setOkayAction(okayAction);
|
||||||
|
updateGameAlert.setCancelAction(cancelAction);
|
||||||
|
updateGameAlert.showAndWait();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.warn("trying to update " + selectedGameTitleID + ",which is not a valid type!", 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) {
|
public void handle(ActionEvent event) {
|
||||||
try {
|
try {
|
||||||
LOGGER.info("add DLC: " + selectedGameTitleID);
|
LOGGER.info("add DLC: " + selectedGameTitleID);
|
||||||
String headingText = addDLCHeadingText + " \"" + selectedGameTitle + "\"";
|
String headingText = bundle.getString("addDLCHeadingText") + " \"" + selectedGameTitle + "\"";
|
||||||
EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>() {
|
EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
|
@ -508,10 +484,10 @@ public class MainWindowController {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LOGGER.info("copying the content of " + dlcPath + " to " + destDir.toString());
|
LOGGER.info("copying the content of " + dlcPath + " to " + destDir.toString());
|
||||||
playBtn.setText(playBtnCopyingFiles);
|
playBtn.setText(bundle.getString("playBtnCopyingFiles"));
|
||||||
playBtn.setDisable(true);
|
playBtn.setDisable(true);
|
||||||
FileUtils.copyDirectory(srcDir, destDir);
|
FileUtils.copyDirectory(srcDir, destDir);
|
||||||
playBtn.setText(playBtnPlay);
|
playBtn.setText(bundle.getString("playBtnPlay"));
|
||||||
playBtn.setDisable(false);
|
playBtn.setDisable(false);
|
||||||
LOGGER.info("copying files done!");
|
LOGGER.info("copying files done!");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -527,9 +503,11 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
JFXOkayCancelDialog addDLCDialog = new JFXOkayCancelDialog(headingText, addDLCBodyText, dialogBtnStyle,
|
JFXOkayCancelAlert addDLCAlert = new JFXOkayCancelAlert(headingText,
|
||||||
350, 170, okayAction, cancelAction, main.getPane(), bundle);
|
bundle.getString("addDLCBodyText"), dialogBtnStyle, primaryStage);
|
||||||
addDLCDialog.show();
|
addDLCAlert.setOkayAction(okayAction);
|
||||||
|
addDLCAlert.setCancelAction(cancelAction);
|
||||||
|
addDLCAlert.showAndWait();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.warn("trying to add a dlc to " + selectedGameTitleID + ",which is not a valid type!", 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());
|
root.getChildren().remove(0, root.getChildren().size());
|
||||||
|
|
||||||
for (int i = 0; i < courses.size(); i++) {
|
for (int i = 0; i < courses.size(); i++) {
|
||||||
if (courses.get(i).getTitle().toLowerCase()
|
if (courses.get(i).getTitle().toLowerCase().contains(courseSearchTextFiled.getText().toLowerCase())) {
|
||||||
.contains(courseSearchTextFiled.getText().toLowerCase())) {
|
|
||||||
|
|
||||||
// add data from courses to filteredCourses where title contains search input
|
// add data from courses to filteredCourses where title contains search input
|
||||||
filteredCourses.add(courses.get(i));
|
filteredCourses.add(courses.get(i));
|
||||||
}
|
}
|
||||||
|
@ -683,11 +659,13 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
JFXOkayCancelDialog licenseOverviewDialog = new JFXOkayCancelDialog(licensesLblHeadingText,
|
JFXOkayCancelAlert licenseOverviewAlert = new JFXOkayCancelAlert(
|
||||||
licensesLblBodyText, dialogBtnStyle, 350, 275, okayAction, cancelAction, main.getPane(),
|
bundle.getString("licensesLblHeadingText"), bundle.getString("licensesLblBodyText"),
|
||||||
bundle);
|
dialogBtnStyle, primaryStage);
|
||||||
licenseOverviewDialog.setCancelText(showLicenses);
|
licenseOverviewAlert.setOkayAction(okayAction);
|
||||||
licenseOverviewDialog.show();
|
licenseOverviewAlert.setCancelAction(cancelAction);
|
||||||
|
licenseOverviewAlert.setCancelText(bundle.getString("showLicenses"));
|
||||||
|
licenseOverviewAlert.showAndWait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -734,26 +712,19 @@ public class MainWindowController {
|
||||||
@FXML
|
@FXML
|
||||||
private void aboutBtnAction() {
|
private void aboutBtnAction() {
|
||||||
String bodyText = "cemu_UI by @Seil0 \nVersion: " + version + " (" + buildNumber + ") \"" + versionName + "\" \n"
|
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();
|
infoAlert.showAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void settingsBtnAction() {
|
private void settingsBtnAction() {
|
||||||
if (smmdbTrue) {
|
if (smmdbAnchorPane.isVisible()) {
|
||||||
smmdbAnchorPane.setVisible(false);
|
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
|
@FXML
|
||||||
|
@ -764,19 +735,15 @@ public class MainWindowController {
|
||||||
@FXML
|
@FXML
|
||||||
private void smmdbBtnAction() {
|
private void smmdbBtnAction() {
|
||||||
// show smmdbAnchorPane
|
// show smmdbAnchorPane
|
||||||
if (smmdbTrue) {
|
smmdbAnchorPane.setVisible(!smmdbAnchorPane.isVisible());
|
||||||
smmdbAnchorPane.setVisible(false);
|
|
||||||
smmdbTrue = false;
|
|
||||||
} else {
|
|
||||||
smmdbAnchorPane.setVisible(true);
|
|
||||||
smmdbTrue = true;
|
|
||||||
|
|
||||||
|
if (smmdbAnchorPane.isVisible()) {
|
||||||
// start query in new thread
|
// start query in new thread
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
smmdbDownloadBtn.setText(smmdbDownloadBtnLoading);
|
smmdbDownloadBtn.setText(bundle.getString("smmdbDownloadBtnLoading"));
|
||||||
smmdbDownloadBtn.setDisable(true);
|
smmdbDownloadBtn.setDisable(true);
|
||||||
root.getChildren().remove(0,root.getChildren().size());
|
root.getChildren().remove(0,root.getChildren().size());
|
||||||
});
|
});
|
||||||
|
@ -790,7 +757,7 @@ public class MainWindowController {
|
||||||
|
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
root.getChildren().add(new TreeItem<CourseTableDataType>(helpCourse)); // add data to root-node
|
root.getChildren().add(new TreeItem<CourseTableDataType>(helpCourse)); // add data to root-node
|
||||||
smmdbDownloadBtn.setText(smmdbDownloadBtnDownload);
|
smmdbDownloadBtn.setText(bundle.getString("smmdbDownloadBtnDownload"));
|
||||||
smmdbDownloadBtn.setDisable(false);
|
smmdbDownloadBtn.setDisable(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -951,8 +918,9 @@ public class MainWindowController {
|
||||||
cloudSyncToggleBtn.setSelected(false);
|
cloudSyncToggleBtn.setSelected(false);
|
||||||
|
|
||||||
// cloud sync init error dialog
|
// cloud sync init error dialog
|
||||||
JFXInfoAlert cloudSyncErrorDialog = new JFXInfoAlert(cloudSyncErrorHeadingText,
|
JFXInfoAlert cloudSyncErrorDialog = new JFXInfoAlert(
|
||||||
cloudSyncErrorBodyText, dialogBtnStyle, primaryStage);
|
bundle.getString("cloudSyncErrorHeadingText"),
|
||||||
|
bundle.getString("cloudSyncErrorBodyText"), dialogBtnStyle, primaryStage);
|
||||||
cloudSyncErrorDialog.showAndWait();
|
cloudSyncErrorDialog.showAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -969,10 +937,12 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
JFXOkayCancelDialog cloudSyncWarningDialog = new JFXOkayCancelDialog(cloudSyncWaringHeadingText,
|
JFXOkayCancelAlert cloudSyncWarningAlert = new JFXOkayCancelAlert(
|
||||||
cloudSyncWaringBodyText, dialogBtnStyle, 419, 140, okayAction, cancelAction, main.getPane(),
|
bundle.getString("cloudSyncWaringHeadingText"), bundle.getString("cloudSyncWaringHeadingText"),
|
||||||
bundle);
|
dialogBtnStyle, primaryStage);
|
||||||
cloudSyncWarningDialog.show();
|
cloudSyncWarningAlert.setOkayAction(okayAction);
|
||||||
|
cloudSyncWarningAlert.setCancelAction(cancelAction);
|
||||||
|
cloudSyncWarningAlert.showAndWait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -984,10 +954,9 @@ public class MainWindowController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void addBtnAction() {
|
private void addBtnAction() {
|
||||||
String headingText = addGameBtnHeadingText;
|
JFXEditGameDialog addGameDialog = new JFXEditGameDialog(bundle.getString("addGameBtnHeadingText"),
|
||||||
String bodyText = addGameBtnBodyText;
|
bundle.getString("addGameBtnBodyText"), dialogBtnStyle, 450, 300, 0, this, primaryStage,
|
||||||
JFXEditGameDialog addGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 450, 300, 0,
|
main.getPane());
|
||||||
this, primaryStage, main.getPane());
|
|
||||||
addGameDialog.show();
|
addGameDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1005,8 +974,8 @@ public class MainWindowController {
|
||||||
LOGGER.info("No parameter set!");
|
LOGGER.info("No parameter set!");
|
||||||
|
|
||||||
//addGame error dialog
|
//addGame error dialog
|
||||||
JFXInfoAlert errorDialog = new JFXInfoAlert(addBtnReturnErrorHeadingText, addBtnReturnErrorBodyText,
|
JFXInfoAlert errorDialog = new JFXInfoAlert(bundle.getString("addBtnReturnErrorHeadingText"),
|
||||||
dialogBtnStyle, primaryStage);
|
bundle.getString("addBtnReturnErrorBodyText"), dialogBtnStyle, primaryStage);
|
||||||
errorDialog.showAndWait();
|
errorDialog.showAndWait();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1205,15 +1174,18 @@ public class MainWindowController {
|
||||||
void setUILanguage(){
|
void setUILanguage(){
|
||||||
switch(XMLController.getUsrLocal()){
|
switch(XMLController.getUsrLocal()){
|
||||||
case "en_US":
|
case "en_US":
|
||||||
bundle = ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.US); //us_English
|
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);
|
languageChoisBox.getSelectionModel().select(0);
|
||||||
break;
|
break;
|
||||||
case "de_DE":
|
case "de_DE":
|
||||||
bundle = ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.GERMAN); //German
|
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);
|
languageChoisBox.getSelectionModel().select(1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bundle = ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.US); //default local
|
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);
|
languageChoisBox.getSelectionModel().select(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1251,37 +1223,10 @@ public class MainWindowController {
|
||||||
timeColumn.setText(bundle.getString("timeColumn"));
|
timeColumn.setText(bundle.getString("timeColumn"));
|
||||||
|
|
||||||
// Strings
|
// 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");
|
lastPlayed = bundle.getString("lastPlayed");
|
||||||
today = bundle.getString("today");
|
today = bundle.getString("today");
|
||||||
yesterday = bundle.getString("yesterday");
|
yesterday = bundle.getString("yesterday");
|
||||||
never = bundle.getString("never");
|
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
|
// if AutoUpdate, then check for updates
|
||||||
|
|
|
@ -31,7 +31,7 @@ import com.cemu_UI.controller.XMLController;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
|
||||||
public class playGame extends Thread{
|
public class playGame extends Thread {
|
||||||
|
|
||||||
private MainWindowController mainWindowController;
|
private MainWindowController mainWindowController;
|
||||||
private DBController dbController;
|
private DBController dbController;
|
||||||
|
|
|
@ -39,6 +39,7 @@ import com.eclipsesource.json.Json;
|
||||||
import com.eclipsesource.json.JsonArray;
|
import com.eclipsesource.json.JsonArray;
|
||||||
import com.eclipsesource.json.JsonObject;
|
import com.eclipsesource.json.JsonObject;
|
||||||
import com.eclipsesource.json.JsonValue;
|
import com.eclipsesource.json.JsonValue;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
|
||||||
public class UpdateController implements Runnable {
|
public class UpdateController implements Runnable {
|
||||||
|
@ -70,7 +71,7 @@ public class UpdateController implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
LOGGER.info("beta:" + useBeta + "; checking for updates ...");
|
LOGGER.info("beta:" + useBeta + "; checking for updates ...");
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
mainWindowController.getUpdateBtn().setText(mainWindowController.getBundle().getString("updateBtnChecking"));
|
mainWindowController.getUpdateBtn().setText(XMLController.getLocalBundle().getString("updateBtnChecking"));
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -111,12 +112,12 @@ public class UpdateController implements Runnable {
|
||||||
*/
|
*/
|
||||||
if (buildNumber >= updateBuildNumber) {
|
if (buildNumber >= updateBuildNumber) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
mainWindowController.getUpdateBtn().setText(mainWindowController.getBundle().getString("updateBtnNoUpdateAvailable"));
|
mainWindowController.getUpdateBtn().setText(XMLController.getLocalBundle().getString("updateBtnNoUpdateAvailable"));
|
||||||
});
|
});
|
||||||
LOGGER.info("no update available");
|
LOGGER.info("no update available");
|
||||||
} else {
|
} else {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
mainWindowController.getUpdateBtn().setText(mainWindowController.getBundle().getString("updateBtnUpdateAvailable"));
|
mainWindowController.getUpdateBtn().setText(XMLController.getLocalBundle().getString("updateBtnUpdateAvailable"));
|
||||||
});
|
});
|
||||||
LOGGER.info("update available");
|
LOGGER.info("update available");
|
||||||
browserDownloadUrl = objectAsset.getString("browser_download_url", "");
|
browserDownloadUrl = objectAsset.getString("browser_download_url", "");
|
||||||
|
|
|
@ -26,7 +26,9 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
@ -57,6 +59,7 @@ public class XMLController {
|
||||||
private static boolean useBeta = false;
|
private static boolean useBeta = false;
|
||||||
private static boolean fullscreen = false;
|
private static boolean fullscreen = false;
|
||||||
private static boolean cloudSync = 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 cemuPath;
|
||||||
private static String romDirectoryPath;
|
private static String romDirectoryPath;
|
||||||
|
@ -345,6 +348,14 @@ public class XMLController {
|
||||||
XMLController.cloudSync = cloudSync;
|
XMLController.cloudSync = cloudSync;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ResourceBundle getLocalBundle() {
|
||||||
|
return localBundle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setLocalBundle(ResourceBundle localBundle) {
|
||||||
|
XMLController.localBundle = localBundle;
|
||||||
|
}
|
||||||
|
|
||||||
public static String getCemuPath() {
|
public static String getCemuPath() {
|
||||||
return cemuPath;
|
return cemuPath;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* cemu_UI
|
* cemu_UI
|
||||||
*
|
*
|
||||||
* Copyright 2017-2018 <@Seil0>
|
* Copyright 2017-2019 <@Seil0>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* 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,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
* MA 02110-1301, USA.
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.cemu_UI.uiElements;
|
package com.cemu_UI.uiElements;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import com.cemu_UI.application.MainWindowController;
|
import com.cemu_UI.application.MainWindowController;
|
||||||
|
import com.cemu_UI.controller.XMLController;
|
||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
import com.jfoenix.controls.JFXDialog;
|
import com.jfoenix.controls.JFXDialog;
|
||||||
import com.jfoenix.controls.JFXDialogLayout;
|
import com.jfoenix.controls.JFXDialogLayout;
|
||||||
|
@ -88,13 +90,13 @@ public class JFXEditGameDialog {
|
||||||
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
|
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
|
||||||
|
|
||||||
TextField gameTitleTF = new TextField();
|
TextField gameTitleTF = new TextField();
|
||||||
gameTitleTF.setPromptText(mwc.getBundle().getString("gameTitle"));
|
gameTitleTF.setPromptText(XMLController.getLocalBundle().getString("gameTitle"));
|
||||||
TextField gameTitleIDTF = new TextField();
|
TextField gameTitleIDTF = new TextField();
|
||||||
gameTitleIDTF.setPromptText(mwc.getBundle().getString("titleID"));
|
gameTitleIDTF.setPromptText(XMLController.getLocalBundle().getString("titleID"));
|
||||||
TextField romPathTF = new TextField();
|
TextField romPathTF = new TextField();
|
||||||
romPathTF.setPromptText(mwc.getBundle().getString("romPath"));
|
romPathTF.setPromptText(XMLController.getLocalBundle().getString("romPath"));
|
||||||
TextField gameCoverTF = new TextField();
|
TextField gameCoverTF = new TextField();
|
||||||
gameCoverTF.setPromptText(mwc.getBundle().getString("coverPath"));
|
gameCoverTF.setPromptText(XMLController.getLocalBundle().getString("coverPath"));
|
||||||
|
|
||||||
if (mode == 1) {
|
if (mode == 1) {
|
||||||
gameTitleTF.setText(title);
|
gameTitleTF.setText(title);
|
||||||
|
@ -105,7 +107,7 @@ public class JFXEditGameDialog {
|
||||||
gameTitleIDTF.setEditable(false);
|
gameTitleIDTF.setEditable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
JFXButton okayBtn = new JFXButton(mwc.getBundle().getString("okayBtnText"));
|
JFXButton okayBtn = new JFXButton(XMLController.getLocalBundle().getString("okayBtnText"));
|
||||||
okayBtn.setOnAction(new EventHandler<ActionEvent>() {
|
okayBtn.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
|
@ -115,9 +117,10 @@ public class JFXEditGameDialog {
|
||||||
// LOGGER.info("No parameter set!");
|
// LOGGER.info("No parameter set!");
|
||||||
|
|
||||||
// addGame error dialog
|
// addGame error dialog
|
||||||
String headingTextError = mwc.getBundle().getString("editGameDialogHeadingTextError");
|
JFXInfoAlert errorDialog = new JFXInfoAlert(
|
||||||
String bodyTextError = mwc.getBundle().getString("editGameDialogBodyTextError");
|
XMLController.getLocalBundle().getString("editGameDialogHeadingTextError"),
|
||||||
JFXInfoAlert errorDialog = new JFXInfoAlert(headingTextError, bodyTextError, dialogBtnStyle, stage);
|
XMLController.getLocalBundle().getString("editGameDialogBodyTextError"), dialogBtnStyle,
|
||||||
|
stage);
|
||||||
errorDialog.showAndWait();
|
errorDialog.showAndWait();
|
||||||
} else {
|
} else {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
@ -144,7 +147,7 @@ public class JFXEditGameDialog {
|
||||||
okayBtn.setPrefHeight(32);
|
okayBtn.setPrefHeight(32);
|
||||||
okayBtn.setStyle(dialogBtnStyle);
|
okayBtn.setStyle(dialogBtnStyle);
|
||||||
|
|
||||||
JFXButton cancelBtn = new JFXButton(mwc.getBundle().getString("cancelBtnText"));
|
JFXButton cancelBtn = new JFXButton(XMLController.getLocalBundle().getString("cancelBtnText"));
|
||||||
cancelBtn.setOnAction(new EventHandler<ActionEvent>() {
|
cancelBtn.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
|
@ -155,7 +158,7 @@ public class JFXEditGameDialog {
|
||||||
cancelBtn.setPrefHeight(32);
|
cancelBtn.setPrefHeight(32);
|
||||||
cancelBtn.setStyle(dialogBtnStyle);
|
cancelBtn.setStyle(dialogBtnStyle);
|
||||||
|
|
||||||
JFXButton selectPathBtn = new JFXButton(mwc.getBundle().getString("editGameDialogSelectPathBtn"));
|
JFXButton selectPathBtn = new JFXButton(XMLController.getLocalBundle().getString("editGameDialogSelectPathBtn"));
|
||||||
selectPathBtn.setPrefWidth(110);
|
selectPathBtn.setPrefWidth(110);
|
||||||
selectPathBtn.setStyle(dialogBtnStyle);
|
selectPathBtn.setStyle(dialogBtnStyle);
|
||||||
selectPathBtn.setOnAction(new EventHandler<ActionEvent>() {
|
selectPathBtn.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
|
@ -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.setPrefWidth(110);
|
||||||
selectCoverBtn.setStyle(dialogBtnStyle);
|
selectCoverBtn.setStyle(dialogBtnStyle);
|
||||||
selectCoverBtn.setOnAction(new EventHandler<ActionEvent>() {
|
selectCoverBtn.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
|
@ -183,14 +186,14 @@ public class JFXEditGameDialog {
|
||||||
grid.setHgap(10);
|
grid.setHgap(10);
|
||||||
grid.setVgap(10);
|
grid.setVgap(10);
|
||||||
grid.setPadding(new Insets(15, 10, 10, 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(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(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(romPathTF, 1, 2);
|
||||||
grid.add(selectPathBtn, 2, 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(gameCoverTF, 1, 3);
|
||||||
grid.add(selectCoverBtn, 2, 3);
|
grid.add(selectCoverBtn, 2, 3);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Kellerkinder Framework Alerts
|
* Kellerkinder Framework Alerts
|
||||||
*
|
*
|
||||||
* Copyright 2018 <@Seil0>
|
* Copyright 2017-2019 <@Seil0>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* 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,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
* MA 02110-1301, USA.
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.cemu_UI.uiElements;
|
package com.cemu_UI.uiElements;
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXAlert;
|
import com.jfoenix.controls.JFXAlert;
|
||||||
|
|
|
@ -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<ActionEvent> okayAction;
|
||||||
|
private EventHandler<ActionEvent> 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<Void> 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<ActionEvent> getOkayAction() {
|
||||||
|
return okayAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOkayAction(EventHandler<ActionEvent> okayAction) {
|
||||||
|
this.okayAction = okayAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EventHandler<ActionEvent> getCancelAction() {
|
||||||
|
return cancelAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelAction(EventHandler<ActionEvent> cancelAction) {
|
||||||
|
this.cancelAction = cancelAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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<ActionEvent> okayAction;
|
|
||||||
private EventHandler<ActionEvent> 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<ActionEvent> okayAction, EventHandler<ActionEvent> 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<ActionEvent> getOkayAction() {
|
|
||||||
return okayAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOkayAction(EventHandler<ActionEvent> okayAction) {
|
|
||||||
this.okayAction = okayAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EventHandler<ActionEvent> getCancelAction() {
|
|
||||||
return cancelAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCancelAction(EventHandler<ActionEvent> cancelAction) {
|
|
||||||
this.cancelAction = cancelAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* cemu_UI
|
* cemu_UI
|
||||||
*
|
*
|
||||||
* Copyright 2017-2018 <@Seil0>
|
* Copyright 2017-2019 <@Seil0>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* 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,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
* MA 02110-1301, USA.
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.cemu_UI.uiElements;
|
package com.cemu_UI.uiElements;
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
|
|
Loading…
Reference in New Issue