diff --git a/.travis.yml b/.travis.yml index 78fa8d1..2b01596 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ language: java jdk: - oraclejdk9 + - oraclejdk10 diff --git a/README.md b/README.md index 3c24aac..93082d9 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,17 @@ # cemu_UI ![Total Downloads](https://img.shields.io/github/downloads/Seil0/cemu_UI/total.svg?style=flat-square) -[![Build](https://img.shields.io/travis/Seil0/cemu_UI/master.svg?style=flat-square)](https://travis-ci.org/Seil0/cemu_UI) -[![Latest](https://img.shields.io/github/release/Seil0/cemu_UI/all.svg?style=flat-square)](https://github.com/Seil0/cemu_UI/releases) -[![HitCount](http://hits.dwyl.io/Seil0/cemu_UI.svg)](http://hits.dwyl.io/Seil0/cemu_UI) +[![Latest](https://img.shields.io/github/release/Seil0/cemu_UI/all.svg?style=flat-square)](https://git.mosad.xyz/Seil0/cemu_UI/releases) [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0) -cemu_UI is a simple, material design graphical frontend for [cemu](http://cemu.info/), a Wii U emulator. Downloads can be found [here](https://github.com/Seil0/cemu_UI/releases). +cemu_UI is a simple, material design graphical frontend for [cemu](http://cemu.info/), a Wii U emulator. Downloads can be found [here](https://git.mosad.xyz/Seil0/cemu_UI/releases). ## Installation -Simply download the cemu_UI.jar from [releases](https://github.com/Seil0/cemu_UI/releases), make sure you have the latest version of java 8 oracle jre/jdk installed and open the file. cemu_UI creats a new directory "C:\Users\USERNAME\Documents\cemu_UI", where the database, settings and covers are stored. **first start can take while!** +Simply download the cemu_UI.jar from [Releases](https://git.mosad.xyz/Seil0/cemu_UI/releases), make sure you have the latest version of java 8 oracle jre/jdk installed and open the file. cemu_UI creats a new directory "C:\Users\USERNAME\Documents\cemu_UI", where the database, settings and covers are stored. **first start can take while!** -If you want to use the cloud sync function read the [wiki](https://github.com/Seil0/cemu_UI/wiki#cloud-savegame-syncronisation) carefully! If you have problems using the cloud synchronisation please update to version [075](https://github.com/Seil0/cemu_UI/releases/tag/075). +If you want to use the cloud sync function read the [wiki](https://git.mosad.xyz/Seil0/cemu_UI/wiki#cloud-savegame-syncronisation) carefully! -### [FAQ](https://github.com/Seil0/cemu_UI/wiki#faq) +### [FAQ](https://git.mosad.xyz/Seil0/cemu_UI/wiki#faq) ## Features @@ -23,19 +21,17 @@ If you want to use the cloud sync function read the [wiki](https://github.com/Se * add updates and dlcs easier (only adding not downloading!) * automatic rom detection (only .rpx files with a app.xml) * customisable UI -* [sync savegames via google drive](https://github.com/Seil0/cemu_UI/wiki) +* [sync savegames via google drive](https://git.mosad.xyz/Seil0/cemu_UI/wiki) * [smmdb api](https://github.com/Tarnadas/smmdb) integration -## [planed Features](https://github.com/Seil0/cemu_UI/projects/1) (no ETA) +## [planed Features](https://git.mosad.xyz/Seil0/cemu_UI/milestones) * Controller support -### If you have another idea, make a "new issue" with the ![#f03c15](https://placehold.it/15/fbca04/000000?text=+)`idea` lable +### If you have another idea, make a new issue! -### [building from source](https://github.com/Seil0/cemu_UI/wiki/Documantation) +### [building from source](https://git.mosad.xyz/Seil0/cemu_UI/wiki/Documantation) ## Screenshots - -![Screenshot](/downloadContent/cemu_UI4.png) - - + +![Screenshot](https://git.mosad.xyz/Seil0/cemu_UI/raw/branch/master/downloadContent/cemu_UI4.png) diff --git a/pom.xml b/pom.xml index 95157e7..4f3d5c8 100644 --- a/pom.xml +++ b/pom.xml @@ -19,14 +19,14 @@ junit junit - 4.11 + 4.12 test com.jfoenix jfoenix - 9.0.3 + 9.0.4 @@ -38,7 +38,7 @@ org.xerial sqlite-jdbc - 3.21.0.1 + 3.23.1 @@ -107,7 +107,7 @@ com.google.apis google-api-services-drive - v3-rev99-1.23.0 + v3-rev120-1.23.0 @@ -150,7 +150,7 @@ com.fasterxml.jackson.core jackson-core - 2.9.4 + 2.9.5 @@ -195,7 +195,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.1.0 + 3.1.1 package diff --git a/src/main/java/com/cemu_UI/application/Main.java b/src/main/java/com/cemu_UI/application/Main.java index 6879180..d0f4830 100644 --- a/src/main/java/com/cemu_UI/application/Main.java +++ b/src/main/java/com/cemu_UI/application/Main.java @@ -47,7 +47,6 @@ import javafx.scene.control.ButtonType; import javafx.scene.control.Alert.AlertType; import javafx.scene.layout.AnchorPane; - public class Main extends Application { private Stage primaryStage; @@ -62,14 +61,13 @@ public class Main extends Application { private static String osVers = System.getProperty("os.version"); private static String javaVers = System.getProperty("java.version"); private static String javaVend= System.getProperty("java.vendor"); - private String gamesDBdownloadURL = "https://github.com/Seil0/cemu_UI/raw/master/downloadContent/games.db"; - public String dirWin = userHome + "/Documents/cemu_UI"; // Windows: C:/Users/"User"/Documents/cemu_UI - public String dirLinux = userHome + "/cemu_UI"; // Linux: /home/"User"/cemu_UI - private File directory; - private File configFile; - private File gamesDBFile; - private File reference_gamesFile; - private File pictureCache; + private String gamesDBdownloadURL = "https://git.mosad.xyz/Seil0/cemu_UI/raw/branch/master/downloadContent/games.db"; + private static String dirCemuUI; + private static File directory; + private static File configFile; + private static File gamesDBFile; + private static File reference_gamesFile; + private static File pictureCache; private static Logger LOGGER; @Override @@ -78,7 +76,10 @@ public class Main extends Application { LOGGER.info("OS: " + osName + " " + osVers + " " + osArch); LOGGER.info("Java: " + javaVend + " " + javaVers); LOGGER.info("User: " + userName + " " + userHome); + this.primaryStage = primaryStage; + mainWindowController = new MainWindowController(this); + mainWindow(); initActions(); } catch (Exception e) { @@ -91,28 +92,21 @@ public class Main extends Application { try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(ClassLoader.getSystemResource("fxml/MainWindow.fxml")); + loader.setController(mainWindowController); pane = (AnchorPane) loader.load(); + primaryStage.setMinWidth(265.00); + primaryStage.setMinHeight(425.00); primaryStage.setTitle("cemu_UI"); -// primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/resources/Homeflix_Icon_64x64.png"))); //adds application icon - - mainWindowController = loader.getController(); // Link of FXMLController and controller class - mainWindowController.setMain(this); // call setMain - cloudController = new CloudController(mainWindowController); // call cloudController constructor +// primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream(""))); //adds application icon + primaryStage.setOnCloseRequest(event -> System.exit(1)); - // get OS and the specific paths - if (osName.equals("Linux")) { - directory = new File(dirLinux); - configFile = new File(dirLinux + "/config.xml"); - gamesDBFile = new File(dirLinux + "/games.db"); - reference_gamesFile = new File(dirLinux + "/reference_games.db"); - pictureCache= new File(dirLinux+"/picture_cache"); - } else { - directory = new File(dirWin); - configFile = new File(dirWin + "/config.xml"); - gamesDBFile = new File(dirWin + "/games.db"); - reference_gamesFile = new File(dirWin + "/reference_games.db"); - pictureCache= new File(dirWin+"/picture_cache"); - } + // generate window + scene = new Scene(pane); // create new scene, append pane to scene + scene.getStylesheets().add(Main.class.getResource("/css/MainWindows.css").toExternalForm()); + primaryStage.setScene(scene); // append scene to stage + primaryStage.show(); // show stage + + cloudController = new CloudController(mainWindowController); // call cloudController constructor // startup checks // check if client_secret.json is present @@ -122,7 +116,7 @@ public class Main extends Application { 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://github.com/Seil0/cemu_UI/wiki/Documantation"); + 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(); } @@ -165,14 +159,6 @@ public class Main extends Application { } } - // generate window - scene = new Scene(pane); // create new scene, append pane to scene - scene.getStylesheets().add(Main.class.getResource("/css/MainWindows.css").toExternalForm()); - primaryStage.setMinWidth(265.00); - primaryStage.setMinHeight(425.00); - primaryStage.setScene(scene); // append scene to stage - primaryStage.show(); // show stage - // init here as it loads the games to the mwc and the gui, therefore the window must exist mainWindowController.init(); mainWindowController.getDbController().init(); @@ -183,9 +169,31 @@ public class Main extends Application { cloudController.sync(mainWindowController.getCloudService(), mainWindowController.getCemuPath(), directory.getPath()); } - } catch (IOException e) { - e.printStackTrace(); - } + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + + if (osName.contains("Windows")) { + dirCemuUI = userHome + "/Documents/cemu_UI"; + } else { + dirCemuUI = userHome + "/cemu_UI"; + } + + directory = new File(dirCemuUI); + configFile = new File(dirCemuUI + "/config.xml"); + gamesDBFile = new File(dirCemuUI + "/games.db"); + reference_gamesFile = new File(dirCemuUI + "/reference_games.db"); + pictureCache= new File(dirCemuUI+"/picture_cache"); + + // delete old log file and create new + System.setProperty("logFilename", dirCemuUI + "/app.log"); + File logFile = new File(dirCemuUI + "/app.log"); + logFile.delete(); + LOGGER = LogManager.getLogger(Main.class.getName()); + launch(args); } private void firstStart() { @@ -291,26 +299,6 @@ public class Main extends Application { primaryStage.heightProperty().addListener(heightListener); primaryStage.maximizedProperty().addListener(maximizeListener); } - - public static void main(String[] args) { - // delete old log file and create new - if (osName.equals("Linux")) { - System.setProperty("logFilename", userHome + "/cemu_UI/app.log"); - File logFile = new File(userHome + "/cemu_UI/app.log"); - logFile.delete(); - } else { - System.setProperty("logFilename", userHome + "/Documents/cemu_UI/app.log"); - File logFile = new File(userHome + "/Documents/cemu_UI/app.log"); - logFile.delete(); - } - LOGGER = LogManager.getLogger(Main.class.getName()); - launch(args); - } - - @Override - public void stop() { - System.exit(0); - } public Stage getPrimaryStage() { return primaryStage; diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index 3a90c41..99e6640 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -60,7 +60,7 @@ import com.cemu_UI.datatypes.CourseTableDataType; 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.JFXInfoAlert; import com.cemu_UI.uiElements.JFXOkayCancelDialog; import com.cemu_UI.uiElements.JFXTextAreaInfoDialog; import com.jfoenix.controls.JFXButton; @@ -111,37 +111,26 @@ public class MainWindowController { @FXML private JFXButton aboutBtn; - @FXML private JFXButton settingsBtn; - @FXML private JFXButton addBtn; - @FXML private JFXButton reloadRomsBtn; - @FXML private JFXButton smmdbBtn; - @FXML private JFXButton cemuTFBtn; - @FXML private JFXButton romTFBtn; - @FXML private JFXButton updateBtn; - @FXML private JFXButton smmdbDownloadBtn; - @FXML private JFXButton playBtn; - @FXML private JFXButton lastTimePlayedBtn; - @FXML JFXButton totalPlaytimeBtn; @@ -150,58 +139,46 @@ public class MainWindowController { @FXML private JFXTextField cemuTextField; - @FXML private JFXTextField romTextField; - @FXML private JFXTextField courseSearchTextFiled; - @FXML private JFXTextField executeCommandTextFiled; - + @FXML private TextFlow smmdbTextFlow; - + @FXML private JFXColorPicker colorPicker; - + @FXML private JFXToggleButton cloudSyncToggleBtn; - @FXML private JFXToggleButton autoUpdateToggleBtn; - @FXML private JFXToggleButton fullscreenToggleBtn; @FXML private ChoiceBox languageChoisBox; - @FXML private ChoiceBox branchChoisBox; @FXML private AnchorPane mainAnchorPane; - @FXML private AnchorPane gamesAnchorPane; - @FXML private AnchorPane settingsAnchorPane; - @FXML private AnchorPane smmdbAnchorPane; @FXML private ScrollPane mainScrollPane; - @FXML private ScrollPane settingsScrollPane; - @FXML private ScrollPane smmdbScrollPane; - @FXML private ScrollPane smmdbImageViewScrollPane; @@ -210,7 +187,6 @@ public class MainWindowController { @FXML private HBox topHBox; - @FXML private HBox bottomHBox; @@ -219,31 +195,22 @@ public class MainWindowController { @FXML private Label helpLbl; - @FXML private Label cemu_UISettingsLbl; - @FXML private Label cemuDirectoryLbl; - @FXML private Label romDirectoryLbl; - @FXML private Label mainColorLbl; - @FXML private Label languageLbl; - @FXML private Label updateLbl; - @FXML private Label branchLbl; - @FXML private Label cemuSettingsLbl; - @FXML private Label licensesLbl; @@ -251,17 +218,14 @@ public class MainWindowController { private JFXTreeTableView courseTreeTable = new JFXTreeTableView(); @FXML - TreeItem root = new TreeItem<>(new CourseTableDataType("", "", 0, 0)); + private TreeItem root = new TreeItem<>(new CourseTableDataType("", "", 0, 0)); @FXML private JFXTreeTableColumn titleColumn = new JFXTreeTableColumn<>("title"); - @FXML private JFXTreeTableColumn idColumn = new JFXTreeTableColumn<>("id"); - @FXML private JFXTreeTableColumn starsColumn = new JFXTreeTableColumn<>("stars"); - @FXML private JFXTreeTableColumn timeColumn = new JFXTreeTableColumn<>("time"); @@ -293,8 +257,8 @@ public class MainWindowController { private String selectedGameTitleID; private String selectedGameTitle; private String id; - private String version = "0.3.0"; - private String buildNumber = "077"; + private String version = "0.3.1"; + private String buildNumber = "081"; private String versionName = "Purple Comet"; private int xPos = -200; private int yPos = 17; @@ -372,8 +336,8 @@ public class MainWindowController { private String smmdbDownloadBtnLoading; private String smmdbDownloadBtnDownload; - public void setMain(Main m) { - this.main = m; + public MainWindowController(Main main) { + this.main = main; dbController = new DBController(main, this); smmdbAPIController = new SmmdbAPIController(); } @@ -382,7 +346,7 @@ public class MainWindowController { * initialize the MainWindowController * loadSettings, checkAutoUpdate, initUI and initActions */ - void init() { + public void init() { loadSettings(); checkAutoUpdate(); initUI(); @@ -721,7 +685,7 @@ public class MainWindowController { @Override public void run() { try { - Desktop.getDesktop().browse(new URI("https://github.com/Seil0/cemu_UI/issues/3")); + Desktop.getDesktop().browse(new URI("https://git.mosad.xyz/Seil0/cemu_UI/issues/3")); } catch (IOException | URISyntaxException e) { LOGGER.error("An error ocoured while trying to open a Website.", e); } @@ -810,8 +774,8 @@ public class MainWindowController { saveSettings(); } else { String bodyText = newValue + ": No such file or directory"; - JFXInfoDialog fileErrorDialog = new JFXInfoDialog("Waring!", bodyText, dialogBtnStyle, 190, 150, main.getPane()); - fileErrorDialog.show(); + JFXInfoAlert fileErrorDialog = new JFXInfoAlert("Waring!", bodyText, dialogBtnStyle, main.getPrimaryStage()); + fileErrorDialog.showAndWait(); LOGGER.warn(newValue + ": No such file or directory"); } } @@ -826,8 +790,8 @@ public class MainWindowController { reloadRoms(); } else { String bodyText = newValue + ": No such file or directory"; - JFXInfoDialog fileErrorDialog = new JFXInfoDialog("Waring!", bodyText, dialogBtnStyle, 190, 150, main.getPane()); - fileErrorDialog.show(); + JFXInfoAlert fileErrorDialog = new JFXInfoAlert("Waring!", bodyText, dialogBtnStyle, main.getPrimaryStage()); + fileErrorDialog.showAndWait(); LOGGER.warn(newValue + ": No such file or directory"); } } @@ -837,20 +801,21 @@ public class MainWindowController { } @FXML - void detailsSlideoutBtnAction() { + private void detailsSlideoutBtnAction() { playBtnSlideOut(); } @FXML - void aboutBtnAction() { + private void aboutBtnAction() { String bodyText = "cemu_UI by @Seil0 \nVersion: " + version + " (" + buildNumber + ") \"" + versionName + "\" \n" + aboutBtnBodyText; - JFXInfoDialog aboutDialog = new JFXInfoDialog(aboutBtnHeadingText, bodyText, dialogBtnStyle, 350, 200, main.getPane()); - aboutDialog.show(); + + JFXInfoAlert infoAlert = new JFXInfoAlert(aboutBtnHeadingText, bodyText, dialogBtnStyle, main.getPrimaryStage()); + infoAlert.showAndWait(); } @FXML - void settingsBtnAction() { + private void settingsBtnAction() { if (smmdbTrue) { smmdbAnchorPane.setVisible(false); smmdbTrue = false; @@ -866,12 +831,12 @@ public class MainWindowController { } @FXML - void reloadRomsBtnAction() throws IOException { + private void reloadRomsBtnAction() throws IOException { reloadRoms(); } @FXML - void smmdbBtnAction() { + private void smmdbBtnAction() { // show smmdbAnchorPane if (smmdbTrue) { smmdbAnchorPane.setVisible(false); @@ -910,7 +875,7 @@ public class MainWindowController { } @FXML - void playBtnAction() throws InterruptedException, IOException { + private void playBtnAction() throws InterruptedException, IOException { dbController.setLastPlayed(selectedGameTitleID); playGame = new playGame(this, dbController); @@ -918,17 +883,17 @@ public class MainWindowController { } @FXML - void totalPlaytimeBtnAction() { + private void totalPlaytimeBtnAction() { } @FXML - void lastTimePlayedBtnAction() { + private void lastTimePlayedBtnAction() { } @FXML - void cemuTFBtnAction() { + private void cemuTFBtnAction() { File cemuDirectory = directoryChooser.showDialog(main.getPrimaryStage()); if (cemuDirectory != null) { cemuTextField.setText(cemuDirectory.getAbsolutePath()); @@ -936,7 +901,7 @@ public class MainWindowController { } @FXML - void romTFBtnAction() { + private void romTFBtnAction() { File romDirectory = directoryChooser.showDialog(main.getPrimaryStage()); if (romDirectory != null) { romTextField.setText(romDirectory.getAbsolutePath()); @@ -944,7 +909,7 @@ public class MainWindowController { } @FXML - void updateBtnAction() { + private void updateBtnAction() { updateController = new UpdateController(this, buildNumber, useBeta); Thread updateThread = new Thread(updateController); updateThread.setName("Updater"); @@ -952,7 +917,7 @@ public class MainWindowController { } @FXML - void autoUpdateToggleBtnAction() { + private void autoUpdateToggleBtnAction() { if (isAutoUpdate()) { setAutoUpdate(false); } else { @@ -962,12 +927,12 @@ public class MainWindowController { } @FXML - void courseSearchTextFiledAction() { + private void courseSearchTextFiledAction() { // not in use } @FXML - void smmdbDownloadBtnAction() { + private void smmdbDownloadBtnAction() { String downloadUrl = "http://smmdb.ddns.net/api/downloadcourse?id=" + id + "&type=zip"; String downloadFileURL = getCemuPath() + "/" + id + ".zip"; // getCemuPath() + "/" + smmID + "/" + id + ".rar" String outputFile = getCemuPath() + "/"; @@ -1035,7 +1000,7 @@ public class MainWindowController { } @FXML - void fullscreenToggleBtnAction() { + private void fullscreenToggleBtnAction() { if (fullscreen) { fullscreen = false; } else { @@ -1045,7 +1010,7 @@ public class MainWindowController { } @FXML - void cloudSyncToggleBtnAction() { + private void cloudSyncToggleBtnAction() { if(cloudSync) { cloudSync = false; } else { @@ -1069,9 +1034,9 @@ public class MainWindowController { cloudSyncToggleBtn.setSelected(false); // cloud sync init error dialog - JFXInfoDialog cloudSyncErrorDialog = new JFXInfoDialog(cloudSyncErrorHeadingText, - cloudSyncErrorBodyText, dialogBtnStyle, 450, 170, main.getPane()); - cloudSyncErrorDialog.show(); + JFXInfoAlert cloudSyncErrorDialog = new JFXInfoAlert(cloudSyncErrorHeadingText, + cloudSyncErrorBodyText, dialogBtnStyle, main.getPrimaryStage()); + cloudSyncErrorDialog.showAndWait(); } } @@ -1095,13 +1060,13 @@ public class MainWindowController { } @FXML - void colorPickerAction() { + private void colorPickerAction() { editColor(colorPicker.getValue().toString()); applyColor(); } @FXML - void addBtnAction() { + private void addBtnAction() { String headingText = addGameBtnHeadingText; String bodyText = addGameBtnBodyText; JFXEditGameDialog addGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 450, 300, 0, @@ -1123,9 +1088,9 @@ public class MainWindowController { LOGGER.info("No parameter set!"); //addGame error dialog - JFXInfoDialog errorDialog = new JFXInfoDialog(addBtnReturnErrorHeadingText, addBtnReturnErrorBodyText, - dialogBtnStyle, 350, 170, main.getPane()); - errorDialog.show(); + JFXInfoAlert errorDialog = new JFXInfoAlert(addBtnReturnErrorHeadingText, addBtnReturnErrorBodyText, + dialogBtnStyle, main.getPrimaryStage()); + errorDialog.showAndWait(); } else { File pictureCache = main.getPictureCache(); @@ -1590,7 +1555,8 @@ public class MainWindowController { addBtn.setGraphic(add_circle_white); reloadRomsBtn.setGraphic(cached_white); smmdbBtn.setGraphic(smmdb_white); - + + menuHam.getStyleClass().clear(); menuHam.getStyleClass().add("jfx-hamburgerW"); } else { dialogBtnStyle = btnStyleBlack; @@ -1612,7 +1578,8 @@ public class MainWindowController { addBtn.setGraphic(add_circle_black); reloadRomsBtn.setGraphic(cached_black); smmdbBtn.setGraphic(smmdb_black); - + + menuHam.getStyleClass().clear(); menuHam.getStyleClass().add("jfx-hamburgerB"); } diff --git a/src/main/java/com/cemu_UI/controller/UpdateController.java b/src/main/java/com/cemu_UI/controller/UpdateController.java index d214505..03aed13 100644 --- a/src/main/java/com/cemu_UI/controller/UpdateController.java +++ b/src/main/java/com/cemu_UI/controller/UpdateController.java @@ -147,7 +147,7 @@ public class UpdateController implements Runnable { FileUtils.copyInputStreamToFile(pmis, new File("cemu_UI_update.jar")); // download update org.apache.commons.io.FileUtils.copyFile(new File("cemu_UI_update.jar"), new File("cemu_UI.jar")); org.apache.commons.io.FileUtils.deleteQuietly(new File("cemu_UI_update.jar")); // delete update - Runtime.getRuntime().exec("java -jar cemu_UI.jar"); // start again TODO consider ProcessBuilder to execute + new ProcessBuilder("java", "-jar", "cemu_UI.jar").start(); // start the new application System.exit(0); // finishes itself } catch (IOException e) { Platform.runLater(() -> { diff --git a/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java b/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java index 0487b14..78ba990 100644 --- a/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java +++ b/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java @@ -117,8 +117,8 @@ public class JFXEditGameDialog { // addGame error dialog String headingTextError = mwc.getBundle().getString("editGameDialogHeadingTextError"); String bodyTextError = mwc.getBundle().getString("editGameDialogBodyTextError"); - JFXInfoDialog errorDialog = new JFXInfoDialog(headingTextError, bodyTextError, dialogBtnStyle, 350,170, pane); - errorDialog.show(); + JFXInfoAlert errorDialog = new JFXInfoAlert(headingTextError, bodyTextError, dialogBtnStyle, stage); + errorDialog.showAndWait(); } else { switch (mode) { case 0: diff --git a/src/main/java/com/cemu_UI/uiElements/JFXInfoDialog.java b/src/main/java/com/cemu_UI/uiElements/JFXInfoAlert.java similarity index 51% rename from src/main/java/com/cemu_UI/uiElements/JFXInfoDialog.java rename to src/main/java/com/cemu_UI/uiElements/JFXInfoAlert.java index ee2513a..04399aa 100644 --- a/src/main/java/com/cemu_UI/uiElements/JFXInfoDialog.java +++ b/src/main/java/com/cemu_UI/uiElements/JFXInfoAlert.java @@ -1,7 +1,7 @@ /** - * cemu_UI + * Kellerkinder Framework Alerts * - * Copyright 2017-2018 <@Seil0> + * Copyright 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 @@ -20,66 +20,92 @@ */ package com.cemu_UI.uiElements; +import com.jfoenix.controls.JFXAlert; 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; +import javafx.stage.Stage; -public class JFXInfoDialog { - +public class JFXInfoAlert { + private String headingText; private String bodyText; - private String dialogBtnStyle; - private int dialogWidth; - private int dialogHeight; - private Pane pane; + private String btnStyle; + private Stage stage; /** - * Creates a new JFoenix Dialog to show some information - * @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 pane pane to which the dialog belongs + * Creates a new JFoenix Alert to show some information + * @param headerText Heading text of the alert + * @param bodyText Content text of the alert + * @param btnStyle Style of the okay button + * @param stage stage to which the dialog belongs */ - public JFXInfoDialog(String headingText, String bodyText, String dialogBtnStyle, int dialogWidth, int dialogHeight, Pane pane) { - this.headingText = headingText; - this.bodyText = bodyText; - this.dialogBtnStyle = dialogBtnStyle; - this.dialogWidth = dialogWidth; - this.dialogHeight = dialogHeight; - this.pane = pane; + public JFXInfoAlert(String headingText, String bodyText, String btnStyle, Stage stage) { + setHeadingText(headingText); + setBodyText(bodyText); + setBtnStyle(btnStyle); + setStage(stage); } - - public void show() { - JFXDialogLayout content = new JFXDialogLayout(); - content.setHeading(new Text(headingText)); - content.setBody(new Text(bodyText)); - content.setPrefSize(dialogWidth, dialogHeight); - StackPane stackPane = new StackPane(); - stackPane.autosize(); - JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true); + + public JFXInfoAlert() { + // Auto-generated constructor stub + } + + public void showAndWait( ) { + JFXAlert alert = new JFXAlert<>(stage); + JFXButton button = new JFXButton("Okay"); button.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { - dialog.close(); + alert.close(); } }); button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED); button.setPrefHeight(32); - button.setStyle(dialogBtnStyle); + button.setStyle(btnStyle); + + JFXDialogLayout content = new JFXDialogLayout(); content.setActions(button); - pane.getChildren().add(stackPane); - AnchorPane.setTopAnchor(stackPane, (pane.getHeight() - content.getPrefHeight()) / 2); - AnchorPane.setLeftAnchor(stackPane, (pane.getWidth() - content.getPrefWidth()) / 2); - dialog.show(); + 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 Stage getStage() { + return stage; + } + + public void setStage(Stage stage) { + this.stage = stage; + } + +} \ No newline at end of file diff --git a/src/main/resources/fxml/MainWindow.fxml b/src/main/resources/fxml/MainWindow.fxml index c9dde2c..d7ed28e 100644 --- a/src/main/resources/fxml/MainWindow.fxml +++ b/src/main/resources/fxml/MainWindow.fxml @@ -18,7 +18,7 @@ - + diff --git a/src/main/resources/locals/cemu_UI-Local_de_DE.properties b/src/main/resources/locals/cemu_UI-Local_de_DE.properties index 598d579..4c89c89 100644 --- a/src/main/resources/locals/cemu_UI-Local_de_DE.properties +++ b/src/main/resources/locals/cemu_UI-Local_de_DE.properties @@ -1,4 +1,4 @@ -#HomeFlix-Local_de_DE.properties geramn Local +#HomeFlix-Local_de_DE.properties DE-Deutsch Local # Buttons aboutBtn = \u00dcber @@ -46,7 +46,7 @@ licensesLblBodyText = cemu_UI ist lizensiert unter der GNU GPL 3.\n\nJFoenix, Ap showLicenses = Lizenzen \u00f6ffnen aboutBtnHeadingText = cemu_UI -aboutBtnBodyText = Diese Programm wurde mit freier Software erstellt\nund ist lizensiert unter der GNU GPL 3.\n\nwww.kellerkinder.xyz +aboutBtnBodyText = Diese Programm wurde mit freier Software erstellt\nund ist lizensiert unter der GNU GPL 3.\n\nwww.mosad.xyz cloudSyncWaringHeadingText = Spielst\u00e4nde über die Cloud syncronisieren (beta) cloudSyncWaringBodyText = WARNING this is a completly WIP cloud save integration,\nit's NOT recomended to use this!!\n\nUse it on your own risk and backup everthing before! diff --git a/src/main/resources/locals/cemu_UI-Local_en_US.properties b/src/main/resources/locals/cemu_UI-Local_en_US.properties index 043d926..4a335a1 100644 --- a/src/main/resources/locals/cemu_UI-Local_en_US.properties +++ b/src/main/resources/locals/cemu_UI-Local_en_US.properties @@ -46,7 +46,7 @@ licensesLblBodyText = cemu_UI is licensed under the terms of GNU GPL 3.\n\nJFoen showLicenses = show licenses aboutBtnHeadingText = cemu_UI -aboutBtnBodyText = This Application is made with free Software\nand licensed under the terms of GNU GPL 3.\n\nwww.kellerkinder.xyz +aboutBtnBodyText = This Application is made with free Software\nand licensed under the terms of GNU GPL 3.\n\nwww.mosad.xyz cloudSyncWaringHeadingText = activate cloud savegame sync (beta) cloudSyncWaringBodyText = WARNING this is a completely WIP cloud save integration,\nit's NOT recommended to use this!!\n\nUse it on your own risk and backup everything before!