diff --git a/pom.xml b/pom.xml index da27628..bc4c5e4 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ com.jfoenix jfoenix - 1.9.0 + 1.9.1 @@ -46,13 +46,13 @@ org.apache.logging.log4j log4j-api - 2.9.0 + 2.9.1 org.apache.logging.log4j log4j-core - 2.9.0 + 2.9.1 @@ -180,27 +180,65 @@ - - - - org.apache.maven.plugins - maven-shade-plugin - - - - shade - + + + + + + + org.apache.maven.plugins + maven-shade-plugin + + + + shade + + + true + + + com.cemu_UI.application.Main + + + + + + diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index 185debc..d43a81c 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -55,8 +55,10 @@ import com.cemu_UI.controller.SmmdbAPIController; import com.cemu_UI.controller.UpdateController; import com.cemu_UI.controller.dbController; import com.cemu_UI.datatypes.CourseTableDataType; +import com.cemu_UI.datatypes.EditDataType; import com.cemu_UI.datatypes.SmmdbApiDataType; import com.cemu_UI.datatypes.UIROMDataType; +import com.cemu_UI.uiElements.JFXEditGameDialog; import com.cemu_UI.uiElements.JFXInfoDialog; import com.cemu_UI.uiElements.JFXOkayCancelDialog; import com.jfoenix.controls.JFXButton; @@ -73,6 +75,7 @@ import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition; import javafx.animation.FadeTransition; import javafx.animation.ParallelTransition; import javafx.animation.TranslateTransition; +import javafx.application.Platform; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; @@ -416,12 +419,18 @@ public class MainWindowController { LOGGER.info("edit "+selectedGameTitleID); if(selectedGameTitleID == null){ LOGGER.warn("trying to edit null! null is not valid!"); - Alert alert = new Alert(AlertType.WARNING); - alert.setTitle("edit"); - alert.setHeaderText("cemu_UI"); - alert.setContentText("please select a game, \""+selectedGameTitleID+"\" is not a valid type"); - alert.initOwner(main.primaryStage); - alert.showAndWait(); + + String headingText = "edit game"; + String bodyText = "please select a game, \""+selectedGameTitleID+"\" is not a valid type!"; + JFXInfoDialog aboutDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 350, 170, main.pane); + aboutDialog.show(); + +// Alert alert = new Alert(AlertType.WARNING); +// alert.setTitle("edit"); +// alert.setHeaderText("cemu_UI"); +// alert.setContentText("please select a game, \""+selectedGameTitleID+"\" is not a valid type"); +// alert.initOwner(main.primaryStage); +// alert.showAndWait(); }else{ String[] gameInfo = dbController.getGameInfo(selectedGameTitleID); @@ -515,13 +524,19 @@ public class MainWindowController { LOGGER.info("remove "+selectedGameTitleID); if(selectedGameTitleID == null){ LOGGER.warn("trying to remove null! null is not valid!"); - Alert alert = new Alert(AlertType.WARNING); - alert.setTitle("remove"); - alert.setHeaderText("cemu_UI"); - alert.setContentText("please select a game, \""+selectedGameTitleID+"\" is not a valid type"); + + String headingText = "remove game"; + String bodyText = "please select a game, \""+selectedGameTitleID+"\" is not a valid type!"; + JFXInfoDialog aboutDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 350, 170, main.pane); + aboutDialog.show(); + +// Alert alert = new Alert(AlertType.WARNING); +// alert.setTitle("remove"); +// alert.setHeaderText("cemu_UI"); +// alert.setContentText("please select a game, \""+selectedGameTitleID+"\" is not a valid type"); +// alert.initOwner(main.primaryStage); +// alert.showAndWait(); - alert.initOwner(main.primaryStage); - alert.showAndWait(); } else{ Alert alert = new Alert(AlertType.CONFIRMATION); @@ -555,12 +570,19 @@ public class MainWindowController { LOGGER.info("update: "+selectedGameTitleID); if(selectedGameTitleID == null){ LOGGER.warn("trying to update null! null is not valid!"); - Alert alert = new Alert(AlertType.WARNING); - alert.setTitle("edit"); - alert.setHeaderText("cemu_UI"); - alert.setContentText("please select a game, \""+selectedGameTitleID+"\" is not a valid type"); - alert.initOwner(main.primaryStage); - alert.showAndWait(); + + String headingText = "update game"; + String bodyText = "please select a game, \""+selectedGameTitleID+"\" is not a valid type!"; + JFXInfoDialog aboutDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 350, 170, main.pane); + aboutDialog.show(); + +// Alert alert = new Alert(AlertType.WARNING); +// alert.setTitle("edit"); +// alert.setHeaderText("cemu_UI"); +// alert.setContentText("please select a game, \""+selectedGameTitleID+"\" is not a valid type"); +// alert.initOwner(main.primaryStage); +// alert.showAndWait(); + }else{ Alert updateAlert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser updateAlert.setTitle("cemu_UI"); @@ -612,12 +634,19 @@ public class MainWindowController { LOGGER.info("add DLC: "+selectedGameTitleID); if(selectedGameTitleID == null){ LOGGER.warn("trying to add a dlc to null! null is not valid!"); - Alert alert = new Alert(AlertType.WARNING); - alert.setTitle("add DLC"); - alert.setHeaderText("cemu_UI"); - alert.setContentText("please select a game, \""+selectedGameTitleID+"\" is not a valid type"); - alert.initOwner(main.primaryStage); - alert.showAndWait(); + + String headingText = "add DLC"; + String bodyText = "please select a game, \""+selectedGameTitleID+"\" is not a valid type!"; + JFXInfoDialog aboutDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 350, 170, main.pane); + aboutDialog.show(); + +// Alert alert = new Alert(AlertType.WARNING); +// alert.setTitle("add DLC"); +// alert.setHeaderText("cemu_UI"); +// alert.setContentText("please select a game, \""+selectedGameTitleID+"\" is not a valid type"); +// alert.initOwner(main.primaryStage); +// alert.showAndWait(); + }else{ Alert updateAlert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser updateAlert.setTitle("cemu_UI"); @@ -690,7 +719,7 @@ public class MainWindowController { for (int i = 0; i < courses.size(); i++) { if (courses.get(i).getId() == id) { try { - URL url = new URL("http://smmdb.ddns.net/courseimg/" + id + "_full.jpg?v=3"); + URL url = new URL("https://smmdb.ddns.net/courseimg/" + id + "_full?v=1"); Image image = new Image(url.toURI().toString()); smmdbImageView.setImage(image); } catch (MalformedURLException | URISyntaxException e) { @@ -967,6 +996,7 @@ public class MainWindowController { cloudSync = true; //TODO rework for other cloud services cloudService = "GoogleDrive"; + if (main.cloudController.initializeConnection(getCloudService(), getCemuPath())) { main.cloudController.sync(getCloudService(), getCemuPath()); saveSettings(); @@ -1005,85 +1035,145 @@ public class MainWindowController { @FXML void addBtnAction(ActionEvent event){ - String romPath = null; - String coverPath = null; - String coverName = null; - String title = null; - String titleID = null; +// String romPath = ""; +// String coverPath = ""; +// String coverName = ""; +// String title = ""; +// String titleID = ""; +// File pictureCache; + + //TESTING AREA + + String headingText = "activate cloud savegame sync (beta)"; + String bodyText = "You just activate the cloud savegame sync function of cemu_UI, " + + "\nwhich is currently in beta. Are you sure you want to do this?"; + JFXEditGameDialog addGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 350, 300, + this, main.primaryStage, main.pane); + addGameDialog.show(); + +// //new Dialog +// Dialog dialog = new Dialog<>(); +// dialog.setTitle("add a new game"); +// dialog.setHeaderText("add a new game manually to cemu UI"); +// +// // Set the button types. +// ButtonType okayBtn = new ButtonType("Okay", ButtonData.OK_DONE); +// dialog.getDialogPane().getButtonTypes().addAll(okayBtn, ButtonType.CANCEL); +// +// // Create gameTitle, titleID, gamePath and gameCover TextFields and Labels and two Btn for filechooser +// GridPane grid = new GridPane(); +// grid.setHgap(10); +// grid.setVgap(10); +// grid.setPadding(new Insets(20, 150, 10, 10)); +// +// TextField gameTitleTF = new TextField(); +// gameTitleTF.setPromptText("game tile"); +// TextField titleIDTF = new TextField(); +// titleIDTF.setPromptText("title ID"); +// TextField romPathTF = new TextField(); +// romPathTF.setPromptText("ROM path"); +// TextField gameCoverTF = new TextField(); +// gameCoverTF.setPromptText("cover path"); +// +// Button selectPathBtn = new Button("select .rpx file"); +// Button selectCoverBtn = new Button("select cover file"); +// +// selectPathBtn.setPrefWidth(110); +// selectCoverBtn.setPrefWidth(110); +// +// selectPathBtn.setOnAction(new EventHandler() { +// @Override +// public void handle(ActionEvent event) { +// FileChooser romDirectoryChooser = new FileChooser(); +// File romDirectory = romDirectoryChooser.showOpenDialog(main.primaryStage); +// romPathTF.setText(romDirectory.getAbsolutePath()); +// } +// }); +// +// selectCoverBtn.setOnAction(new EventHandler() { +// @Override +// public void handle(ActionEvent event) { +// FileChooser coverDirectoryChooser = new FileChooser(); +// File coverDirectory = coverDirectoryChooser.showOpenDialog(main.primaryStage); +// gameCoverTF.setText(coverDirectory.getAbsolutePath()); +// } +// }); +// +// grid.add(new Label("game title:"), 0, 0); +// grid.add(gameTitleTF, 1, 0); +// grid.add(new Label("title id:"), 0, 1); +// grid.add(titleIDTF, 1, 1); +// grid.add(new Label("ROM path:"), 0, 2); +// grid.add(romPathTF, 1, 2); +// grid.add(selectPathBtn, 2, 2); +// grid.add(new Label("cover path:"), 0, 3); +// grid.add(gameCoverTF, 1, 3); +// grid.add(selectCoverBtn, 2, 3); +// +// dialog.getDialogPane().setContent(grid); +// +// Optional result2 = dialog.showAndWait(); +// if (result2.isPresent()){ +// romPath = romPathTF.getText(); +// coverPath = gameCoverTF.getText(); +// title = gameTitleTF.getText(); +// titleID = titleIDTF.getText(); +// +// LOGGER.info("New game data \"" + title + "\", title-ID: " + titleID + "(not a bug!)"); +// } +// +// /** +// * if one parameter dosen't contain any value do not add the game +// * else convert the cover to .png add copy it into the picture cache, +// * then add the rom to the local_roms database +// */ +// System.out.println(romPath.length()); +// if (romPath.length() == 0 || coverPath.length() == 0 || title.length() == 0 || titleID.length() == 0) { +// LOGGER.info("No parameter set!"); +// +// //addGame error dialog +// String headingTextError = "Error while adding a new Game!"; +// String bodyTextError = "There was some truble adding your game." +// + "\nOne of the needed values was empty, please try again to add your game."; +// JFXInfoDialog errorDialog = new JFXInfoDialog(headingTextError, bodyTextError, dialogBtnStyle, 350, 170, main.pane); +// errorDialog.show(); +// +// } else { +// coverName = new File(coverPath).getName(); +// try { +// if (System.getProperty("os.name").equals("Linux")) { +// pictureCache = getPictureCacheLinux(); +// } else { +// pictureCache = getPictureCacheWin(); +// } +// +// BufferedImage originalImage = ImageIO.read(new File(coverPath)); //load cover +// int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : originalImage.getType(); +// BufferedImage resizeImagePNG = resizeImage(originalImage, type, 400, 600); +// ImageIO.write(resizeImagePNG, "png", new File(pictureCache+"\\"+coverName)); //save image to pictureCache +// coverPath = pictureCache+"\\"+coverName; +// } catch (IOException e) { +// LOGGER.error("Ops something went wrong! Error while resizing cover.", e); +// } +// +// try { +// dbController.addRom(title, coverPath, romPath, titleID, "", "", "", "0"); +// dbController.loadSingleRom(titleID); +// refreshUIData(); +// } catch (SQLException e) { +// LOGGER.error("Oops, something went wrong! Error while adding a game.", e); +// } +// } + } + + public void addBtnReturn(EditDataType gameData) { + String romPath = gameData.getRomPath(); + String coverPath = gameData.getCoverPath(); + String title = gameData.getTitle(); + String titleID = gameData.getTitleID(); File pictureCache; - //new Dialog - Dialog dialog = new Dialog<>(); - dialog.setTitle("add a new game"); - dialog.setHeaderText("add a new game manually to cemu UI"); - - // Set the button types. - ButtonType okayBtn = new ButtonType("Okay", ButtonData.OK_DONE); - dialog.getDialogPane().getButtonTypes().addAll(okayBtn, ButtonType.CANCEL); - - // Create gameTitle, titleID, gamePath and gameCover TextFields and Labels and two Btn for filechooser - GridPane grid = new GridPane(); - grid.setHgap(10); - grid.setVgap(10); - grid.setPadding(new Insets(20, 150, 10, 10)); - - TextField gameTitleTF = new TextField(); - gameTitleTF.setPromptText("game tile"); - TextField titleIDTF = new TextField(); - titleIDTF.setPromptText("title ID"); - TextField romPathTF = new TextField(); - romPathTF.setPromptText("ROM path"); - TextField gameCoverTF = new TextField(); - gameCoverTF.setPromptText("cover path"); - - Button selectPathBtn = new Button("select .rpx file"); - Button selectCoverBtn = new Button("select cover file"); - - selectPathBtn.setPrefWidth(110); - selectCoverBtn.setPrefWidth(110); - - selectPathBtn.setOnAction(new EventHandler() { - @Override - public void handle(ActionEvent event) { - FileChooser romDirectoryChooser = new FileChooser(); - File romDirectory = romDirectoryChooser.showOpenDialog(main.primaryStage); - romPathTF.setText(romDirectory.getAbsolutePath()); - } - }); - - selectCoverBtn.setOnAction(new EventHandler() { - @Override - public void handle(ActionEvent event) { - FileChooser coverDirectoryChooser = new FileChooser(); - File coverDirectory = coverDirectoryChooser.showOpenDialog(main.primaryStage); - gameCoverTF.setText(coverDirectory.getAbsolutePath()); - } - }); - - grid.add(new Label("game title:"), 0, 0); - grid.add(gameTitleTF, 1, 0); - grid.add(new Label("title id:"), 0, 1); - grid.add(titleIDTF, 1, 1); - grid.add(new Label("ROM path:"), 0, 2); - grid.add(romPathTF, 1, 2); - grid.add(selectPathBtn, 2, 2); - grid.add(new Label("cover path:"), 0, 3); - grid.add(gameCoverTF, 1, 3); - grid.add(selectCoverBtn, 2, 3); - - dialog.getDialogPane().setContent(grid); - - Optional result2 = dialog.showAndWait(); - if (result2.isPresent()){ - romPath = romPathTF.getText(); - coverPath = gameCoverTF.getText(); - title = gameTitleTF.getText(); - titleID = titleIDTF.getText(); - - LOGGER.info("New game data \"" + title + "\", title-ID: " + titleID + "(not a bug!)"); - } - - /** + /** * if one parameter dosen't contain any value do not add the game * else convert the cover to .png add copy it into the picture cache, * then add the rom to the local_roms database @@ -1093,32 +1183,14 @@ public class MainWindowController { LOGGER.info("No parameter set!"); //addGame error dialog - JFXDialogLayout content= new JFXDialogLayout(); - content.setHeading(new Text("Error while adding a new Game!")); - content.setBody(new Text("There was some truble adding your game." - + "\nOne of the needed values was empty, please try again to add your game.")); - content.setPrefSize(450, 170); - StackPane stackPane = new StackPane(); - stackPane.autosize(); - JFXDialog errorDialog =new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true); - JFXButton button=new JFXButton("Okay"); - button.setOnAction(new EventHandler(){ - @Override - public void handle(ActionEvent event){ - errorDialog.close(); - } - }); - button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED); - button.setPrefHeight(32); - button.setStyle(dialogBtnStyle); - content.setActions(button); - main.pane.getChildren().add(stackPane); - AnchorPane.setTopAnchor(stackPane, (main.pane.getHeight()-content.getPrefHeight())/2); - AnchorPane.setLeftAnchor(stackPane, (main.pane.getWidth()-content.getPrefWidth())/2); + String headingTextError = "Error while adding a new Game!"; + String bodyTextError = "There was some truble adding your game." + + "\nOne of the needed values was empty, please try again to add your game."; + JFXInfoDialog errorDialog = new JFXInfoDialog(headingTextError, bodyTextError, dialogBtnStyle, 350, 170, main.pane); errorDialog.show(); - + } else { - coverName = new File(coverPath).getName(); + String coverName = new File(coverPath).getName(); try { if (System.getProperty("os.name").equals("Linux")) { pictureCache = getPictureCacheLinux(); @@ -1144,7 +1216,7 @@ public class MainWindowController { } } } - + /** * add game to games (ArrayList) and initialize all needed actions (start, time stamps, titleID) * @param title : game title diff --git a/src/main/java/com/cemu_UI/datatypes/EditDataType.java b/src/main/java/com/cemu_UI/datatypes/EditDataType.java new file mode 100644 index 0000000..b90bccb --- /dev/null +++ b/src/main/java/com/cemu_UI/datatypes/EditDataType.java @@ -0,0 +1,73 @@ +/** + * cemu_UI + * + * Copyright 2017 <@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.datatypes; + +public class EditDataType { + + private String romPath; + private String coverPath; + private String title; + private String titleID; + + /** + * Data type used for the add/edit game dialog + */ + public EditDataType(String romPath, String coverPath, String title, String titleID) { + this.romPath = romPath; + this.coverPath = coverPath; + this.title = title; + this.titleID = titleID; + } + + public String getRomPath() { + return romPath; + } + + public void setRomPath(String romPath) { + this.romPath = romPath; + } + + public String getCoverPath() { + return coverPath; + } + + public void setCoverPath(String coverPath) { + this.coverPath = coverPath; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getTitleID() { + return titleID; + } + + public void setTitleID(String titleID) { + this.titleID = titleID; + } + +} diff --git a/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java b/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java new file mode 100644 index 0000000..973dcb3 --- /dev/null +++ b/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java @@ -0,0 +1,200 @@ +/** + * cemu_UI + * + * Copyright 2017 <@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.io.File; + +import com.cemu_UI.application.MainWindowController; +import com.cemu_UI.datatypes.EditDataType; +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.geometry.Insets; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.layout.AnchorPane; +import javafx.scene.layout.GridPane; +import javafx.scene.layout.Pane; +import javafx.scene.layout.StackPane; +import javafx.scene.layout.VBox; +import javafx.scene.text.Text; +import javafx.stage.FileChooser; +import javafx.stage.Stage; + +public class JFXEditGameDialog { + + private String headingText; + private String bodyText; + private String dialogBtnStyle; + private int dialogWidth; + private int dialogHeight; + private EditDataType gameData; + private Stage stage; + private Pane pane; + private MainWindowController mwc; + + /** + * 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 stage the primary stage + * @param pane pane to which the dialog belongs + */ + public JFXEditGameDialog(String headingText, String bodyText, String dialogBtnStyle, int dialogWidth, + int dialogHeight, MainWindowController mwc, Stage stage, Pane pane) { + this.headingText = headingText; + this.bodyText = bodyText; + this.dialogBtnStyle = dialogBtnStyle; + this.dialogWidth = dialogWidth; + this.dialogHeight = dialogHeight; + this.mwc = mwc; + this.stage = stage; + this.pane = pane; + } + + public void show() { + JFXDialogLayout content = new JFXDialogLayout(); + StackPane stackPane = new StackPane(); + stackPane.autosize(); + JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true); + + Label placeholder = new Label(); + placeholder.setPrefSize(15, 10); + + TextField gameTitleTF = new TextField(); + gameTitleTF.setPromptText("game tile"); + TextField gameTitleIDTF = new TextField(); + gameTitleIDTF.setPromptText("title ID"); + TextField romPathTF = new TextField(); + romPathTF.setPromptText("ROM path"); + TextField gameCoverTF = new TextField(); + gameCoverTF.setPromptText("cover path"); + + JFXButton okayBtn = new JFXButton("Okay"); + okayBtn.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent event) { + System.out.println(romPathTF.getText()); + System.out.println(gameCoverTF.getText()); + System.out.println(gameTitleTF.getText()); + System.out.println(gameTitleIDTF.getText()); + if (romPathTF.getText().toString().length() == 0 || gameCoverTF.getText().toString().length() == 0 || + gameTitleTF.getText().toString().length() == 0 || gameTitleIDTF.getText().toString().length() == 0) { + +// LOGGER.info("No parameter set!"); + + //addGame error dialog + String headingTextError = "Error while adding a new Game!"; + String bodyTextError = "There was some truble adding your game." + + "\nOne of the needed values was empty, please try again to add your game."; + JFXInfoDialog errorDialog = new JFXInfoDialog(headingTextError, bodyTextError, dialogBtnStyle, 350, 170, pane); + errorDialog.show(); + } else { + gameData.setRomPath(romPathTF.getText().toString()); + gameData.setCoverPath(gameCoverTF.getText().toString()); + gameData.setTitle(gameTitleTF.getText().toString()); + gameData.setTitleID(gameTitleIDTF.getText().toString()); + mwc.addBtnReturn(gameData); + dialog.close(); + } + } + }); + okayBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED); + okayBtn.setPrefHeight(32); + okayBtn.setStyle(dialogBtnStyle); + + JFXButton cancelBtn = new JFXButton("Cancel"); + cancelBtn.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent event) { + dialog.close(); + } + }); + cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED); + cancelBtn.setPrefHeight(32); + cancelBtn.setStyle(dialogBtnStyle); + + JFXButton selectPathBtn = new JFXButton("select .rpx file"); + selectPathBtn.setPrefWidth(110); + selectPathBtn.setStyle(dialogBtnStyle); + selectPathBtn.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent event) { + FileChooser romDirectoryChooser = new FileChooser(); + File romDirectory = romDirectoryChooser.showOpenDialog(stage); + romPathTF.setText(romDirectory.getAbsolutePath()); + } + }); + + JFXButton selectCoverBtn = new JFXButton("select cover file"); + selectCoverBtn.setPrefWidth(110); + selectCoverBtn.setStyle(dialogBtnStyle); + selectCoverBtn.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent event) { + FileChooser coverDirectoryChooser = new FileChooser(); + File coverDirectory = coverDirectoryChooser.showOpenDialog(stage); + gameCoverTF.setText(coverDirectory.getAbsolutePath()); + } + }); + + GridPane grid = new GridPane(); + grid.setHgap(10); + grid.setVgap(10); + grid.setPadding(new Insets(15, 10, 10, 10)); + grid.add(new Label("game title:"), 0, 0); + grid.add(gameTitleTF, 1, 0); + grid.add(new Label("title id:"), 0, 1); + grid.add(gameTitleIDTF, 1, 1); + grid.add(new Label("ROM path:"), 0, 2); + grid.add(romPathTF, 1, 2); + grid.add(selectPathBtn, 2, 2); + grid.add(new Label("cover path:"), 0, 3); + grid.add(gameCoverTF, 1, 3); + grid.add(selectCoverBtn, 2, 3); + + Text bdyText = new Text(bodyText); + + VBox vbox = new VBox(); + vbox.getChildren().addAll(bdyText, grid); + + content.setHeading(new Text(headingText)); + content.setBody(vbox); + content.setActions(cancelBtn, placeholder, 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 EditDataType getGameData() { + return gameData; + } +} diff --git a/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelDialog.java b/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelDialog.java index 6c39c24..2a5298b 100644 --- a/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelDialog.java +++ b/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelDialog.java @@ -69,7 +69,7 @@ public class JFXOkayCancelDialog { } public void show() { - JFXDialogLayout content= new JFXDialogLayout(); + JFXDialogLayout content = new JFXDialogLayout(); content.setHeading(new Text(headingText)); content.setBody(new Text(bodyText)); StackPane stackPane = new StackPane(); diff --git a/src/main/resources/libraries/log4j-api-2.8.2.jar b/src/main/resources/libraries/log4j-api-2.8.2.jar deleted file mode 100644 index 9694c29..0000000 Binary files a/src/main/resources/libraries/log4j-api-2.8.2.jar and /dev/null differ diff --git a/src/main/resources/libraries/log4j-api-2.9.1.jar b/src/main/resources/libraries/log4j-api-2.9.1.jar new file mode 100644 index 0000000..b1d1b76 Binary files /dev/null and b/src/main/resources/libraries/log4j-api-2.9.1.jar differ diff --git a/src/main/resources/libraries/log4j-core-2.8.2.jar b/src/main/resources/libraries/log4j-core-2.8.2.jar deleted file mode 100644 index eb658af..0000000 Binary files a/src/main/resources/libraries/log4j-core-2.8.2.jar and /dev/null differ diff --git a/src/main/resources/libraries/log4j-core-2.9.1.jar b/src/main/resources/libraries/log4j-core-2.9.1.jar new file mode 100644 index 0000000..88cfaed Binary files /dev/null and b/src/main/resources/libraries/log4j-core-2.9.1.jar differ