diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..f10021f --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1,3 @@ +/application/ +/recources/ +/cloudControllerInstances/ diff --git a/bin/application/CloudController$1.class b/bin/application/CloudController$1.class index 6f2d01d..6961e59 100644 Binary files a/bin/application/CloudController$1.class and b/bin/application/CloudController$1.class differ diff --git a/bin/application/CloudController$2.class b/bin/application/CloudController$2.class index 4346c23..01416ba 100644 Binary files a/bin/application/CloudController$2.class and b/bin/application/CloudController$2.class differ diff --git a/bin/application/CloudController$3.class b/bin/application/CloudController$3.class index bd2f32e..2132321 100644 Binary files a/bin/application/CloudController$3.class and b/bin/application/CloudController$3.class differ diff --git a/bin/application/CloudController.class b/bin/application/CloudController.class index 25752d1..ffeaede 100644 Binary files a/bin/application/CloudController.class and b/bin/application/CloudController.class differ diff --git a/bin/application/MainWindow.fxml b/bin/application/MainWindow.fxml index e167774..ca3010e 100644 --- a/bin/application/MainWindow.fxml +++ b/bin/application/MainWindow.fxml @@ -30,22 +30,27 @@ - + - + - + - + + + + + + @@ -53,7 +58,7 @@ - + + diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class index f75d553..b184e96 100644 Binary files a/bin/application/MainWindowController$1.class and b/bin/application/MainWindowController$1.class differ diff --git a/bin/application/MainWindowController$2.class b/bin/application/MainWindowController$2.class index c3ed65c..86927cb 100644 Binary files a/bin/application/MainWindowController$2.class and b/bin/application/MainWindowController$2.class differ diff --git a/bin/application/MainWindowController$3.class b/bin/application/MainWindowController$3.class index 64ba66a..67adbb6 100644 Binary files a/bin/application/MainWindowController$3.class and b/bin/application/MainWindowController$3.class differ diff --git a/bin/application/MainWindowController$4.class b/bin/application/MainWindowController$4.class index e961a9a..66a3642 100644 Binary files a/bin/application/MainWindowController$4.class and b/bin/application/MainWindowController$4.class differ diff --git a/bin/application/MainWindowController$5.class b/bin/application/MainWindowController$5.class index dcad738..5da9779 100644 Binary files a/bin/application/MainWindowController$5.class and b/bin/application/MainWindowController$5.class differ diff --git a/bin/application/MainWindowController$6.class b/bin/application/MainWindowController$6.class index fbc3933..134c71e 100644 Binary files a/bin/application/MainWindowController$6.class and b/bin/application/MainWindowController$6.class differ diff --git a/bin/application/MainWindowController$7.class b/bin/application/MainWindowController$7.class index aba4562..08b0699 100644 Binary files a/bin/application/MainWindowController$7.class and b/bin/application/MainWindowController$7.class differ diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class index 9582498..a53dc71 100644 Binary files a/bin/application/MainWindowController.class and b/bin/application/MainWindowController.class differ diff --git a/bin/application/dbController.class b/bin/application/dbController.class index f532e52..d116fcf 100644 Binary files a/bin/application/dbController.class and b/bin/application/dbController.class differ diff --git a/bin/cloudControllerInstances/GoogleDriveController.class b/bin/cloudControllerInstances/GoogleDriveController.class index bec2c32..22eace9 100644 Binary files a/bin/cloudControllerInstances/GoogleDriveController.class and b/bin/cloudControllerInstances/GoogleDriveController.class differ diff --git a/src/application/CloudController.java b/src/application/CloudController.java index fd84b71..82cd22b 100644 --- a/src/application/CloudController.java +++ b/src/application/CloudController.java @@ -30,21 +30,22 @@ public class CloudController { void initializeConnection(String cloudService, String cemuDirectory) { System.out.println("sartting cloud initialisation... "); - if(cloudService == "GoogleDrive") { + if(cloudService.equals("GoogleDrive")) { + System.out.println("selected service is Google Drive"); try { googleDriveController.main(cemuDirectory); } catch (IOException e) { e.printStackTrace(); } } - if(cloudService == "Dropbox") { - + if(cloudService.equals("Dropbox")) { + System.out.println("selected service is Dropbox"); } System.out.println("cloud initialisation done!"); } void stratupCheck(String cloudService, String cemuDirectory) { - if(cloudService == "GoogleDrive") { + if(cloudService.equals("GoogleDrive")) { System.out.println("starting startup check google drive..."); try { if (!googleDriveController.checkFolder()) { @@ -70,7 +71,7 @@ public class CloudController { e.printStackTrace(); } } - if(cloudService == "Dropbox") { + if(cloudService.equals("Dropbox")) { } } @@ -87,19 +88,20 @@ public class CloudController { }); System.out.println("starting sync in new thread..."); - if(cloudService == "GoogleDrive") { + if(cloudService.equals("GoogleDrive")) { try { googleDriveController.sync(cemuDirectory); } catch (IOException e) { e.printStackTrace(); } } - if(cloudService == "Dropbox") { + if(cloudService.equals("Dropbox")) { } Platform.runLater(() -> { main.mainWindowController.getPlayBtn().setText("play"); }); + main.mainWindowController.saveSettings(); System.out.println("sync finished!"); } }); @@ -114,14 +116,14 @@ public class CloudController { public void run() { System.out.println("starting uploadFile in new thread..."); - if(cloudService == "GoogleDrive") { + if(cloudService.equals("GoogleDrive")) { try { googleDriveController.uploadFile(file); } catch (IOException e) { e.printStackTrace(); } } - if(cloudService == "Dropbox") { + if(cloudService.equals("Dropbox")) { } } @@ -129,26 +131,22 @@ public class CloudController { } -// void download(String cloudService) { -// -// } - public String getFolderID(String cloudService) { String folderID = ""; - if(cloudService == "GoogleDrive") { + if(cloudService.equals("GoogleDrive")) { folderID = googleDriveController.getFolderID(); } - if(cloudService == "Dropbox") { + if(cloudService.equals("Dropbox")) { } return folderID; } public void setFolderID(String folderID, String cloudService) { - if(cloudService == "GoogleDrive") { + if(cloudService.equals("GoogleDrive")) { googleDriveController.setFolderID(folderID); } - if(cloudService == "Dropbox") { + if(cloudService.equals("Dropbox")) { } } diff --git a/src/application/MainWindow.fxml b/src/application/MainWindow.fxml index e167774..ca3010e 100644 --- a/src/application/MainWindow.fxml +++ b/src/application/MainWindow.fxml @@ -30,22 +30,27 @@ - + - + - + - + + + + + + @@ -53,7 +58,7 @@ - + + diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java index 04b59e2..910e5d3 100644 --- a/src/application/MainWindowController.java +++ b/src/application/MainWindowController.java @@ -27,6 +27,7 @@ import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Optional; import java.util.Properties; + import javax.imageio.ImageIO; import org.apache.commons.io.FileUtils; @@ -37,6 +38,7 @@ import com.jfoenix.controls.JFXHamburger; import com.jfoenix.controls.JFXTextField; import com.jfoenix.controls.JFXToggleButton; import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition; + import javafx.animation.FadeTransition; import javafx.animation.ParallelTransition; import javafx.animation.TranslateTransition; @@ -82,6 +84,9 @@ public class MainWindowController { @FXML private JFXButton reloadRomsBtn; + @FXML + private JFXButton smmdbBtn; + @FXML private JFXButton cemuTFBtn; @@ -118,6 +123,9 @@ public class MainWindowController { @FXML private AnchorPane settingsAnchorPane; + @FXML + private AnchorPane smmdbAnchorPane; + @FXML private AnchorPane gamesAnchorPane; @@ -138,7 +146,7 @@ public class MainWindowController { private boolean playTrue = false; private boolean fullscreen; private boolean cloudSync; - private String cloudService = "GoogleDrive"; //set cloud provider (at the moment only GoogleDrive, Dropbox is planed) + private String cloudService; //set cloud provider (at the moment only GoogleDrive, Dropbox is planed) private String cemuPath; private String romPath; private String gameExecutePath; @@ -146,7 +154,7 @@ public class MainWindowController { private String selectedGameTitle; private String color; private String version = "0.1.5"; - private String buildNumber = "015"; + private String buildNumber = "017"; private String versionName = "Gusty Garden"; private int xPos = -200; private int yPos = 17; @@ -173,10 +181,12 @@ public class MainWindowController { private ImageView info_black = new ImageView(new Image("recources/icons/ic_info_black_24dp_1x.png")); private ImageView settings_black = new ImageView(new Image("recources/icons/ic_settings_black_24dp_1x.png")); private ImageView cached_black = new ImageView(new Image("recources/icons/ic_cached_black_24dp_1x.png")); + private ImageView smmdb_black = new ImageView(new Image("recources/icons/ic_get_app_black_24dp_1x.png")); private ImageView add_circle_white = new ImageView(new Image("recources/icons/ic_add_circle_white_24dp_1x.png")); private ImageView info_white = new ImageView(new Image("recources/icons/ic_info_white_24dp_1x.png")); private ImageView settings_white = new ImageView(new Image("recources/icons/ic_settings_white_24dp_1x.png")); private ImageView cached_white = new ImageView(new Image("recources/icons/ic_cached_white_24dp_1x.png")); + private ImageView smmdb_white = new ImageView(new Image("recources/icons/ic_get_app_white_24dp_1x.png")); public void setMain(Main main) { this.main = main; @@ -190,6 +200,7 @@ public class MainWindowController { fullscreenToggleBtn.setSelected(isFullscreen()); cloudSyncToggleBtn.setSelected(isCloudSync()); edit.setDisable(true); + smmdbBtn.setDisable(true); applyColor(); } @@ -457,6 +468,11 @@ public class MainWindowController { System.exit(0); //finishes itself } + @FXML + void smmdbBtnAction() { + System.out.println("yeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeehaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + } + @FXML void playBtnAction(ActionEvent event) throws InterruptedException, IOException{ dbController.setLastPlayed(selectedGameTitleID); @@ -516,13 +532,13 @@ public class MainWindowController { @FXML void cemuTextFieldAction(ActionEvent event){ setCemuPath(cemuTextField.getText()); - saveSettings();//TODO remove (only save on exit settings) + saveSettings(); } @FXML void romTextFieldAction(ActionEvent event){ setRomPath(romTextField.getText()); - saveSettings();//TODO remove (only save on exit settings) + saveSettings(); } @FXML @@ -532,7 +548,7 @@ public class MainWindowController { }else{ fullscreen = true; } - saveSettings();//TODO remove (only save on exit settings) + saveSettings(); } @FXML @@ -548,6 +564,8 @@ public class MainWindowController { Optional coverResult = cloudWarningAlert.showAndWait(); if (coverResult.get() == ButtonType.OK){ cloudSync = true; + //TODO rework for other cloud services + cloudService = "GoogleDrive"; main.cloudController.initializeConnection(getCloudService(), getCemuPath()); main.cloudController.sync(getCloudService(), getCemuPath()); } else { @@ -555,7 +573,7 @@ public class MainWindowController { } } - saveSettings();//TODO remove (only save on exit settings) + saveSettings(); } @FXML @@ -666,11 +684,19 @@ public class MainWindowController { dbController.loadSingleRom(titleID); } catch (SQLException e) { // Auto-generated catch block + System.out.println("Oops, something went wrong! Error during adding a game."); e.printStackTrace(); } } } + /** + * add game to the program and initialize all needed actions (start, time stamps, titleID) + * @param title : game title + * @param coverPath : path to cover (cache) + * @param romPath : path to rom file (.rpx) + * @param titleID : rom ID + */ void addGame(String title, String coverPath, String romPath, String titleID){ ImageView imageView = new ImageView(); Label gameTitleLabel = new Label(title); @@ -698,6 +724,7 @@ public class MainWindowController { public void handle(MouseEvent event) { System.out.println("selected: "+title+"; ID: "+titleID); + //getting the selected game index by comparing event.getSource() with games.get(i).getButton() for(int i=0; i"); } @@ -141,7 +141,7 @@ public class dbController { } //load all rom's on startup to the UI - void loadRoms(){ + void loadAllRoms(){ System.out.println("loading all rom's on startup to mwc ..."); try { Statement stmt = connection.createStatement(); diff --git a/src/cloudControllerInstances/GoogleDriveController.java b/src/cloudControllerInstances/GoogleDriveController.java index 81dc622..6c7e30d 100644 --- a/src/cloudControllerInstances/GoogleDriveController.java +++ b/src/cloudControllerInstances/GoogleDriveController.java @@ -110,6 +110,10 @@ public class GoogleDriveController { } public void sync(String cemuDirectory) throws IOException { + //in case there is no folderID saved, look it up first + if (getFolderID() == "" || getFolderID() == null) { + getSavegamesFolderID(); + } getLocalSavegames(); getCloudSavegames(); @@ -205,7 +209,21 @@ public class GoogleDriveController { cloudSavegamesName.add(file.getName()); cloudSavegames.add(file); } - } + } + + private void getSavegamesFolderID() throws IOException { + Files.List request = service.files().list().setQ("mimeType = 'application/vnd.google-apps.folder' and name = 'cemu_savegames'"); + FileList files = request.execute(); + + try { + System.out.println("FolderID: " + files.getFiles().get(0).getId()); + setFolderID(files.getFiles().get(0).getId()); + } catch (Exception e) { + System.out.println("Oops, something went wrong! It seems that you have more than one folder called 'cemu_savegames'!"); + e.printStackTrace(); + } + } + //upload a file to the cloud from the local savegames folder public void uploadFile(java.io.File uploadFile) throws IOException{ @@ -261,6 +279,7 @@ public class GoogleDriveController { System.out.println("finished uploading all files!"); } catch (IOException e) { //Auto-generated catch block + System.out.println("Oops, there went something wrong! Error during uploading all files."); e.printStackTrace(); } } diff --git a/src/recources/icons/ic_get_app_black_24dp_1x.png b/src/recources/icons/ic_get_app_black_24dp_1x.png new file mode 100644 index 0000000..c2c845e Binary files /dev/null and b/src/recources/icons/ic_get_app_black_24dp_1x.png differ diff --git a/src/recources/icons/ic_get_app_white_24dp_1x.png b/src/recources/icons/ic_get_app_white_24dp_1x.png new file mode 100644 index 0000000..d400472 Binary files /dev/null and b/src/recources/icons/ic_get_app_white_24dp_1x.png differ