From 46455e9e9d44f3b5185b53731eeadb6365ffe956 Mon Sep 17 00:00:00 2001 From: Jannik Date: Fri, 12 Jan 2018 23:52:44 +0100 Subject: [PATCH 01/22] Java 9, updated a few libs * cemu_UI targets now Java 9 * jfoenix 1.11.1 -> 9.0.1 * minimal-json 0.9.4 -> 0.9.5 * log4j 2.9.1 -> 2.10.0 * commons-io 2.5 -> 2.6 * jackson-core 2.9.2 -> 2.9.3 * javax.servlet-api 4.0.0-b01 -> 4.0.0 --- pom.xml | 51 ++++++++++--------- .../application/MainWindowController.java | 4 +- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index c52bdad..b1a0d37 100644 --- a/pom.xml +++ b/pom.xml @@ -4,16 +4,16 @@ com cemu_UI - 0.2.3-SNAPSHOT + 0.3.0-SNAPSHOT jar - cemu_UI + cemu_UI is a simple, material design graphical frontend for cemu, a Wii U emulator http://www.kellerkinder.xyz UTF-8 - 1.8 - 1.8 + 1.9 + 1.9 @@ -21,20 +21,20 @@ junit junit - 3.8.1 + 4.11 test com.jfoenix jfoenix - 1.11.1 + 9.0.1 com.eclipsesource.minimal-json minimal-json - 0.9.4 + 0.9.5 @@ -43,22 +43,22 @@ 3.21.0.1 - - org.apache.logging.log4j - log4j-api - 2.9.1 - - - - org.apache.logging.log4j - log4j-core - 2.9.1 - + + org.apache.logging.log4j + log4j-api + 2.10.0 + + + + org.apache.logging.log4j + log4j-core + 2.10.0 + commons-io commons-io - 2.5 + 2.6 @@ -152,14 +152,14 @@ com.fasterxml.jackson.core jackson-core - 2.9.2 + 2.9.3 javax.servlet javax.servlet-api - 4.0.0-b01 + 4.0.0 provided @@ -194,11 +194,12 @@ shade + cemu_UI true - - com.cemu_UI.application.Main - + + com.cemu_UI.application.Main + @@ -207,5 +208,5 @@ - + diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index 55fb730..6c44ab8 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -286,8 +286,8 @@ public class MainWindowController { private String selectedGameTitleID; private String selectedGameTitle; private String id; - private String version = "0.2.3"; - private String buildNumber = "071"; + private String version = "0.3.0"; + private String buildNumber = "073"; private String versionName = "Puzzle Plank Galaxy"; private int xPos = -200; private int yPos = 17; From 52c2912ba26b7afb2077c89fbfeba5a1b116a6e0 Mon Sep 17 00:00:00 2001 From: Jannik Date: Sat, 13 Jan 2018 00:09:13 +0100 Subject: [PATCH 02/22] maven compile plugin 3.7.0 --- pom.xml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index b1a0d37..3c77efd 100644 --- a/pom.xml +++ b/pom.xml @@ -12,8 +12,6 @@ UTF-8 - 1.9 - 1.9 @@ -182,11 +180,22 @@ - - - org.apache.maven.plugins - maven-shade-plugin - 3.1.0 + + org.apache.maven.plugins + maven-compiler-plugin + 3.7.0 + + 9 + 9 + true + true + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.1.0 package From fe4fcb45d702aab8187267a8bdc4769c17d4fb6f Mon Sep 17 00:00:00 2001 From: Jannik Date: Sat, 13 Jan 2018 00:13:34 +0100 Subject: [PATCH 03/22] travis fix, first try --- .travis.yml | 4 +++- pom.xml | 22 ++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3e193cc..78fa8d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1 +1,3 @@ -language: java +language: java +jdk: + - oraclejdk9 diff --git a/pom.xml b/pom.xml index 3c77efd..82f3c3e 100644 --- a/pom.xml +++ b/pom.xml @@ -178,18 +178,17 @@ - - - org.apache.maven.plugins - maven-compiler-plugin - 3.7.0 - - 9 - 9 - true - true - + + org.apache.maven.plugins + maven-compiler-plugin + 3.7.0 + + 9 + 9 + true + true + @@ -214,7 +213,6 @@ - From a9f675ee5efe4260d2f91a134d4821f819183612 Mon Sep 17 00:00:00 2001 From: Jannik Date: Sat, 13 Jan 2018 23:35:33 +0100 Subject: [PATCH 04/22] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 868853b..105d90e 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,6 @@ If you want to use the cloud sync function read the [wiki](https://github.com/Se ## [planed Features](https://github.com/Seil0/cemu_UI/projects/1) (no ETA) * Controller support -* more UI improvements -* support more rom file formats in automatic detection ### If you have another idea, make a "new issue" with the ![#f03c15](https://placehold.it/15/fbca04/000000?text=+)`idea` lable From f331fb57a4e8712947118002fbdf41d827ad3477 Mon Sep 17 00:00:00 2001 From: Jannik Date: Fri, 19 Jan 2018 01:14:01 +0100 Subject: [PATCH 05/22] added ability to edit launch command, WIP WARNING THIS IS NOT TESTED --- .classpath | 2 +- .settings/org.eclipse.jdt.core.prefs | 6 +- .../java/com/cemu_UI/application/Main.java | 8 +- .../application/MainWindowController.java | 83 ++++++++++++++----- .../com/cemu_UI/application/playGame.java | 29 ++++--- .../com/cemu_UI/controller/DBController.java | 2 +- src/main/resources/fxml/MainWindow.fxml | 19 +++-- 7 files changed, 99 insertions(+), 50 deletions(-) diff --git a/.classpath b/.classpath index 9454e24..e911fdf 100644 --- a/.classpath +++ b/.classpath @@ -18,7 +18,7 @@ - + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 13b3428..6f1d295 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,13 +1,13 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=9 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=9 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.source=9 diff --git a/src/main/java/com/cemu_UI/application/Main.java b/src/main/java/com/cemu_UI/application/Main.java index 652b049..c27dff4 100644 --- a/src/main/java/com/cemu_UI/application/Main.java +++ b/src/main/java/com/cemu_UI/application/Main.java @@ -141,6 +141,7 @@ public class Main extends Application { mainWindowController.setLanguage("en_US"); mainWindowController.setLastLocalSync(0); mainWindowController.setxPosHelper(0); + mainWindowController.setExecuteCommand(mainWindowController.getCemuPath() + "/Cemu.exe -g "); mainWindowController.saveSettings(); Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs) System.exit(0); //finishes itself @@ -212,11 +213,10 @@ public class Main extends Application { Optional result2 = alert2.showAndWait(); if (result2.get() == ButtonType.OK) { DirectoryChooser directoryChooser = new DirectoryChooser(); - File selectedDirectory = directoryChooser.showDialog(primaryStage); - mainWindowController.setRomPath(selectedDirectory.getAbsolutePath()); - + File selectedDirectory = directoryChooser.showDialog(primaryStage); + mainWindowController.setRomDirectoryPath(selectedDirectory.getAbsolutePath()); } else { - mainWindowController.setRomPath(null); + mainWindowController.setRomDirectoryPath(null); } } diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index 6c44ab8..150a2d0 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -157,6 +157,9 @@ public class MainWindowController { @FXML private JFXTextField courseSearchTextFiled; + + @FXML + private JFXTextField executeCommandTextFiled; @FXML private TextFlow smmdbTextFlow; @@ -279,8 +282,9 @@ public class MainWindowController { private boolean cloudSync; private String cloudService = ""; // set cloud provider (at the moment only GoogleDrive, Dropbox is planed) private String cemuPath; - private String romPath; + private String romDirectoryPath; private String gameExecutePath; + private String executeCommand; private String color; private String dialogBtnStyle; private String selectedGameTitleID; @@ -399,7 +403,8 @@ public class MainWindowController { } cemuTextField.setText(cemuPath); - romTextField.setText(romPath); + romTextField.setText(romDirectoryPath); + executeCommandTextFiled.setText(getExecuteCommand()); colorPicker.setValue(Color.valueOf(getColor())); fullscreenToggleBtn.setSelected(isFullscreen()); cloudSyncToggleBtn.setSelected(isCloudSync()); @@ -800,6 +805,30 @@ public class MainWindowController { } } }); + + cemuTextField.textProperty().addListener(new ChangeListener() { + @Override + public void changed(ObservableValue observable, String oldValue, String newValue) { + setCemuPath(cemuTextField.getText()); + saveSettings(); + } + }); + + romTextField.textProperty().addListener(new ChangeListener() { + @Override + public void changed(ObservableValue observable, String oldValue, String newValue) { + setRomDirectoryPath(romTextField.getText()); + saveSettings(); + } + }); + + executeCommandTextFiled.textProperty().addListener(new ChangeListener() { + @Override + public void changed(ObservableValue observable, String oldValue, String newValue) { + setExecuteCommand(executeCommandTextFiled.getText()); + saveSettings(); + } + }); LOGGER.info("initializing Actions done!"); } @@ -846,7 +875,7 @@ public class MainWindowController { Thread thread = new Thread(new Runnable() { @Override public void run() { - dbController.loadRomDirectory(getRomPath()); // reload the rom directory + dbController.loadRomDirectory(getRomDirectoryPath()); // reload the rom directory Platform.runLater(() -> { refreshUIData(); // refresh the list of games displayed on screen @@ -938,7 +967,7 @@ public class MainWindowController { if (romDirectory == null) { LOGGER.info("No Directory selected"); } else { - setRomPath(romDirectory.getAbsolutePath()); + setRomDirectoryPath(romDirectory.getAbsolutePath()); saveSettings(); cemuTextField.setText(getCemuPath()); try { @@ -1041,24 +1070,16 @@ public class MainWindowController { } } - @FXML - void cemuTextFieldAction(ActionEvent event) { - setCemuPath(cemuTextField.getText()); - saveSettings(); - } - - @FXML - void romTextFieldAction(ActionEvent event) { - setRomPath(romTextField.getText()); - saveSettings(); - } - @FXML void fullscreenToggleBtnAction(ActionEvent event) { if (fullscreen) { fullscreen = false; + setExecuteCommand(getExecuteCommand().replace("-f -g", "-g")); + executeCommandTextFiled.setText(getExecuteCommand()); } else { fullscreen = true; + setExecuteCommand(getExecuteCommand().replace("-g", "-f -g")); + executeCommandTextFiled.setText(getExecuteCommand()); } saveSettings(); } @@ -1638,7 +1659,8 @@ public class MainWindowController { OutputStream outputStream; //new output-stream try { props.setProperty("cemuPath", getCemuPath()); - props.setProperty("romPath", getRomPath()); + props.setProperty("romPath", getRomDirectoryPath()); + props.setProperty("executeCommand", getExecuteCommand()); props.setProperty("color", getColor()); props.setProperty("language", getLanguage()); props.setProperty("fullscreen", String.valueOf(isFullscreen())); @@ -1690,10 +1712,17 @@ public class MainWindowController { } try { - setRomPath(props.getProperty("romPath")); + setRomDirectoryPath(props.getProperty("romPath")); } catch (Exception e) { LOGGER.error("could not load romPath", e); - setRomPath(""); + setRomDirectoryPath(""); + } + + if (props.getProperty("executeCommand") == null) { + LOGGER.error("could not load executeCommand, setting default instead!"); + setExecuteCommand(getCemuPath() + "\\Cemu.exe -g "); + } else { + setExecuteCommand(props.getProperty("executeCommand")); } try { @@ -1862,14 +1891,22 @@ public class MainWindowController { this.cemuPath = cemuPath; } - public String getRomPath() { - return romPath; + public String getRomDirectoryPath() { + return romDirectoryPath; } - public void setRomPath(String romPath) { - this.romPath = romPath; + public void setRomDirectoryPath(String romDirectoryPath) { + this.romDirectoryPath = romDirectoryPath; } + public String getExecuteCommand() { + return executeCommand; + } + + public void setExecuteCommand(String executeCommand) { + this.executeCommand = executeCommand; + } + public String getColor() { return color; } diff --git a/src/main/java/com/cemu_UI/application/playGame.java b/src/main/java/com/cemu_UI/application/playGame.java index b6afd6b..751c896 100644 --- a/src/main/java/com/cemu_UI/application/playGame.java +++ b/src/main/java/com/cemu_UI/application/playGame.java @@ -57,19 +57,22 @@ public class playGame extends Thread{ }); startTime = System.currentTimeMillis(); try{ - if(mainWindowController.isFullscreen()){ - if(System.getProperty("os.name").equals("Linux")){ - executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\""; - } else { - executeComand = mainWindowController.getCemuPath()+"\\Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\""; - } - }else{ - if(System.getProperty("os.name").equals("Linux")){ - executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -g \""+mainWindowController.getGameExecutePath()+"\""; - } else { - executeComand = mainWindowController.getCemuPath()+"\\Cemu.exe -g \""+mainWindowController.getGameExecutePath()+"\""; - } - } + executeComand = mainWindowController.getExecuteCommand() + " \"" + mainWindowController.getGameExecutePath() + "\""; + +// if(mainWindowController.isFullscreen()){ +// if(System.getProperty("os.name").equals("Linux")){ +// executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\""; +// } else { +// executeComand = mainWindowController.getCemuPath()+"\\Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\""; +// } +// }else{ +// if(System.getProperty("os.name").equals("Linux")){ +// executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -g \""+mainWindowController.getGameExecutePath()+"\""; +// } else { +// executeComand = mainWindowController.getCemuPath() + "\\Cemu.exe -g " + "\"" + mainWindowController.getGameExecutePath() + "\""; +// } +// } + LOGGER.info(executeComand); p = Runtime.getRuntime().exec(executeComand); diff --git a/src/main/java/com/cemu_UI/controller/DBController.java b/src/main/java/com/cemu_UI/controller/DBController.java index 394b7ca..52e9c9e 100644 --- a/src/main/java/com/cemu_UI/controller/DBController.java +++ b/src/main/java/com/cemu_UI/controller/DBController.java @@ -149,7 +149,7 @@ public class DBController { LOGGER.error("error while loading ROMs from ROM database, local_roms table", e); } if (entries.size() == 0) { - loadRomDirectory(mainWindowController.getRomPath()); + loadRomDirectory(mainWindowController.getRomDirectoryPath()); } } diff --git a/src/main/resources/fxml/MainWindow.fxml b/src/main/resources/fxml/MainWindow.fxml index d67e830..b0c0bdb 100644 --- a/src/main/resources/fxml/MainWindow.fxml +++ b/src/main/resources/fxml/MainWindow.fxml @@ -18,7 +18,7 @@ - + @@ -91,12 +91,12 @@ - + - + From 84b5eaedcd4e6a70ced17e2487d714eddde7e203 Mon Sep 17 00:00:00 2001 From: Jannik Date: Wed, 31 Jan 2018 17:01:47 +0100 Subject: [PATCH 06/22] reworked startup process * cemu is showing a loading screen while loading the roms * jackson core 2.9.3 -> 2.9.4 --- pom.xml | 4 +- .../java/com/cemu_UI/application/Main.java | 3 +- .../application/MainWindowController.java | 50 +++++++++++-------- .../com/cemu_UI/controller/DBController.java | 22 ++++---- 4 files changed, 46 insertions(+), 33 deletions(-) diff --git a/pom.xml b/pom.xml index 82f3c3e..ef8430d 100644 --- a/pom.xml +++ b/pom.xml @@ -107,7 +107,7 @@ com.google.apis google-api-services-drive - v3-rev87-1.23.0 + v3-rev99-1.23.0 @@ -150,7 +150,7 @@ com.fasterxml.jackson.core jackson-core - 2.9.3 + 2.9.4 diff --git a/src/main/java/com/cemu_UI/application/Main.java b/src/main/java/com/cemu_UI/application/Main.java index c27dff4..dcbb68d 100644 --- a/src/main/java/com/cemu_UI/application/Main.java +++ b/src/main/java/com/cemu_UI/application/Main.java @@ -177,8 +177,7 @@ public class Main extends Application { if(mainWindowController.isCloudSync()) { cloudController.initializeConnection(mainWindowController.getCloudService(), mainWindowController.getCemuPath()); cloudController.sync(mainWindowController.getCloudService(), mainWindowController.getCemuPath(), directory.getPath()); - } - mainWindowController.addUIData(); + } scene = new Scene(pane); // create new scene, append pane to scene scene.getStylesheets().add(Main.class.getResource("/css/MainWindows.css").toExternalForm()); diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index 150a2d0..3a594cf 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -864,26 +864,7 @@ public class MainWindowController { @FXML void reloadRomsBtnAction() throws IOException { - - JFXSpinner spinner = new JFXSpinner(); - spinner.setPrefSize(30, 30); - spinner.setStyle(" -fx-background-color: #f4f4f4;"); - main.getPane().getChildren().add(spinner); - AnchorPane.setTopAnchor(spinner, (main.getPane().getHeight()-spinner.getPrefHeight())/2); - AnchorPane.setLeftAnchor(spinner, (main.getPane().getWidth()-spinner.getPrefWidth())/2); - - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - dbController.loadRomDirectory(getRomDirectoryPath()); // reload the rom directory - - Platform.runLater(() -> { - refreshUIData(); // refresh the list of games displayed on screen - main.getPane().getChildren().remove(spinner); - }); - } - }); - thread.start(); + reloadRoms(); } @FXML @@ -1314,6 +1295,35 @@ public class MainWindowController { games.add(uiROMElement); } + public void reloadRoms() { + JFXSpinner spinner = new JFXSpinner(); + spinner.setPrefSize(30, 30); + spinner.setStyle(" -fx-background-color: #f4f4f4;"); + AnchorPane.setTopAnchor(spinner, (main.getPane().getPrefHeight()-spinner.getPrefHeight())/2); + AnchorPane.setLeftAnchor(spinner, (main.getPane().getPrefWidth()-spinner.getPrefWidth())/2); + + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + Platform.runLater(() -> { + //remove all games form gamesAnchorPane + gamesAnchorPane.getChildren().removeAll(gamesAnchorPane.getChildren()); + main.getPane().getChildren().add(spinner); // add spinner to pane + }); + + dbController.loadRomDirectory(getRomDirectoryPath()); // reload the ROM directory + games.removeAll(games); // remove all games from the mwc game list + dbController.loadAllGames(); // load all games from the database to the mwc + + Platform.runLater(() -> { + refreshUIData(); // refresh the list of games displayed on screen + main.getPane().getChildren().remove(spinner); + }); + } + }); + thread.start(); + } + // add all games saved in games(ArrayList) to gamesAnchorPane void addUIData() { for (int i = 0; i < games.size(); i++) { diff --git a/src/main/java/com/cemu_UI/controller/DBController.java b/src/main/java/com/cemu_UI/controller/DBController.java index 52e9c9e..56de353 100644 --- a/src/main/java/com/cemu_UI/controller/DBController.java +++ b/src/main/java/com/cemu_UI/controller/DBController.java @@ -67,13 +67,11 @@ public class DBController { * load all games */ public void init(){ - LOGGER.info("<==========starting loading sql==========>"); + LOGGER.info("<========== starting loading sql ==========>"); loadRomDatabase(); loadGamesDatabase(); createRomDatabase(); - loadAllGames(); - checkRemoveEntry(); - LOGGER.info("<==========finished loading sql==========>"); + LOGGER.info("<========== finished loading sql ==========>"); } /** @@ -149,11 +147,13 @@ public class DBController { LOGGER.error("error while loading ROMs from ROM database, local_roms table", e); } if (entries.size() == 0) { - loadRomDirectory(mainWindowController.getRomDirectoryPath()); + mainWindowController.reloadRoms(); + } else { + loadAllGames(); } } - // add a Ggame to the database + // add a game to the database public void addGame(String title, String coverPath, String romPath, String titleID, String productCode, String region, String lastPlayed, String timePlayed) throws SQLException{ Statement stmt = connection.createStatement(); stmt.executeUpdate("insert into local_roms values ('"+title+"','"+coverPath+"','"+romPath+"','"+titleID+"'," @@ -163,6 +163,7 @@ public class DBController { LOGGER.info("added \""+title+"\" to ROM database"); } + // remove a game from the database public void removeGame(String titleID) throws SQLException{ Statement stmt = connection.createStatement(); stmt.executeUpdate("delete from local_roms where titleID = '"+titleID+"'"); @@ -171,8 +172,8 @@ public class DBController { LOGGER.info("removed \""+titleID+"\" from ROM database"); } - //load all ROMs on startup to the mainWindowController - void loadAllGames(){ + //load all ROMs to the mainWindowController + public void loadAllGames(){ LOGGER.info("loading all games on startup into the mainWindowController ..."); try { Statement stmt = connection.createStatement(); @@ -187,7 +188,7 @@ public class DBController { } } - //load one single ROM after manual adding into the mainWindowController + //load a single ROM to the mainWindowController public void loadSingleGame(String titleID){ LOGGER.info("loading a single game (ID: "+titleID+") into the mainWindowController ..."); try { @@ -223,6 +224,7 @@ public class DBController { try { Statement stmt = connectionGames.createStatement(); List files = (List) FileUtils.listFiles(dir, extensions, true); + LOGGER.info("<============================== start loading ROM Directory ==============================>"); LOGGER.info("Getting all .rpx files in " + dir.getCanonicalPath()+" including those in subdirectories"); // for all files in dir get the app.xml for (File file : files) { @@ -253,6 +255,7 @@ public class DBController { } } } + LOGGER.info("<============================= finished loading ROM Directory ============================>"); } catch (IOException | SQLException | ParserConfigurationException | SAXException e) { LOGGER.error("error while loading ROMs from directory", e); } @@ -268,6 +271,7 @@ public class DBController { return check; } + @SuppressWarnings("unused") private void checkRemoveEntry() { /** * TODO needs to be implemented! From 88e31468d4944832aca974cb37937b683fcd2702 Mon Sep 17 00:00:00 2001 From: Jannik Date: Sat, 3 Feb 2018 12:04:14 +0100 Subject: [PATCH 07/22] made choicebox matreial styled * made choicebox matreial styled * little code clean up --- .classpath | 3 +- pom.xml | 1 + .../application/MainWindowController.java | 1 - src/main/resources/css/MainWindows.css | 36 +++++++++++++++++-- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.classpath b/.classpath index e911fdf..afa5ec2 100644 --- a/.classpath +++ b/.classpath @@ -20,10 +20,11 @@ + - + diff --git a/pom.xml b/pom.xml index ef8430d..26b7d6d 100644 --- a/pom.xml +++ b/pom.xml @@ -179,6 +179,7 @@ + org.apache.maven.plugins maven-compiler-plugin diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index 3a594cf..ac4658f 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -1298,7 +1298,6 @@ public class MainWindowController { public void reloadRoms() { JFXSpinner spinner = new JFXSpinner(); spinner.setPrefSize(30, 30); - spinner.setStyle(" -fx-background-color: #f4f4f4;"); AnchorPane.setTopAnchor(spinner, (main.getPane().getPrefHeight()-spinner.getPrefHeight())/2); AnchorPane.setLeftAnchor(spinner, (main.getPane().getPrefWidth()-spinner.getPrefWidth())/2); diff --git a/src/main/resources/css/MainWindows.css b/src/main/resources/css/MainWindows.css index db8b365..2712b11 100644 --- a/src/main/resources/css/MainWindows.css +++ b/src/main/resources/css/MainWindows.css @@ -81,6 +81,38 @@ -fx-background-color: -fx-tree-table-color, -fx-box-border, -fx-control-inner-background; -fx-background-insets: -1.4, 0, 1; -fx-background-radius: 1.4, 0, 0; - /*....*/ -fx-padding: 1; /* 0.083333em; */ -} \ No newline at end of file +} + +/* + * ChoiceBox + */ + + +.choice-box { + -fx-background-color: transparent; + -fx-border-color: #000000; + -fx-border-width: 0 0 1 0; + -fx-background-radius: 0; + -fx-border-radius: 0; +} + +.choice-box:focused { + -fx-border-color: #9E9E9E; +} + +.choice-box>.open-button>.arrow { + -fx-background-color: #757575; +} + +.menu-item:focused { + -fx-background-color: #00A8CC; +} + +/* + * Spinner + */ +.spinner { + -fx-background-color: #f4f4f4; +} + From b88c530ac27f806140154275750dddf651d40e18 Mon Sep 17 00:00:00 2001 From: Jannik Date: Sat, 3 Feb 2018 14:22:41 +0100 Subject: [PATCH 08/22] use a ProcessBuilder instead of Runtime.exec --- .../java/com/cemu_UI/application/Main.java | 1 - .../application/MainWindowController.java | 32 +-------------- .../com/cemu_UI/application/playGame.java | 40 +++++++++++-------- src/main/resources/fxml/MainWindow.fxml | 9 ----- 4 files changed, 24 insertions(+), 58 deletions(-) diff --git a/src/main/java/com/cemu_UI/application/Main.java b/src/main/java/com/cemu_UI/application/Main.java index dcbb68d..d14f12f 100644 --- a/src/main/java/com/cemu_UI/application/Main.java +++ b/src/main/java/com/cemu_UI/application/Main.java @@ -141,7 +141,6 @@ public class Main extends Application { mainWindowController.setLanguage("en_US"); mainWindowController.setLastLocalSync(0); mainWindowController.setxPosHelper(0); - mainWindowController.setExecuteCommand(mainWindowController.getCemuPath() + "/Cemu.exe -g "); mainWindowController.saveSettings(); Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs) System.exit(0); //finishes itself diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index ac4658f..db639c5 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -284,14 +284,13 @@ public class MainWindowController { private String cemuPath; private String romDirectoryPath; private String gameExecutePath; - private String executeCommand; private String color; private String dialogBtnStyle; private String selectedGameTitleID; private String selectedGameTitle; private String id; private String version = "0.3.0"; - private String buildNumber = "073"; + private String buildNumber = "075"; private String versionName = "Puzzle Plank Galaxy"; private int xPos = -200; private int yPos = 17; @@ -404,7 +403,6 @@ public class MainWindowController { cemuTextField.setText(cemuPath); romTextField.setText(romDirectoryPath); - executeCommandTextFiled.setText(getExecuteCommand()); colorPicker.setValue(Color.valueOf(getColor())); fullscreenToggleBtn.setSelected(isFullscreen()); cloudSyncToggleBtn.setSelected(isCloudSync()); @@ -821,14 +819,6 @@ public class MainWindowController { saveSettings(); } }); - - executeCommandTextFiled.textProperty().addListener(new ChangeListener() { - @Override - public void changed(ObservableValue observable, String oldValue, String newValue) { - setExecuteCommand(executeCommandTextFiled.getText()); - saveSettings(); - } - }); LOGGER.info("initializing Actions done!"); } @@ -1055,12 +1045,8 @@ public class MainWindowController { void fullscreenToggleBtnAction(ActionEvent event) { if (fullscreen) { fullscreen = false; - setExecuteCommand(getExecuteCommand().replace("-f -g", "-g")); - executeCommandTextFiled.setText(getExecuteCommand()); } else { fullscreen = true; - setExecuteCommand(getExecuteCommand().replace("-g", "-f -g")); - executeCommandTextFiled.setText(getExecuteCommand()); } saveSettings(); } @@ -1669,7 +1655,6 @@ public class MainWindowController { try { props.setProperty("cemuPath", getCemuPath()); props.setProperty("romPath", getRomDirectoryPath()); - props.setProperty("executeCommand", getExecuteCommand()); props.setProperty("color", getColor()); props.setProperty("language", getLanguage()); props.setProperty("fullscreen", String.valueOf(isFullscreen())); @@ -1727,13 +1712,6 @@ public class MainWindowController { setRomDirectoryPath(""); } - if (props.getProperty("executeCommand") == null) { - LOGGER.error("could not load executeCommand, setting default instead!"); - setExecuteCommand(getCemuPath() + "\\Cemu.exe -g "); - } else { - setExecuteCommand(props.getProperty("executeCommand")); - } - try { setColor(props.getProperty("color")); } catch (Exception e) { @@ -1907,14 +1885,6 @@ public class MainWindowController { public void setRomDirectoryPath(String romDirectoryPath) { this.romDirectoryPath = romDirectoryPath; } - - public String getExecuteCommand() { - return executeCommand; - } - - public void setExecuteCommand(String executeCommand) { - this.executeCommand = executeCommand; - } public String getColor() { return color; diff --git a/src/main/java/com/cemu_UI/application/playGame.java b/src/main/java/com/cemu_UI/application/playGame.java index 751c896..4b7074f 100644 --- a/src/main/java/com/cemu_UI/application/playGame.java +++ b/src/main/java/com/cemu_UI/application/playGame.java @@ -45,7 +45,7 @@ public class playGame extends Thread{ @Override public void run(){ String selectedGameTitleID = mainWindowController.getSelectedGameTitleID(); - String executeComand; +// String executeComand; long startTime; long endTime; int timePlayedNow; @@ -57,25 +57,31 @@ public class playGame extends Thread{ }); startTime = System.currentTimeMillis(); try{ - executeComand = mainWindowController.getExecuteCommand() + " \"" + mainWindowController.getGameExecutePath() + "\""; +// executeComand = mainWindowController.getExecuteCommand() + " \"" + mainWindowController.getGameExecutePath() + "\""; + + if(mainWindowController.isFullscreen()){ + if(System.getProperty("os.name").equals("Linux")){ + p = new ProcessBuilder("wine", mainWindowController.getCemuPath() + "/Cemu.exe", "-f", + "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); + } else { + p = new ProcessBuilder(mainWindowController.getCemuPath() + "/Cemu.exe", "-f", + "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); + } + }else{ + if(System.getProperty("os.name").equals("Linux")){ + p = new ProcessBuilder("wine", mainWindowController.getCemuPath() + "/Cemu.exe", + "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); + } else { + p = new ProcessBuilder(mainWindowController.getCemuPath() + "/Cemu.exe", + "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); + } + } +// LOGGER.info(p.toString()); -// if(mainWindowController.isFullscreen()){ -// if(System.getProperty("os.name").equals("Linux")){ -// executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\""; -// } else { -// executeComand = mainWindowController.getCemuPath()+"\\Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\""; -// } -// }else{ -// if(System.getProperty("os.name").equals("Linux")){ -// executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -g \""+mainWindowController.getGameExecutePath()+"\""; -// } else { -// executeComand = mainWindowController.getCemuPath() + "\\Cemu.exe -g " + "\"" + mainWindowController.getGameExecutePath() + "\""; -// } -// } +// p = Runtime.getRuntime().exec("); +// p = new ProcessBuilder("wine", "/home/jannik/Downloads/cemu_1.11.3/Cemu.exe", "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); - LOGGER.info(executeComand); - p = Runtime.getRuntime().exec(executeComand); p.waitFor(); endTime = System.currentTimeMillis(); timePlayedNow = (int) Math.floor(((endTime - startTime)/1000/60)); diff --git a/src/main/resources/fxml/MainWindow.fxml b/src/main/resources/fxml/MainWindow.fxml index b0c0bdb..2f510b1 100644 --- a/src/main/resources/fxml/MainWindow.fxml +++ b/src/main/resources/fxml/MainWindow.fxml @@ -170,15 +170,6 @@ - - - - - - - From 79cb1c247699ca93120e7e1c596704ad6184c610 Mon Sep 17 00:00:00 2001 From: Jannik Date: Sat, 3 Feb 2018 15:39:35 +0100 Subject: [PATCH 09/22] fixed games are not loaded to mwc * fixed games are not loaded to mwc * fixed processbuilder --- .classpath | 1 - .../application/MainWindowController.java | 2 +- .../com/cemu_UI/application/playGame.java | 39 +++++++------------ .../com/cemu_UI/controller/DBController.java | 1 + 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/.classpath b/.classpath index afa5ec2..c7307ff 100644 --- a/.classpath +++ b/.classpath @@ -20,7 +20,6 @@ - diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index db639c5..64c8d6a 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -1317,7 +1317,7 @@ public class MainWindowController { } //remove all games from gamesAnchorPane and add them afterwards - void refreshUIData() { + public void refreshUIData() { //remove all games form gamesAnchorPane gamesAnchorPane.getChildren().removeAll(gamesAnchorPane.getChildren()); diff --git a/src/main/java/com/cemu_UI/application/playGame.java b/src/main/java/com/cemu_UI/application/playGame.java index 4b7074f..d5e5eef 100644 --- a/src/main/java/com/cemu_UI/application/playGame.java +++ b/src/main/java/com/cemu_UI/application/playGame.java @@ -45,7 +45,8 @@ public class playGame extends Thread{ @Override public void run(){ String selectedGameTitleID = mainWindowController.getSelectedGameTitleID(); -// String executeComand; + String cemuBin = mainWindowController.getCemuPath() + "/Cemu.exe"; + String gameExec = "\"" + mainWindowController.getGameExecutePath() + "\""; long startTime; long endTime; int timePlayedNow; @@ -57,30 +58,20 @@ public class playGame extends Thread{ }); startTime = System.currentTimeMillis(); try{ -// executeComand = mainWindowController.getExecuteCommand() + " \"" + mainWindowController.getGameExecutePath() + "\""; - - if(mainWindowController.isFullscreen()){ - if(System.getProperty("os.name").equals("Linux")){ - p = new ProcessBuilder("wine", mainWindowController.getCemuPath() + "/Cemu.exe", "-f", - "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); - } else { - p = new ProcessBuilder(mainWindowController.getCemuPath() + "/Cemu.exe", "-f", - "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); - } - }else{ - if(System.getProperty("os.name").equals("Linux")){ - p = new ProcessBuilder("wine", mainWindowController.getCemuPath() + "/Cemu.exe", - "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); - } else { - p = new ProcessBuilder(mainWindowController.getCemuPath() + "/Cemu.exe", - "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); - } - } -// LOGGER.info(p.toString()); - -// p = Runtime.getRuntime().exec("); -// p = new ProcessBuilder("wine", "/home/jannik/Downloads/cemu_1.11.3/Cemu.exe", "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); + if (System.getProperty("os.name").equals("Linux")) { + if(mainWindowController.isFullscreen()){ + p = new ProcessBuilder("wine", cemuBin, "-f", "-g", gameExec).start(); + } else { + p = new ProcessBuilder("wine", cemuBin, "-g", gameExec).start(); + } + } else { + if(mainWindowController.isFullscreen()){ + p = new ProcessBuilder(cemuBin, "-f", "-g", gameExec).start(); + } else { + p = new ProcessBuilder(cemuBin, "-g", gameExec).start(); + } + } p.waitFor(); endTime = System.currentTimeMillis(); diff --git a/src/main/java/com/cemu_UI/controller/DBController.java b/src/main/java/com/cemu_UI/controller/DBController.java index 56de353..971035e 100644 --- a/src/main/java/com/cemu_UI/controller/DBController.java +++ b/src/main/java/com/cemu_UI/controller/DBController.java @@ -150,6 +150,7 @@ public class DBController { mainWindowController.reloadRoms(); } else { loadAllGames(); + mainWindowController.refreshUIData(); } } From 54078eb99ff11ab630094b5666e76c779966e85e Mon Sep 17 00:00:00 2001 From: Jannik Date: Sat, 3 Feb 2018 17:51:38 +0100 Subject: [PATCH 10/22] clean up --- src/main/java/com/cemu_UI/application/playGame.java | 1 + src/test/main/com/cemu_UI/test/AppTest.java | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cemu_UI/application/playGame.java b/src/main/java/com/cemu_UI/application/playGame.java index d5e5eef..7f7f5a2 100644 --- a/src/main/java/com/cemu_UI/application/playGame.java +++ b/src/main/java/com/cemu_UI/application/playGame.java @@ -35,6 +35,7 @@ public class playGame extends Thread{ MainWindowController mainWindowController; DBController dbController; + @SuppressWarnings("unused") private static final Logger LOGGER = LogManager.getLogger(playGame.class.getName()); public playGame(MainWindowController m, com.cemu_UI.controller.DBController db){ diff --git a/src/test/main/com/cemu_UI/test/AppTest.java b/src/test/main/com/cemu_UI/test/AppTest.java index 5040382..e59605b 100644 --- a/src/test/main/com/cemu_UI/test/AppTest.java +++ b/src/test/main/com/cemu_UI/test/AppTest.java @@ -24,8 +24,7 @@ public class AppTest extends TestCase { @SuppressWarnings("unused") private void testClientsSecret() { - File client_secret = new File("/client_secret.json"); - Assert.assertTrue(client_secret.exists()); + } /** From 2e3395caea900fcb59a18f4755ff02d93f5c01ee Mon Sep 17 00:00:00 2001 From: Jannik Date: Sun, 4 Feb 2018 15:19:36 +0100 Subject: [PATCH 11/22] minor fixes * fixed a few typos * fixed window is resiable to 0x0 * * formating work work --- .../java/com/cemu_UI/application/Main.java | 8 ++-- .../application/MainWindowController.java | 26 ++++++------ .../com/cemu_UI/application/playGame.java | 42 +++++++++---------- .../com/cemu_UI/controller/DBController.java | 10 ++--- src/main/resources/fxml/MainWindow.fxml | 2 +- .../locals/cemu_UI-Local_en_US.properties | 10 ++--- 6 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/main/java/com/cemu_UI/application/Main.java b/src/main/java/com/cemu_UI/application/Main.java index d14f12f..5a21bb2 100644 --- a/src/main/java/com/cemu_UI/application/Main.java +++ b/src/main/java/com/cemu_UI/application/Main.java @@ -180,6 +180,8 @@ public class Main extends Application { 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 } catch (IOException e) { @@ -187,7 +189,7 @@ public class Main extends Application { } } - private void firstStart(){ + private void firstStart() { Alert alert = new Alert(AlertType.CONFIRMATION); // new alert with file-chooser alert.setTitle("cemu_UI"); alert.setHeaderText("cemu installation"); @@ -293,11 +295,11 @@ public class Main extends Application { public static void main(String[] args) { // delete old log file and create new - if(osName.equals("Linux")){ + if (osName.equals("Linux")) { System.setProperty("logFilename", userHome + "/cemu_UI/app.log"); File logFile = new File(userHome + "/cemu_UI/app.log"); logFile.delete(); - }else{ + } else { System.setProperty("logFilename", userHome + "/Documents/cemu_UI/app.log"); File logFile = new File(userHome + "/Documents/cemu_UI/app.log"); logFile.delete(); diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index 64c8d6a..aade0e3 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -1064,24 +1064,24 @@ public class MainWindowController { cloudService = "GoogleDrive"; // start cloud sync in new thread - Thread thread = new Thread(new Runnable() { - @Override + Thread thread = new Thread(new Runnable() { + @Override public void run() { - - if (main.getCloudController().initializeConnection(getCloudService(), getCemuPath())) { - main.getCloudController().sync(getCloudService(), getCemuPath(), main.getDirectory().getPath()); - saveSettings(); - } else { - cloudSyncToggleBtn.setSelected(false); - //cloud sync init error dialog + if (main.getCloudController().initializeConnection(getCloudService(), getCemuPath())) { + main.getCloudController().sync(getCloudService(), getCemuPath(), main.getDirectory().getPath()); + saveSettings(); + } else { + cloudSyncToggleBtn.setSelected(false); + + // cloud sync init error dialog JFXInfoDialog cloudSyncErrorDialog = new JFXInfoDialog(cloudSyncErrorHeadingText, cloudSyncErrorBodyText, dialogBtnStyle, 450, 170, main.getPane()); cloudSyncErrorDialog.show(); - } - - } - }); + } + + } + }); thread.start(); } }; diff --git a/src/main/java/com/cemu_UI/application/playGame.java b/src/main/java/com/cemu_UI/application/playGame.java index 7f7f5a2..9ed18c1 100644 --- a/src/main/java/com/cemu_UI/application/playGame.java +++ b/src/main/java/com/cemu_UI/application/playGame.java @@ -33,18 +33,17 @@ import javafx.application.Platform; public class playGame extends Thread{ - MainWindowController mainWindowController; - DBController dbController; - @SuppressWarnings("unused") + private MainWindowController mainWindowController; + private DBController dbController; private static final Logger LOGGER = LogManager.getLogger(playGame.class.getName()); - public playGame(MainWindowController m, com.cemu_UI.controller.DBController db){ + public playGame(MainWindowController m, com.cemu_UI.controller.DBController db) { mainWindowController = m; dbController = db; } - + @Override - public void run(){ + public void run() { String selectedGameTitleID = mainWindowController.getSelectedGameTitleID(); String cemuBin = mainWindowController.getCemuPath() + "/Cemu.exe"; String gameExec = "\"" + mainWindowController.getGameExecutePath() + "\""; @@ -58,8 +57,7 @@ public class playGame extends Thread{ mainWindowController.main.getPrimaryStage().setIconified(true); // minimize cemu_UI }); startTime = System.currentTimeMillis(); - try{ - + try { if (System.getProperty("os.name").equals("Linux")) { if(mainWindowController.isFullscreen()){ p = new ProcessBuilder("wine", cemuBin, "-f", "-g", gameExec).start(); @@ -74,22 +72,22 @@ public class playGame extends Thread{ } } - p.waitFor(); + p.waitFor(); // wait until cemu is closed so we can calculate the played time endTime = System.currentTimeMillis(); timePlayedNow = (int) Math.floor(((endTime - startTime)/1000/60)); timePlayed = Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID))+timePlayedNow; - dbController.setTotalPlaytime(Integer.toString(timePlayed), selectedGameTitleID); - Platform.runLater(() -> { - if(Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID)) > 60){ - int hoursPlayed = (int) Math.floor(Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID))/60); - int minutesPlayed = Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID))-60*hoursPlayed; - mainWindowController.totalPlaytimeBtn.setText(hoursPlayed+"h "+minutesPlayed+"min"); - }else{ - mainWindowController.totalPlaytimeBtn.setText(dbController.getTotalPlaytime(selectedGameTitleID)+ " min"); - } - mainWindowController.main.getPrimaryStage().setIconified(false); // maximize cemu_UI - }); + dbController.setTotalPlaytime(Integer.toString(timePlayed), selectedGameTitleID); + Platform.runLater(() -> { + if (Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID)) > 60) { + int hoursPlayed = (int) Math.floor(Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID)) / 60); + int minutesPlayed = Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID)) - 60 * hoursPlayed; + mainWindowController.totalPlaytimeBtn.setText(hoursPlayed + "h " + minutesPlayed + "min"); + } else { + mainWindowController.totalPlaytimeBtn.setText(dbController.getTotalPlaytime(selectedGameTitleID) + " min"); + } + mainWindowController.main.getPrimaryStage().setIconified(false); // maximize cemu_UI + }); //sync savegame with cloud service if (mainWindowController.isCloudSync()) { @@ -98,8 +96,8 @@ public class playGame extends Thread{ mainWindowController.getCemuPath(), mainWindowController.main.getDirectory().getPath()); } - }catch (IOException | InterruptedException e){ - e.printStackTrace(); + } catch (IOException | InterruptedException e) { + LOGGER.error(e); } } diff --git a/src/main/java/com/cemu_UI/controller/DBController.java b/src/main/java/com/cemu_UI/controller/DBController.java index 971035e..f73c554 100644 --- a/src/main/java/com/cemu_UI/controller/DBController.java +++ b/src/main/java/com/cemu_UI/controller/DBController.java @@ -66,7 +66,7 @@ public class DBController { * load ROM and games database * load all games */ - public void init(){ + public void init() { LOGGER.info("<========== starting loading sql ==========>"); loadRomDatabase(); loadGamesDatabase(); @@ -79,18 +79,18 @@ public class DBController { * * TODO this should be called LocalGames */ - private void loadRomDatabase(){ + private void loadRomDatabase() { if (System.getProperty("os.name").equals("Linux")) { DB_PATH_localRoms = System.getProperty("user.home") + "/cemu_UI/localRoms.db"; - }else{ + } else { DB_PATH_localRoms = System.getProperty("user.home") + "\\Documents\\cemu_UI" + "\\" + "localRoms.db"; } try { // create a database connection connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH_localRoms); - connection.setAutoCommit(false); //AutoCommit to false -> manual commit is active + connection.setAutoCommit(false); // AutoCommit to false -> manual commit is active } catch (SQLException e) { - // if the error message is "out of memory", it probably means no database file is found + // if the error message is "out of memory", probably no database file is found LOGGER.error("error while loading the ROM database", e); } LOGGER.info("ROM database loaded successfull"); diff --git a/src/main/resources/fxml/MainWindow.fxml b/src/main/resources/fxml/MainWindow.fxml index 2f510b1..a17ba18 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_en_US.properties b/src/main/resources/locals/cemu_UI-Local_en_US.properties index f93fce9..c4670e8 100644 --- a/src/main/resources/locals/cemu_UI-Local_en_US.properties +++ b/src/main/resources/locals/cemu_UI-Local_en_US.properties @@ -33,7 +33,7 @@ timeColumn = time # Strings editHeadingText = edit -editBodyText = You can edit the tile and rom/cover path. +editBodyText = You can edit the tile and ROM/cover path. removeHeadingText = remove removeBodyText = Are you sure you want to delete addUpdateHeadingText = update @@ -49,15 +49,15 @@ aboutBtnHeadingText = cemu_UI aboutBtnBodyText = This Application is made with free Software\nand licensed under the terms of GNU GPL 3.\n\nwww.kellerkinder.xyz cloudSyncWaringHeadingText = activate cloud savegame sync (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! +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! cloudSyncErrorHeadingText = Error while initializing cloud sync! -cloudSyncErrorBodyText = There was some truble while initializing cloud sync.\nPlease upload the app.log (which can be found in the cemu_UI directory)\nto \"https://github.com/Seil0/cemu_UI/issues\" so we can fix this. +cloudSyncErrorBodyText = There was some trouble while initializing cloud sync.\nPlease upload the app.log (which can be found in the cemu_UI directory)\nto \"https://github.com/Seil0/cemu_UI/issues\" so we can fix this. addGameBtnHeadingText = add a new game to cemu_UI addGameBtnBodyText = addBtnReturnErrorHeadingText = Error while adding a new Game! -addBtnReturnErrorBodyText = There was some truble adding your game.\nOne of the needed values was empty, please try again to add your game. +addBtnReturnErrorBodyText = There was some trouble adding your game.\nOne of the needed values was empty, please try again to add your game. lastPlayed = Last played, today = today yesterday = yesterday @@ -82,6 +82,6 @@ titleID = title ID romPath = ROM path coverPath = cover path editGameDialogHeadingTextError = Error while adding a new Game! -editGameDialogBodyTextError = There was some truble adding your game.\nOne of the needed values was empty, please try again to add your game. +editGameDialogBodyTextError = There was some trouble adding your game.\nOne of the needed values was empty, please try again to add your game. editGameDialogSelectPathBtn = select .rpx file editGameDialogSelectCoverBtn = select cover file From 4932731987b7cccf313827b334cf9aa193fbecd4 Mon Sep 17 00:00:00 2001 From: Jannik Date: Wed, 14 Feb 2018 22:53:14 +0100 Subject: [PATCH 12/22] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 105d90e..9d7c807 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # cemu_UI ![Total Downloads](https://img.shields.io/github/downloads/Seil0/cemu_UI/total.svg?style=flat-square) -[![](https://img.shields.io/travis/Seil0/cemu_UI/master.svg?style=flat-square)](https://travis-ci.org/Seil0/cemu_UI) +[![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) [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0) From f7675cf277006d71b72bd853d15d40ddb9806af2 Mon Sep 17 00:00:00 2001 From: Jannik Date: Wed, 14 Feb 2018 22:55:27 +0100 Subject: [PATCH 13/22] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9d7c807..e5ce6b6 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ ![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) [![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). From 3a6a7b7cce3efa772c736d0fba9f75d0b831a905 Mon Sep 17 00:00:00 2001 From: Jannik Date: Sat, 17 Feb 2018 17:49:12 +0100 Subject: [PATCH 14/22] * jfoenix 9.0.1 -> 9.0.2 * code clean up * last time played and playtime button are now large enough --- pom.xml | 2 +- .../java/com/cemu_UI/application/Main.java | 22 +++++++-- .../application/MainWindowController.java | 49 +++---------------- .../com/cemu_UI/controller/DBController.java | 28 ++++------- src/main/resources/fxml/MainWindow.fxml | 4 +- 5 files changed, 35 insertions(+), 70 deletions(-) diff --git a/pom.xml b/pom.xml index 26b7d6d..31e3b8e 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ com.jfoenix jfoenix - 9.0.1 + 9.0.2 diff --git a/src/main/java/com/cemu_UI/application/Main.java b/src/main/java/com/cemu_UI/application/Main.java index 5a21bb2..590cf47 100644 --- a/src/main/java/com/cemu_UI/application/Main.java +++ b/src/main/java/com/cemu_UI/application/Main.java @@ -116,7 +116,7 @@ public class Main extends Application { } // startup checks - // check if client_secret.jason is present + // check if client_secret.json is present if (Main.class.getResourceAsStream("/client_secret.json") == null) { LOGGER.error("client_secret is missing!!!!!"); @@ -142,11 +142,11 @@ public class Main extends Application { mainWindowController.setLastLocalSync(0); mainWindowController.setxPosHelper(0); mainWindowController.saveSettings(); - Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs) + Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //TODO check if this really is needed start again (preventing Bugs) System.exit(0); //finishes itself } - if (pictureCache.exists() != true) { + if (!pictureCache.exists()) { pictureCache.mkdir(); } @@ -341,7 +341,19 @@ public class Main extends Application { return directory; } - public void setDirectory(File directory) { - this.directory = directory; + public File getConfigFile() { + return configFile; + } + + public File getGamesDBFile() { + return gamesDBFile; + } + + public File getReference_gamesFile() { + return reference_gamesFile; + } + + public File getPictureCache() { + return pictureCache; } } diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index aade0e3..04813d3 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -302,12 +302,6 @@ public class MainWindowController { private double windowWidth; private double windowHeight; private DirectoryChooser directoryChooser = new DirectoryChooser(); - private File dirWin = new File(System.getProperty("user.home") + "/Documents/cemu_UI"); - private File dirLinux = new File(System.getProperty("user.home") + "/cemu_UI"); - private File configFileWin = new File(dirWin + "/config.xml"); - private File configFileLinux = new File(dirLinux + "/config.xml"); - private File pictureCacheWin = new File(dirWin + "/picture_cache"); - private File pictureCacheLinux = new File(dirLinux + "/picture_cache"); private ObservableList branches = FXCollections.observableArrayList("stable", "beta"); private ObservableList languages = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)"); private ObservableList smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); // TODO add more IDs @@ -376,7 +370,7 @@ public class MainWindowController { public void setMain(Main m) { this.main = m; - dbController = new DBController(this); + dbController = new DBController(main, this); smmdbAPIController = new SmmdbAPIController(); } @@ -911,7 +905,7 @@ public class MainWindowController { @FXML void lastTimePlayedBtnAction(ActionEvent event) { - + System.out.println(lastTimePlayedBtn.getWidth()); } @FXML @@ -1134,15 +1128,9 @@ public class MainWindowController { errorDialog.show(); } else { - File pictureCache; + File pictureCache = main.getPictureCache(); String 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); @@ -1651,7 +1639,7 @@ public class MainWindowController { public void saveSettings(){ LOGGER.info("saving Settings ..."); - OutputStream outputStream; //new output-stream + try { props.setProperty("cemuPath", getCemuPath()); props.setProperty("romPath", getRomDirectoryPath()); @@ -1670,11 +1658,7 @@ public class MainWindowController { props.setProperty("lastLocalSync", String.valueOf(getLastLocalSync())); props.setProperty("windowWidth", String.valueOf(mainAnchorPane.getWidth())); props.setProperty("windowHeight", String.valueOf(mainAnchorPane.getHeight())); - if(System.getProperty("os.name").equals("Linux")){ - outputStream = new FileOutputStream(configFileLinux); - }else{ - outputStream = new FileOutputStream(configFileWin); - } + OutputStream outputStream = new FileOutputStream(main.getConfigFile()); //new output-stream props.storeToXML(outputStream, "cemu_UI settings"); //write new .xml outputStream.close(); LOGGER.info("saving Settings done!"); @@ -1689,13 +1673,8 @@ public class MainWindowController { */ private void loadSettings(){ LOGGER.info("loading settings ..."); - InputStream inputStream; try { - if(System.getProperty("os.name").equals("Linux")){ - inputStream = new FileInputStream(configFileLinux); - }else{ - inputStream = new FileInputStream(configFileWin); - } + InputStream inputStream = new FileInputStream(main.getConfigFile()); props.loadFromXML(inputStream); //new input-stream from .xml try { @@ -1894,22 +1873,6 @@ public class MainWindowController { this.color = color; } - public File getPictureCacheLinux() { - return pictureCacheLinux; - } - - public void setPictureCacheLinux(File pictureCacheLinux) { - this.pictureCacheLinux = pictureCacheLinux; - } - - public File getPictureCacheWin() { - return pictureCacheWin; - } - - public void setPictureCacheWin(File pictureCacheWin) { - this.pictureCacheWin = pictureCacheWin; - } - public int getxPos() { return xPos; } diff --git a/src/main/java/com/cemu_UI/controller/DBController.java b/src/main/java/com/cemu_UI/controller/DBController.java index f73c554..9b9c390 100644 --- a/src/main/java/com/cemu_UI/controller/DBController.java +++ b/src/main/java/com/cemu_UI/controller/DBController.java @@ -45,14 +45,17 @@ import org.apache.logging.log4j.Logger; import org.w3c.dom.Document; import org.xml.sax.SAXException; +import com.cemu_UI.application.Main; import com.cemu_UI.application.MainWindowController; public class DBController { - public DBController(MainWindowController mwc) { - mainWindowController = mwc; + public DBController(Main main, MainWindowController mainWindowController) { + this.main = main; + this.mainWindowController = mainWindowController; } + private Main main; private MainWindowController mainWindowController; private ArrayList entries = new ArrayList<>(); private String DB_PATH_localRoms; @@ -98,16 +101,10 @@ public class DBController { /** * set the path to the localRoms.db file and initialize the connection - * - * games.dbcontains a reverence list to for the automatic detection mode - * TODO rework paths + * games.db contains a reverence list to for the automatic detection mode */ private void loadGamesDatabase() { - if (System.getProperty("os.name").equals("Linux")) { - DB_PATH_games = System.getProperty("user.home") + "/cemu_UI/reference_games.db"; - } else { - DB_PATH_games = System.getProperty("user.home") + "\\Documents\\cemu_UI" + "\\" + "reference_games.db"; - } + DB_PATH_games = main.getReference_gamesFile().getAbsolutePath(); try { // create a database connection connectionGames = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH_games); @@ -213,15 +210,8 @@ public class DBController { File dir = new File(directory); File appFile; String[] extensions = new String[] { "rpx", "jsp" }; - File pictureCache; - String coverPath; - - if(System.getProperty("os.name").equals("Linux")){ - pictureCache = mainWindowController.getPictureCacheLinux(); - }else{ - pictureCache = mainWindowController.getPictureCacheWin(); - } - + File pictureCache = main.getPictureCache(); + String coverPath; try { Statement stmt = connectionGames.createStatement(); List files = (List) FileUtils.listFiles(dir, extensions, true); diff --git a/src/main/resources/fxml/MainWindow.fxml b/src/main/resources/fxml/MainWindow.fxml index a17ba18..c9dde2c 100644 --- a/src/main/resources/fxml/MainWindow.fxml +++ b/src/main/resources/fxml/MainWindow.fxml @@ -213,14 +213,14 @@ - + - + From 061f58105ae9cd1123b86e79a3d1330f8f5c8acf Mon Sep 17 00:00:00 2001 From: Jannik Date: Sun, 18 Feb 2018 13:57:30 +0100 Subject: [PATCH 15/22] documentation cleanups, code cleanup * removed one unnecessary restart * added warning if the ROM directory could not be opened --- .../application/MainWindowController.java | 46 +++++++++++++------ .../com/cemu_UI/controller/DBController.java | 10 +++- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index 04813d3..b646ffc 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -811,6 +811,15 @@ public class MainWindowController { public void changed(ObservableValue observable, String oldValue, String newValue) { setRomDirectoryPath(romTextField.getText()); saveSettings(); + + if (new File(romTextField.getText()).exists()) { + reloadRoms(); + } else { + String bodyText = "No such file or directory"; + JFXInfoDialog fileErrorDialog = new JFXInfoDialog("Waring!", bodyText, dialogBtnStyle, 190, 150, main.getPane()); + fileErrorDialog.show(); + LOGGER.warn("Directory does not exist"); + } } }); @@ -905,14 +914,14 @@ public class MainWindowController { @FXML void lastTimePlayedBtnAction(ActionEvent event) { - System.out.println(lastTimePlayedBtn.getWidth()); + } @FXML void cemuTFBtnAction(ActionEvent event) { File cemuDirectory = directoryChooser.showDialog(main.getPrimaryStage()); if (cemuDirectory == null) { - LOGGER.info("No Directory selected"); + LOGGER.warn("No Directory selected"); } else { setCemuPath(cemuDirectory.getAbsolutePath()); saveSettings(); @@ -929,18 +938,17 @@ public class MainWindowController { @FXML void romTFBtnAction(ActionEvent event) { File romDirectory = directoryChooser.showDialog(main.getPrimaryStage()); - if (romDirectory == null) { - LOGGER.info("No Directory selected"); + setRomDirectoryPath(romDirectory.getAbsolutePath()); + saveSettings(); + romTextField.setText(getRomDirectoryPath()); + + if (romDirectory.exists()) { + reloadRoms(); } else { - setRomDirectoryPath(romDirectory.getAbsolutePath()); - saveSettings(); - cemuTextField.setText(getCemuPath()); - try { - Runtime.getRuntime().exec("java -jar cemu_UI.jar"); // start again - System.exit(0); // finishes itself - } catch (IOException e) { - LOGGER.error("an error occurred", e); - } + String bodyText = "No such file or directory"; + JFXInfoDialog fileErrorDialog = new JFXInfoDialog("Waring!", bodyText, dialogBtnStyle, 190, 150, main.getPane()); + fileErrorDialog.show(); + LOGGER.warn("Directory does not exist"); } } @@ -1269,6 +1277,9 @@ public class MainWindowController { games.add(uiROMElement); } + /** + * reload all ROMs from the ROM directory + */ public void reloadRoms() { JFXSpinner spinner = new JFXSpinner(); spinner.setPrefSize(30, 30); @@ -1323,6 +1334,7 @@ public class MainWindowController { } } + // set the selected local strings to all needed elements void setUILanguage(){ switch(getLanguage()){ case "en_US": @@ -1405,6 +1417,7 @@ public class MainWindowController { smmdbDownloadBtnDownload = bundle.getString("smmdbDownloadBtnDownload"); } + // if AutoUpdate, then check for updates private void checkAutoUpdate() { if (isAutoUpdate()) { @@ -1574,6 +1587,7 @@ public class MainWindowController { // System.out.println("xPos: " + xPos); } + // change the color of all needed GUI elements private void applyColor() { String boxStyle = "-fx-background-color: #"+getColor()+";"; String btnStyleBlack = "-fx-button-type: RAISED; -fx-background-color: #"+getColor()+"; -fx-text-fill: BLACK;"; @@ -1636,7 +1650,10 @@ public class MainWindowController { games.get(i).getButton().setRipplerFill(Paint.valueOf(getColor())); } } - + + /** + * save settings to the config.xml file + */ public void saveSettings(){ LOGGER.info("saving Settings ..."); @@ -1658,6 +1675,7 @@ public class MainWindowController { props.setProperty("lastLocalSync", String.valueOf(getLastLocalSync())); props.setProperty("windowWidth", String.valueOf(mainAnchorPane.getWidth())); props.setProperty("windowHeight", String.valueOf(mainAnchorPane.getHeight())); + OutputStream outputStream = new FileOutputStream(main.getConfigFile()); //new output-stream props.storeToXML(outputStream, "cemu_UI settings"); //write new .xml outputStream.close(); diff --git a/src/main/java/com/cemu_UI/controller/DBController.java b/src/main/java/com/cemu_UI/controller/DBController.java index 9b9c390..9dae994 100644 --- a/src/main/java/com/cemu_UI/controller/DBController.java +++ b/src/main/java/com/cemu_UI/controller/DBController.java @@ -230,7 +230,7 @@ public class DBController { // for all elements in the games table check if it's already present, else add it while (rs.next()) { - if (checkEntry(rs.getString(2))) { + if (checkAddEntry(rs.getString(2))) { LOGGER.info(rs.getString(2) + ": game already in database"); } else { LOGGER.info("adding cover to cache ..."); @@ -252,7 +252,13 @@ public class DBController { } } - private boolean checkEntry(String title) throws SQLException{ + /** + * check if there is a game with the given name already in the database + * @param title game title + * @return true if the game exists, false if not + * @throws SQLException + */ + private boolean checkAddEntry(String title) throws SQLException{ Statement stmt = connection.createStatement(); boolean check = false; ResultSet rs = stmt.executeQuery("SELECT * FROM local_roms WHERE title = '"+title+"';"); From b4fc36621ad53b29a07e00c9a85dac8008b983bf Mon Sep 17 00:00:00 2001 From: Jannik Date: Sun, 18 Feb 2018 18:27:36 +0100 Subject: [PATCH 16/22] code cleanup removed some unnecessary save calls * removed some unnecessary things after opening a directorychooser * typo fixes --- .../java/com/cemu_UI/application/Main.java | 4 +- .../application/MainWindowController.java | 155 ++++++++---------- .../com/cemu_UI/application/playGame.java | 2 +- .../locals/cemu_UI-Local_en_US.properties | 2 +- 4 files changed, 72 insertions(+), 91 deletions(-) diff --git a/src/main/java/com/cemu_UI/application/Main.java b/src/main/java/com/cemu_UI/application/Main.java index 590cf47..14eb6da 100644 --- a/src/main/java/com/cemu_UI/application/Main.java +++ b/src/main/java/com/cemu_UI/application/Main.java @@ -241,7 +241,7 @@ public class Main extends Application { saveTask = new TimerTask() { @Override - public void run() { + public void run() { mainWindowController.saveSettings(); } }; @@ -262,7 +262,7 @@ public class Main extends Application { saveTask = new TimerTask() { @Override - public void run() { + public void run() { mainWindowController.saveSettings(); } }; diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index b646ffc..e50cf16 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -54,9 +54,9 @@ import org.apache.commons.io.FileUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.cemu_UI.controller.DBController; 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.SmmdbApiDataType; import com.cemu_UI.datatypes.UIROMDataType; @@ -801,24 +801,30 @@ public class MainWindowController { cemuTextField.textProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, String oldValue, String newValue) { - setCemuPath(cemuTextField.getText()); - saveSettings(); + if (new File(newValue).exists()) { + setCemuPath(newValue); + saveSettings(); + } else { + String bodyText = newValue + ": No such file or directory"; + JFXInfoDialog fileErrorDialog = new JFXInfoDialog("Waring!", bodyText, dialogBtnStyle, 190, 150, main.getPane()); + fileErrorDialog.show(); + LOGGER.warn(newValue + ": No such file or directory"); + } } }); romTextField.textProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, String oldValue, String newValue) { - setRomDirectoryPath(romTextField.getText()); - saveSettings(); - - if (new File(romTextField.getText()).exists()) { + if (new File(newValue).exists()) { + setRomDirectoryPath(newValue); + saveSettings(); reloadRoms(); } else { - String bodyText = "No such file or directory"; + String bodyText = newValue + ": No such file or directory"; JFXInfoDialog fileErrorDialog = new JFXInfoDialog("Waring!", bodyText, dialogBtnStyle, 190, 150, main.getPane()); fileErrorDialog.show(); - LOGGER.warn("Directory does not exist"); + LOGGER.warn(newValue + ": No such file or directory"); } } }); @@ -827,7 +833,7 @@ public class MainWindowController { } @FXML - void detailsSlideoutBtnAction(ActionEvent event) { + void detailsSlideoutBtnAction() { playBtnSlideOut(); } @@ -840,7 +846,7 @@ public class MainWindowController { } @FXML - void settingsBtnAction(ActionEvent event) { + void settingsBtnAction() { if (smmdbTrue) { smmdbAnchorPane.setVisible(false); smmdbTrue = false; @@ -900,7 +906,7 @@ public class MainWindowController { } @FXML - void playBtnAction(ActionEvent event) throws InterruptedException, IOException { + void playBtnAction() throws InterruptedException, IOException { dbController.setLastPlayed(selectedGameTitleID); playGame = new playGame(this, dbController); @@ -908,52 +914,33 @@ public class MainWindowController { } @FXML - void totalPlaytimeBtnAction(ActionEvent event) { - + void totalPlaytimeBtnAction() { + } @FXML - void lastTimePlayedBtnAction(ActionEvent event) { + void lastTimePlayedBtnAction() { } @FXML - void cemuTFBtnAction(ActionEvent event) { + void cemuTFBtnAction() { File cemuDirectory = directoryChooser.showDialog(main.getPrimaryStage()); - if (cemuDirectory == null) { - LOGGER.warn("No Directory selected"); - } else { - setCemuPath(cemuDirectory.getAbsolutePath()); - saveSettings(); - cemuTextField.setText(getCemuPath()); - try { - Runtime.getRuntime().exec("java -jar cemu_UI.jar"); // start again - System.exit(0); // finishes itself - } catch (IOException e) { - LOGGER.error("an error occurred", e); - } + if (cemuDirectory != null) { + cemuTextField.setText(cemuDirectory.getAbsolutePath()); } } @FXML - void romTFBtnAction(ActionEvent event) { + void romTFBtnAction() { File romDirectory = directoryChooser.showDialog(main.getPrimaryStage()); - setRomDirectoryPath(romDirectory.getAbsolutePath()); - saveSettings(); - romTextField.setText(getRomDirectoryPath()); - - if (romDirectory.exists()) { - reloadRoms(); - } else { - String bodyText = "No such file or directory"; - JFXInfoDialog fileErrorDialog = new JFXInfoDialog("Waring!", bodyText, dialogBtnStyle, 190, 150, main.getPane()); - fileErrorDialog.show(); - LOGGER.warn("Directory does not exist"); + if (romDirectory != null) { + romTextField.setText(romDirectory.getAbsolutePath()); } } @FXML - void updateBtnAction(ActionEvent event) { + void updateBtnAction() { updateController = new UpdateController(this, buildNumber, useBeta); Thread updateThread = new Thread(updateController); updateThread.setName("Updater"); @@ -961,7 +948,7 @@ public class MainWindowController { } @FXML - void autoUpdateToggleBtnAction(ActionEvent event) { + void autoUpdateToggleBtnAction() { if (isAutoUpdate()) { setAutoUpdate(false); } else { @@ -971,12 +958,12 @@ public class MainWindowController { } @FXML - void courseSearchTextFiledAction(ActionEvent event) { + void courseSearchTextFiledAction() { // not in use } @FXML - void smmdbDownloadBtnAction(ActionEvent event) { + 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() + "/"; @@ -1044,7 +1031,7 @@ public class MainWindowController { } @FXML - void fullscreenToggleBtnAction(ActionEvent event) { + void fullscreenToggleBtnAction() { if (fullscreen) { fullscreen = false; } else { @@ -1054,7 +1041,7 @@ public class MainWindowController { } @FXML - void cloudSyncToggleBtnAction(ActionEvent event) { + void cloudSyncToggleBtnAction() { if(cloudSync) { cloudSync = false; } else { @@ -1103,13 +1090,13 @@ public class MainWindowController { } @FXML - void colorPickerAction(ActionEvent event) { + void colorPickerAction() { editColor(colorPicker.getValue().toString()); applyColor(); } @FXML - void addBtnAction(ActionEvent event) { + void addBtnAction() { String headingText = addGameBtnHeadingText; String bodyText = addGameBtnBodyText; JFXEditGameDialog addGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 450, 300, 0, @@ -1308,15 +1295,9 @@ public class MainWindowController { thread.start(); } - // add all games saved in games(ArrayList) to gamesAnchorPane - void addUIData() { - for (int i = 0; i < games.size(); i++) { - gamesAnchorPane.getChildren().add(games.get(i).getVBox()); - } - } - //remove all games from gamesAnchorPane and add them afterwards public void refreshUIData() { + System.out.println("refresh"); //remove all games form gamesAnchorPane gamesAnchorPane.getChildren().removeAll(gamesAnchorPane.getChildren()); @@ -1654,11 +1635,11 @@ public class MainWindowController { /** * save settings to the config.xml file */ - public void saveSettings(){ - LOGGER.info("saving Settings ..."); - - try { - props.setProperty("cemuPath", getCemuPath()); + public void saveSettings() { + LOGGER.info("saving Settings ..."); + + try { + props.setProperty("cemuPath", getCemuPath()); props.setProperty("romPath", getRomDirectoryPath()); props.setProperty("color", getColor()); props.setProperty("language", getLanguage()); @@ -1675,89 +1656,89 @@ public class MainWindowController { props.setProperty("lastLocalSync", String.valueOf(getLastLocalSync())); props.setProperty("windowWidth", String.valueOf(mainAnchorPane.getWidth())); props.setProperty("windowHeight", String.valueOf(mainAnchorPane.getHeight())); - - OutputStream outputStream = new FileOutputStream(main.getConfigFile()); //new output-stream - props.storeToXML(outputStream, "cemu_UI settings"); //write new .xml - outputStream.close(); - LOGGER.info("saving Settings done!"); - } catch (IOException e) { - LOGGER.error("an error occured", e); - } - } + + OutputStream outputStream = new FileOutputStream(main.getConfigFile()); // new output-stream + props.storeToXML(outputStream, "cemu_UI settings"); // write new .xml + outputStream.close(); + LOGGER.info("saving Settings done!"); + } catch (IOException e) { + LOGGER.error("an error occured", e); + } + } /** * loading saved settings from the config.xml file * if a value is not present, default is used instead */ - private void loadSettings(){ - LOGGER.info("loading settings ..."); + private void loadSettings() { + LOGGER.info("loading settings ..."); try { InputStream inputStream = new FileInputStream(main.getConfigFile()); - props.loadFromXML(inputStream); //new input-stream from .xml - + props.loadFromXML(inputStream); // new input-stream from .xml + try { setCemuPath(props.getProperty("cemuPath")); } catch (Exception e) { LOGGER.error("cloud not load cemuPath", e); setCemuPath(""); } - + try { setRomDirectoryPath(props.getProperty("romPath")); } catch (Exception e) { LOGGER.error("could not load romPath", e); setRomDirectoryPath(""); } - + try { setColor(props.getProperty("color")); } catch (Exception e) { LOGGER.error("could not load color value, setting default instead", e); setColor("00a8cc"); } - + if (props.getProperty("language") == null) { LOGGER.error("cloud not load language, setting default instead"); setLanguage("en_US"); } else { setLanguage(props.getProperty("language")); } - + try { setFullscreen(Boolean.parseBoolean(props.getProperty("fullscreen"))); } catch (Exception e) { LOGGER.error("could not load fullscreen, setting default instead", e); setFullscreen(false); } - + try { setCloudSync(Boolean.parseBoolean(props.getProperty("cloudSync"))); } catch (Exception e) { LOGGER.error("could not load cloudSync, setting default instead", e); setCloudSync(false); } - + try { setAutoUpdate(Boolean.parseBoolean(props.getProperty("autoUpdate"))); } catch (Exception e) { LOGGER.error("cloud not load autoUpdate", e); setAutoUpdate(false); } - + try { setUseBeta(Boolean.parseBoolean(props.getProperty("useBeta"))); } catch (Exception e) { LOGGER.error("cloud not load autoUpdate", e); setUseBeta(false); } - + try { setCloudService(props.getProperty("cloudService")); } catch (Exception e) { LOGGER.error("could not load cloudSync", e); setCloudService(""); } - + try { main.getCloudController().setFolderID(props.getProperty("folderID"), getCloudService()); } catch (Exception e) { @@ -1771,27 +1752,27 @@ public class MainWindowController { LOGGER.error("could not load lastSuccessSync, setting default instead", e); setLastLocalSync(0); } - + try { setWindowWidth(Double.parseDouble(props.getProperty("windowWidth"))); } catch (Exception e) { LOGGER.error("could not load windowWidth, setting default instead", e); setWindowWidth(904); } - + try { setWindowHeight(Double.parseDouble(props.getProperty("windowHeight"))); } catch (Exception e) { LOGGER.error("could not load windowHeight, setting default instead", e); setWindowHeight(600); } - + inputStream.close(); - LOGGER.info("loading settings done!"); + LOGGER.info("loading settings done!"); } catch (IOException e) { LOGGER.error("an error occured", e); } - } + } private void sideMenuSlideIn(){ sideMenuVBox.setVisible(true); diff --git a/src/main/java/com/cemu_UI/application/playGame.java b/src/main/java/com/cemu_UI/application/playGame.java index 9ed18c1..7cfb24c 100644 --- a/src/main/java/com/cemu_UI/application/playGame.java +++ b/src/main/java/com/cemu_UI/application/playGame.java @@ -57,7 +57,7 @@ public class playGame extends Thread{ mainWindowController.main.getPrimaryStage().setIconified(true); // minimize cemu_UI }); startTime = System.currentTimeMillis(); - try { + try { if (System.getProperty("os.name").equals("Linux")) { if(mainWindowController.isFullscreen()){ p = new ProcessBuilder("wine", cemuBin, "-f", "-g", gameExec).start(); 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 c4670e8..043d926 100644 --- a/src/main/resources/locals/cemu_UI-Local_en_US.properties +++ b/src/main/resources/locals/cemu_UI-Local_en_US.properties @@ -2,7 +2,7 @@ # Buttons aboutBtn = About -settingsBtn = Setting +settingsBtn = Settings addBtn = Add new Game reloadRomsBtn = reload ROMs smmdbBtn = smmdb From b915cf7ad917cbc696e291a3416292c7f388ab72 Mon Sep 17 00:00:00 2001 From: Jannik Date: Tue, 20 Feb 2018 21:22:10 +0100 Subject: [PATCH 17/22] removed last unnecessary reboot * needs more testing, especialy under Windows * test on a completly fresh setup --- src/main/java/com/cemu_UI/application/Main.java | 2 -- .../java/com/cemu_UI/application/MainWindowController.java | 7 ++++--- src/main/java/com/cemu_UI/controller/UpdateController.java | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cemu_UI/application/Main.java b/src/main/java/com/cemu_UI/application/Main.java index 14eb6da..618ef02 100644 --- a/src/main/java/com/cemu_UI/application/Main.java +++ b/src/main/java/com/cemu_UI/application/Main.java @@ -142,8 +142,6 @@ public class Main extends Application { mainWindowController.setLastLocalSync(0); mainWindowController.setxPosHelper(0); mainWindowController.saveSettings(); - Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //TODO check if this really is needed start again (preventing Bugs) - System.exit(0); //finishes itself } if (!pictureCache.exists()) { diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index e50cf16..b18723c 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -290,7 +290,7 @@ public class MainWindowController { private String selectedGameTitle; private String id; private String version = "0.3.0"; - private String buildNumber = "075"; + private String buildNumber = "077"; private String versionName = "Puzzle Plank Galaxy"; private int xPos = -200; private int yPos = 17; @@ -719,7 +719,7 @@ public class MainWindowController { try { Desktop.getDesktop().browse(new URI("https://github.com/Seil0/cemu_UI/issues/3")); } catch (IOException | URISyntaxException e) { - e.printStackTrace(); + LOGGER.error("An error ocoured while trying to open a Website.", e); } } }); @@ -1297,7 +1297,6 @@ public class MainWindowController { //remove all games from gamesAnchorPane and add them afterwards public void refreshUIData() { - System.out.println("refresh"); //remove all games form gamesAnchorPane gamesAnchorPane.getChildren().removeAll(gamesAnchorPane.getChildren()); @@ -1544,6 +1543,8 @@ public class MainWindowController { /**FIXME somehow the window width is set to 8, if we can find a way to get always the real window with *(at the beginning we have to use prefWidth after resizing Width) we can remove this + *This is caused by the time the game objects are generates, + *it's before the window is opened so it's size is > 10 */ if (mainAnchorPane.getWidth() < 10) { xPosHelperMax = (int) Math.floor((mainAnchorPane.getPrefWidth() - 36) / 217); diff --git a/src/main/java/com/cemu_UI/controller/UpdateController.java b/src/main/java/com/cemu_UI/controller/UpdateController.java index a7d69be..a68dd72 100644 --- a/src/main/java/com/cemu_UI/controller/UpdateController.java +++ b/src/main/java/com/cemu_UI/controller/UpdateController.java @@ -149,7 +149,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 + Runtime.getRuntime().exec("java -jar cemu_UI.jar"); // start again TODO consider ProcessBuilder to execute System.exit(0); // finishes itself } catch (IOException e) { Platform.runLater(() -> { From 662188813b1cc4897934d56adcfbb3eee882858e Mon Sep 17 00:00:00 2001 From: Jannik Date: Sat, 24 Feb 2018 17:00:43 +0100 Subject: [PATCH 18/22] removed workaround for xPosHelper Bug --- .../java/com/cemu_UI/application/Main.java | 16 +++++++------- .../application/MainWindowController.java | 21 ++----------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/cemu_UI/application/Main.java b/src/main/java/com/cemu_UI/application/Main.java index 618ef02..2949436 100644 --- a/src/main/java/com/cemu_UI/application/Main.java +++ b/src/main/java/com/cemu_UI/application/Main.java @@ -166,7 +166,15 @@ public class Main extends Application { } } - // loading settings and initialize UI, dbController.main() loads all databases + // 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.dbController.init(); @@ -176,12 +184,6 @@ public class Main extends Application { cloudController.sync(mainWindowController.getCloudService(), mainWindowController.getCemuPath(), directory.getPath()); } - 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 } catch (IOException e) { e.printStackTrace(); } diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index b18723c..0efbe79 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -304,7 +304,7 @@ public class MainWindowController { private DirectoryChooser directoryChooser = new DirectoryChooser(); private ObservableList branches = FXCollections.observableArrayList("stable", "beta"); private ObservableList languages = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)"); - private ObservableList smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); // TODO add more IDs + private ObservableList smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); private ObservableList games = FXCollections.observableArrayList(); ObservableList courses = FXCollections.observableArrayList(); ObservableList filteredCourses = FXCollections.observableArrayList(); @@ -1539,18 +1539,7 @@ public class MainWindowController { * calculates how many games can be displayed in one row */ private void generatePosition() { - int xPosHelperMax; - - /**FIXME somehow the window width is set to 8, if we can find a way to get always the real window with - *(at the beginning we have to use prefWidth after resizing Width) we can remove this - *This is caused by the time the game objects are generates, - *it's before the window is opened so it's size is > 10 - */ - if (mainAnchorPane.getWidth() < 10) { - xPosHelperMax = (int) Math.floor((mainAnchorPane.getPrefWidth() - 36) / 217); - } else { - xPosHelperMax = (int) Math.floor((mainAnchorPane.getWidth() - 36) / 217); - } + int xPosHelperMax = (int) Math.floor((mainAnchorPane.getWidth() - 36) / 217); if(xPosHelper == xPosHelperMax){ oldXPosHelper = xPosHelper; @@ -1561,12 +1550,6 @@ public class MainWindowController { xPos = xPos + 217; xPosHelper++; } - -// System.out.println("Breit: " + main.pane.getWidth()); -// System.out.println("Breit2: " + mainAnchorPane.getWidth()); -// System.out.println("xPosHelper: " + xPosHelper); -// System.out.println("yPos: " + yPos); -// System.out.println("xPos: " + xPos); } // change the color of all needed GUI elements From 7813778502cc64d0b97029a537ecc6f41be5d7f7 Mon Sep 17 00:00:00 2001 From: Jannik Date: Thu, 22 Mar 2018 11:54:30 +0100 Subject: [PATCH 19/22] small cleanup --- pom.xml | 2 +- src/test/main/com/cemu_UI/test/AppTest.java | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 31e3b8e..511f9d4 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ com.jfoenix jfoenix - 9.0.2 + 9.0.3 diff --git a/src/test/main/com/cemu_UI/test/AppTest.java b/src/test/main/com/cemu_UI/test/AppTest.java index e59605b..feb266c 100644 --- a/src/test/main/com/cemu_UI/test/AppTest.java +++ b/src/test/main/com/cemu_UI/test/AppTest.java @@ -1,8 +1,5 @@ package com.cemu_UI.test; -import java.io.File; - -import junit.framework.Assert; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; From fcaffecabf89819c3712b1c3ecb5c7e9471e128c Mon Sep 17 00:00:00 2001 From: Jannik Date: Thu, 22 Mar 2018 18:54:56 +0100 Subject: [PATCH 20/22] text fix --- src/main/java/com/cemu_UI/controller/UpdateController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/cemu_UI/controller/UpdateController.java b/src/main/java/com/cemu_UI/controller/UpdateController.java index a68dd72..a20dd5e 100644 --- a/src/main/java/com/cemu_UI/controller/UpdateController.java +++ b/src/main/java/com/cemu_UI/controller/UpdateController.java @@ -59,8 +59,7 @@ public class UpdateController implements Runnable { private static final Logger LOGGER = LogManager.getLogger(UpdateController.class.getName()); /** - * updater for cemu_UI based on Project HomeFlix checks for Updates and download - * it in case there is one + * updater for cemu_UI, checks for Updates and download it */ public UpdateController(MainWindowController mwc, String buildNumber, boolean useBeta) { mainWindowController = mwc; From f9f63c0f3c2e7bbfb8b135b61af37cf21519313e Mon Sep 17 00:00:00 2001 From: Jannik Date: Thu, 5 Apr 2018 09:54:45 +0200 Subject: [PATCH 21/22] code cleanup --- .../java/com/cemu_UI/application/Main.java | 2 +- .../application/MainWindowController.java | 25 ++++++++++++++++--- .../com/cemu_UI/application/playGame.java | 8 +++--- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/cemu_UI/application/Main.java b/src/main/java/com/cemu_UI/application/Main.java index 2949436..309abff 100644 --- a/src/main/java/com/cemu_UI/application/Main.java +++ b/src/main/java/com/cemu_UI/application/Main.java @@ -176,7 +176,7 @@ public class Main extends Application { // init here as it loads the games to the mwc and the gui, therefore the window must exist mainWindowController.init(); - mainWindowController.dbController.init(); + mainWindowController.getDbController().init(); // if cloud sync is activated start sync if(mainWindowController.isCloudSync()) { diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index 0efbe79..2ccc68c 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -265,11 +265,15 @@ public class MainWindowController { @FXML private JFXTreeTableColumn timeColumn = new JFXTreeTableColumn<>("time"); + + private enum CloudService { + GoogleDrive, Dropbox + } - Main main; - DBController dbController; - SmmdbAPIController smmdbAPIController; - playGame playGame; + private Main main; + private DBController dbController; + private SmmdbAPIController smmdbAPIController; + private playGame playGame; private static MainWindowController MWC; private UpdateController updateController; private boolean menuTrue = false; @@ -1050,6 +1054,7 @@ public class MainWindowController { public void handle(ActionEvent event){ cloudSync = true; //TODO rework for other cloud services +// CloudService service = CloudService.GoogleDrive; cloudService = "GoogleDrive"; // start cloud sync in new thread @@ -1832,6 +1837,18 @@ public class MainWindowController { return resizedImage; } + public Main getMain() { + return main; + } + + public DBController getDbController() { + return dbController; + } + + public void setMainAnchorPane(AnchorPane mainAnchorPane) { + this.mainAnchorPane = mainAnchorPane; + } + public String getCemuPath() { return cemuPath; } diff --git a/src/main/java/com/cemu_UI/application/playGame.java b/src/main/java/com/cemu_UI/application/playGame.java index 7cfb24c..1a0ebfc 100644 --- a/src/main/java/com/cemu_UI/application/playGame.java +++ b/src/main/java/com/cemu_UI/application/playGame.java @@ -54,7 +54,7 @@ public class playGame extends Thread{ Process p; Platform.runLater(() -> { - mainWindowController.main.getPrimaryStage().setIconified(true); // minimize cemu_UI + mainWindowController.getMain().getPrimaryStage().setIconified(true); // minimize cemu_UI }); startTime = System.currentTimeMillis(); try { @@ -86,14 +86,14 @@ public class playGame extends Thread{ } else { mainWindowController.totalPlaytimeBtn.setText(dbController.getTotalPlaytime(selectedGameTitleID) + " min"); } - mainWindowController.main.getPrimaryStage().setIconified(false); // maximize cemu_UI + mainWindowController.getMain().getPrimaryStage().setIconified(false); // maximize cemu_UI }); //sync savegame with cloud service if (mainWindowController.isCloudSync()) { mainWindowController.setLastLocalSync(Instant.now().getEpochSecond()); - mainWindowController.main.getCloudController().sync(mainWindowController.getCloudService(), - mainWindowController.getCemuPath(), mainWindowController.main.getDirectory().getPath()); + mainWindowController.getMain().getCloudController().sync(mainWindowController.getCloudService(), + mainWindowController.getCemuPath(), mainWindowController.getMain().getDirectory().getPath()); } } catch (IOException | InterruptedException e) { From 1e7cea86ade5f609dc9d7b6d233b3ae027957eb1 Mon Sep 17 00:00:00 2001 From: Jannik Date: Sat, 28 Apr 2018 12:17:12 +0200 Subject: [PATCH 22/22] code cleanup * log4j 2.10.0 -> 2.11.0 --- pom.xml | 4 ++-- src/main/java/com/cemu_UI/application/Main.java | 3 +-- .../java/com/cemu_UI/application/MainWindowController.java | 6 +++--- src/main/java/com/cemu_UI/application/playGame.java | 3 +-- src/main/java/com/cemu_UI/controller/CloudController.java | 3 +-- src/main/java/com/cemu_UI/controller/DBController.java | 3 +-- .../java/com/cemu_UI/controller/SmmdbAPIController.java | 3 +-- src/main/java/com/cemu_UI/controller/UpdateController.java | 3 +-- .../java/com/cemu_UI/datatypes/CourseTableDataType.java | 3 +-- src/main/java/com/cemu_UI/datatypes/SmmdbApiDataType.java | 3 +-- src/main/java/com/cemu_UI/datatypes/UIROMDataType.java | 3 +-- src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java | 4 +--- src/main/java/com/cemu_UI/uiElements/JFXInfoDialog.java | 3 +-- .../java/com/cemu_UI/uiElements/JFXOkayCancelDialog.java | 4 +--- .../java/com/cemu_UI/uiElements/JFXTextAreaInfoDialog.java | 3 +-- .../vendorCloudController/GoogleDriveController.java | 3 +-- 16 files changed, 19 insertions(+), 35 deletions(-) diff --git a/pom.xml b/pom.xml index 511f9d4..95157e7 100644 --- a/pom.xml +++ b/pom.xml @@ -44,13 +44,13 @@ org.apache.logging.log4j log4j-api - 2.10.0 + 2.11.0 org.apache.logging.log4j log4j-core - 2.10.0 + 2.11.0 diff --git a/src/main/java/com/cemu_UI/application/Main.java b/src/main/java/com/cemu_UI/application/Main.java index 309abff..6879180 100644 --- a/src/main/java/com/cemu_UI/application/Main.java +++ b/src/main/java/com/cemu_UI/application/Main.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - package com.cemu_UI.application; import java.io.File; diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index 2ccc68c..3a90c41 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - package com.cemu_UI.application; import java.awt.Desktop; @@ -266,6 +265,7 @@ public class MainWindowController { @FXML private JFXTreeTableColumn timeColumn = new JFXTreeTableColumn<>("time"); + @SuppressWarnings("unused") private enum CloudService { GoogleDrive, Dropbox } @@ -295,7 +295,7 @@ public class MainWindowController { private String id; private String version = "0.3.0"; private String buildNumber = "077"; - private String versionName = "Puzzle Plank Galaxy"; + private String versionName = "Purple Comet"; private int xPos = -200; private int yPos = 17; private int xPosHelper; diff --git a/src/main/java/com/cemu_UI/application/playGame.java b/src/main/java/com/cemu_UI/application/playGame.java index 1a0ebfc..651504a 100644 --- a/src/main/java/com/cemu_UI/application/playGame.java +++ b/src/main/java/com/cemu_UI/application/playGame.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - package com.cemu_UI.application; import java.io.IOException; diff --git a/src/main/java/com/cemu_UI/controller/CloudController.java b/src/main/java/com/cemu_UI/controller/CloudController.java index 3358eb4..6e3f385 100644 --- a/src/main/java/com/cemu_UI/controller/CloudController.java +++ b/src/main/java/com/cemu_UI/controller/CloudController.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - package com.cemu_UI.controller; import java.io.File; diff --git a/src/main/java/com/cemu_UI/controller/DBController.java b/src/main/java/com/cemu_UI/controller/DBController.java index 9dae994..e4422c3 100644 --- a/src/main/java/com/cemu_UI/controller/DBController.java +++ b/src/main/java/com/cemu_UI/controller/DBController.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - package com.cemu_UI.controller; import java.awt.Graphics2D; diff --git a/src/main/java/com/cemu_UI/controller/SmmdbAPIController.java b/src/main/java/com/cemu_UI/controller/SmmdbAPIController.java index bf14b95..d683f83 100644 --- a/src/main/java/com/cemu_UI/controller/SmmdbAPIController.java +++ b/src/main/java/com/cemu_UI/controller/SmmdbAPIController.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - package com.cemu_UI.controller; import java.io.BufferedReader; diff --git a/src/main/java/com/cemu_UI/controller/UpdateController.java b/src/main/java/com/cemu_UI/controller/UpdateController.java index a20dd5e..d214505 100644 --- a/src/main/java/com/cemu_UI/controller/UpdateController.java +++ b/src/main/java/com/cemu_UI/controller/UpdateController.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - package com.cemu_UI.controller; import java.io.BufferedReader; diff --git a/src/main/java/com/cemu_UI/datatypes/CourseTableDataType.java b/src/main/java/com/cemu_UI/datatypes/CourseTableDataType.java index 81f2176..f1f79f1 100644 --- a/src/main/java/com/cemu_UI/datatypes/CourseTableDataType.java +++ b/src/main/java/com/cemu_UI/datatypes/CourseTableDataType.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - package com.cemu_UI.datatypes; import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject; diff --git a/src/main/java/com/cemu_UI/datatypes/SmmdbApiDataType.java b/src/main/java/com/cemu_UI/datatypes/SmmdbApiDataType.java index 8b79697..749fa3a 100644 --- a/src/main/java/com/cemu_UI/datatypes/SmmdbApiDataType.java +++ b/src/main/java/com/cemu_UI/datatypes/SmmdbApiDataType.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - package com.cemu_UI.datatypes; import javafx.beans.property.IntegerProperty; diff --git a/src/main/java/com/cemu_UI/datatypes/UIROMDataType.java b/src/main/java/com/cemu_UI/datatypes/UIROMDataType.java index 23a46f6..2a66c6e 100644 --- a/src/main/java/com/cemu_UI/datatypes/UIROMDataType.java +++ b/src/main/java/com/cemu_UI/datatypes/UIROMDataType.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - package com.cemu_UI.datatypes; import com.jfoenix.controls.JFXButton; diff --git a/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java b/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java index c5cdb67..0487b14 100644 --- a/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java +++ b/src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - - package com.cemu_UI.uiElements; import java.io.File; diff --git a/src/main/java/com/cemu_UI/uiElements/JFXInfoDialog.java b/src/main/java/com/cemu_UI/uiElements/JFXInfoDialog.java index 9c2b710..ee2513a 100644 --- a/src/main/java/com/cemu_UI/uiElements/JFXInfoDialog.java +++ b/src/main/java/com/cemu_UI/uiElements/JFXInfoDialog.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - package com.cemu_UI.uiElements; import com.jfoenix.controls.JFXButton; diff --git a/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelDialog.java b/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelDialog.java index 5dd4d1a..47d2ff8 100644 --- a/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelDialog.java +++ b/src/main/java/com/cemu_UI/uiElements/JFXOkayCancelDialog.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - - package com.cemu_UI.uiElements; import java.util.ResourceBundle; diff --git a/src/main/java/com/cemu_UI/uiElements/JFXTextAreaInfoDialog.java b/src/main/java/com/cemu_UI/uiElements/JFXTextAreaInfoDialog.java index fd8ff2f..2831162 100644 --- a/src/main/java/com/cemu_UI/uiElements/JFXTextAreaInfoDialog.java +++ b/src/main/java/com/cemu_UI/uiElements/JFXTextAreaInfoDialog.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - package com.cemu_UI.uiElements; import com.jfoenix.controls.JFXButton; diff --git a/src/main/java/com/cemu_UI/vendorCloudController/GoogleDriveController.java b/src/main/java/com/cemu_UI/vendorCloudController/GoogleDriveController.java index 485ceef..65289bf 100644 --- a/src/main/java/com/cemu_UI/vendorCloudController/GoogleDriveController.java +++ b/src/main/java/com/cemu_UI/vendorCloudController/GoogleDriveController.java @@ -1,7 +1,7 @@ /** * cemu_UI * - * Copyright 2017 <@Seil0> + * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - package com.cemu_UI.vendorCloudController; import java.io.FileOutputStream;