Browse Source

updated some libs, code clean up

* openjfx 11 -> 11.0.1
* jfoenix 9.0.6 -> 9.0.8
* sqlite-jdbc 3.23.2 -> 3.25.2
* google-api-services-drive rev129 -> rev136
* jackson-core 2.9.6 -> 2.9.7
pull/7/head
Jannik 4 years ago
parent
commit
3f6eeece7d
  1. 62
      pom.xml
  2. 193
      src/main/java/com/cemu_UI/application/MainWindowController.java
  3. 47
      src/main/java/com/cemu_UI/controller/CloudController.java
  4. 29
      src/main/java/com/cemu_UI/datatypes/GlobalDataTypes.java

62
pom.xml

@ -5,7 +5,7 @@
<groupId>com</groupId>
<artifactId>cemu_UI</artifactId>
<version>0.3.1-SNAPSHOT</version>
<version>0.3.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>cemu_UI</name>
<description>cemu_UI is a simple, material design graphical frontend for cemu, a Wii U emulator</description>
@ -27,25 +27,25 @@
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
<version>11.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11</version>
<version>11.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>11</version>
<version>11.0.1</version>
</dependency>
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>9.0.6</version>
<version>9.0.8</version>
</dependency>
<dependency>
@ -57,7 +57,7 @@
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.23.1</version>
<version>3.25.2</version>
</dependency>
<dependency>
@ -92,14 +92,6 @@
<version>1.11</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.datafx/flow -->
<dependency>
<groupId>io.datafx</groupId>
<artifactId>flow</artifactId>
<version>8.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.lingala.zip4j/zip4j -->
<dependency>
<groupId>net.lingala.zip4j</groupId>
@ -115,18 +107,11 @@
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.api-client/google-api-client -->
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.25.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.apis/google-api-services-drive -->
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
<version>v3-rev129-1.25.0</version>
<version>v3-rev136-1.25.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.http-client/google-http-client -->
@ -143,20 +128,6 @@
<version>1.25.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client -->
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client</artifactId>
<version>1.25.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-java6 -->
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-java6</artifactId>
<version>1.25.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-jetty -->
<dependency>
<groupId>com.google.oauth-client</groupId>
@ -168,15 +139,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
<version>2.9.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mortbay.jetty/jetty -->
@ -186,13 +149,6 @@
<version>6.1.26</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mortbay.jetty/jetty-util -->
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>6.1.26</version>
</dependency>
</dependencies>
<build>
@ -229,7 +185,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>

193
src/main/java/com/cemu_UI/application/MainWindowController.java

@ -57,6 +57,7 @@ import com.cemu_UI.controller.DBController;
import com.cemu_UI.controller.SmmdbAPIController;
import com.cemu_UI.controller.UpdateController;
import com.cemu_UI.datatypes.CourseTableDataType;
import com.cemu_UI.datatypes.GlobalDataTypes.CloudService;
import com.cemu_UI.datatypes.SmmdbApiDataType;
import com.cemu_UI.datatypes.UIROMDataType;
import com.cemu_UI.uiElements.JFXEditGameDialog;
@ -109,130 +110,73 @@ import net.lingala.zip4j.exception.ZipException;
public class MainWindowController {
@FXML
private JFXButton aboutBtn;
@FXML
private JFXButton settingsBtn;
@FXML
private JFXButton addBtn;
@FXML
private JFXButton reloadRomsBtn;
@FXML
private JFXButton smmdbBtn;
@FXML
private JFXButton cemuTFBtn;
@FXML
private JFXButton romTFBtn;
@FXML
private JFXButton updateBtn;
@FXML
private JFXButton smmdbDownloadBtn;
@FXML
private JFXButton playBtn;
@FXML
private JFXButton lastTimePlayedBtn;
@FXML
JFXButton totalPlaytimeBtn;
@FXML
private JFXHamburger menuHam;
@FXML
private JFXTextField cemuTextField;
@FXML
private JFXTextField romTextField;
@FXML
private JFXTextField courseSearchTextFiled;
@FXML
private JFXTextField executeCommandTextFiled;
@FXML private JFXButton aboutBtn;
@FXML private JFXButton settingsBtn;
@FXML private JFXButton addBtn;
@FXML private JFXButton reloadRomsBtn;
@FXML private JFXButton smmdbBtn;
@FXML private JFXButton cemuTFBtn;
@FXML private JFXButton romTFBtn;
@FXML private JFXButton updateBtn;
@FXML private JFXButton smmdbDownloadBtn;
@FXML private JFXButton playBtn;
@FXML private JFXButton lastTimePlayedBtn;
@FXML JFXButton totalPlaytimeBtn;
@FXML private JFXHamburger menuHam;
@FXML private JFXTextField cemuTextField;
@FXML private JFXTextField romTextField;
@FXML private JFXTextField courseSearchTextFiled;
@FXML private JFXTextField executeCommandTextFiled;
@FXML
private TextFlow smmdbTextFlow;
@FXML private TextFlow smmdbTextFlow;
@FXML
private JFXColorPicker colorPicker;
@FXML private JFXColorPicker colorPicker;
@FXML
private JFXToggleButton cloudSyncToggleBtn;
@FXML
private JFXToggleButton autoUpdateToggleBtn;
@FXML
private JFXToggleButton fullscreenToggleBtn;
@FXML private JFXToggleButton cloudSyncToggleBtn;
@FXML private JFXToggleButton autoUpdateToggleBtn;
@FXML private JFXToggleButton fullscreenToggleBtn;
@FXML
private ChoiceBox<String> languageChoisBox;
@FXML
private ChoiceBox<String> branchChoisBox;
@FXML private ChoiceBox<String> languageChoisBox;
@FXML private ChoiceBox<String> branchChoisBox;
@FXML
private AnchorPane mainAnchorPane;
@FXML
private AnchorPane gamesAnchorPane;
@FXML
private AnchorPane settingsAnchorPane;
@FXML
private AnchorPane smmdbAnchorPane;
@FXML private AnchorPane mainAnchorPane;
@FXML private AnchorPane gamesAnchorPane;
@FXML private AnchorPane settingsAnchorPane;
@FXML private AnchorPane smmdbAnchorPane;
@FXML
private ScrollPane mainScrollPane;
@FXML
private ScrollPane settingsScrollPane;
@FXML
private ScrollPane smmdbScrollPane;
@FXML
private ScrollPane smmdbImageViewScrollPane;
@FXML private ScrollPane mainScrollPane;
@FXML private ScrollPane settingsScrollPane;
@FXML private ScrollPane smmdbScrollPane;
@FXML private ScrollPane smmdbImageViewScrollPane;
@FXML
private VBox sideMenuVBox;
@FXML private VBox sideMenuVBox;
@FXML
private HBox topHBox;
@FXML
private HBox bottomHBox;
@FXML private HBox topHBox;
@FXML private HBox bottomHBox;
@FXML
private ImageView smmdbImageView;
@FXML private ImageView smmdbImageView;
@FXML
private Label helpLbl;
@FXML
private Label cemu_UISettingsLbl;
@FXML
private Label cemuDirectoryLbl;
@FXML
private Label romDirectoryLbl;
@FXML
private Label mainColorLbl;
@FXML
private Label languageLbl;
@FXML
private Label updateLbl;
@FXML
private Label branchLbl;
@FXML
private Label cemuSettingsLbl;
@FXML
private Label licensesLbl;
@FXML private Label helpLbl;
@FXML private Label cemu_UISettingsLbl;
@FXML private Label cemuDirectoryLbl;
@FXML private Label romDirectoryLbl;
@FXML private Label mainColorLbl;
@FXML private Label languageLbl;
@FXML private Label updateLbl;
@FXML private Label branchLbl;
@FXML private Label cemuSettingsLbl;
@FXML private Label licensesLbl;
@FXML
private JFXTreeTableView<CourseTableDataType> courseTreeTable = new JFXTreeTableView<CourseTableDataType>();
@FXML private JFXTreeTableView<CourseTableDataType> courseTreeTable = new JFXTreeTableView<CourseTableDataType>();
@FXML
private TreeItem<CourseTableDataType> root = new TreeItem<>(new CourseTableDataType("", "", 0, 0));
@FXML private TreeItem<CourseTableDataType> root = new TreeItem<>(new CourseTableDataType("", "", 0, 0));
@FXML
private JFXTreeTableColumn<CourseTableDataType, String> titleColumn = new JFXTreeTableColumn<>("title");
@FXML
private JFXTreeTableColumn<CourseTableDataType, String> idColumn = new JFXTreeTableColumn<>("id");
@FXML
private JFXTreeTableColumn<CourseTableDataType, Integer> starsColumn = new JFXTreeTableColumn<>("stars");
@FXML
private JFXTreeTableColumn<CourseTableDataType, Integer> timeColumn = new JFXTreeTableColumn<>("time");
@SuppressWarnings("unused")
private enum CloudService {
GoogleDrive, Dropbox
}
@FXML private JFXTreeTableColumn<CourseTableDataType, String> titleColumn = new JFXTreeTableColumn<>("title");
@FXML private JFXTreeTableColumn<CourseTableDataType, String> idColumn = new JFXTreeTableColumn<>("id");
@FXML private JFXTreeTableColumn<CourseTableDataType, Integer> starsColumn = new JFXTreeTableColumn<>("stars");
@FXML private JFXTreeTableColumn<CourseTableDataType, Integer> timeColumn = new JFXTreeTableColumn<>("time");
private Main main;
private DBController dbController;
@ -248,7 +192,7 @@ public class MainWindowController {
private boolean useBeta = false;
private boolean fullscreen;
private boolean cloudSync;
private String cloudService = ""; // set cloud provider (at the moment only GoogleDrive, Dropbox is planed)
private CloudService cloudService;
private String cemuPath;
private String romDirectoryPath;
private String gameExecutePath;
@ -257,8 +201,8 @@ public class MainWindowController {
private String selectedGameTitleID;
private String selectedGameTitle;
private String id;
private String version = "0.3.1";
private String buildNumber = "081";
private String version = "0.3.2";
private String buildNumber = "085";
private String versionName = "Purple Comet";
private int xPos = -200;
private int yPos = 17;
@ -1020,7 +964,7 @@ public class MainWindowController {
cloudSync = true;
//TODO rework for other cloud services
// CloudService service = CloudService.GoogleDrive;
cloudService = "GoogleDrive";
cloudService = CloudService.GoogleDrive;
// start cloud sync in new thread
Thread thread = new Thread(new Runnable() {
@ -1606,7 +1550,7 @@ public class MainWindowController {
if (getCloudService() == null) {
props.setProperty("cloudService", "");
} else {
props.setProperty("cloudService", getCloudService());
props.setProperty("cloudService", getCloudService().toString());
}
props.setProperty("folderID", main.getCloudController().getFolderID(getCloudService()));
props.setProperty("lastLocalSync", String.valueOf(getLastLocalSync()));
@ -1689,10 +1633,19 @@ public class MainWindowController {
}
try {
setCloudService(props.getProperty("cloudService"));
switch (props.getProperty("cloudService")) {
case "GoogleDrive":
setCloudService(CloudService.GoogleDrive);
break;
case "Dropbox":
setCloudService(CloudService.Dropbox);
break;
default:
break;
}
} catch (Exception e) {
LOGGER.error("could not load cloudSync", e);
setCloudService("");
setCloudService(null);
}
try {
@ -1920,11 +1873,11 @@ public class MainWindowController {
this.selectedGameTitleID = selectedGameTitleID;
}
public String getCloudService() {
public CloudService getCloudService() {
return cloudService;
}
public void setCloudService(String cloudService) {
public void setCloudService(CloudService cloudService) {
this.cloudService = cloudService;
}

47
src/main/java/com/cemu_UI/controller/CloudController.java

@ -32,6 +32,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.cemu_UI.application.MainWindowController;
import com.cemu_UI.datatypes.GlobalDataTypes.CloudService;
import com.cemu_UI.vendorCloudController.GoogleDriveController;
import javafx.application.Platform;
@ -48,11 +49,11 @@ public class CloudController {
private GoogleDriveController googleDriveController = new GoogleDriveController();
private static final Logger LOGGER = LogManager.getLogger(CloudController.class.getName());
public boolean initializeConnection(String cloudService, String cemuDirectory) {
public boolean initializeConnection(CloudService cloudService, String cemuDirectory) {
boolean success = false;
LOGGER.info("sartting cloud initialisation ...");
if(cloudService.equals("GoogleDrive")) {
if(cloudService == CloudService.GoogleDrive) {
LOGGER.info("selected service is Google Drive");
try {
googleDriveController.main(cemuDirectory);
@ -63,7 +64,7 @@ public class CloudController {
success = true;
}
if(cloudService.equals("Dropbox")) {
if(cloudService == CloudService.Dropbox) {
LOGGER.info("selected service is Dropbox");
}
LOGGER.info("cloud initialisation done!");
@ -76,7 +77,7 @@ public class CloudController {
* @param cemuDirectory
* @param cemu_UIDirectory
*/
public void sync(String cloudService, String cemuDirectory, String cemu_UIDirectory) {
public void sync(CloudService cloudService, String cemuDirectory, String cemu_UIDirectory) {
// running sync in a new thread, instead of blocking the main thread
Thread thread = new Thread(new Runnable() {
@ -88,18 +89,18 @@ public class CloudController {
mwc.getPlayBtn().setText("syncing...");
});
LOGGER.info("starting synchronization in new thread ...");
// zip the saves folder
File zipFile = zipSavegames(cemu_UIDirectory, cemuDirectory);
// upload the zip
switch (cloudService) {
// use GoogleDriveController
case "GoogleDrive":
case GoogleDrive:
LOGGER.info("using GoogleDriveController");
long lastCloudSync = googleDriveController.getLastCloudSync();
if (!googleDriveController.checkFolder()) {
LOGGER.info("cloud sync folder dosen't exist, creating one!");
googleDriveController.creatFolder();
@ -107,7 +108,7 @@ public class CloudController {
} else if (mwc.getLastLocalSync() > lastCloudSync) {
LOGGER.info("local is new, going to upload zip");
googleDriveController.uploadZipFile(zipFile);
} else if(mwc.getLastLocalSync() < lastCloudSync) {
} else if (mwc.getLastLocalSync() < lastCloudSync) {
LOGGER.info("cloud is new, going to download zip");
unzipSavegames(cemuDirectory, googleDriveController.downloadZipFile(cemu_UIDirectory));
mwc.setLastLocalSync(lastCloudSync);
@ -116,21 +117,18 @@ public class CloudController {
LOGGER.info("nothing to do");
break;
}
mwc.setLastLocalSync(Long.parseLong(zipFile.getName().substring(0, zipFile.getName().length()-4))); // set time of last sucessfull sync
mwc.setLastLocalSync(Long.parseLong(zipFile.getName().substring(0, zipFile.getName().length() - 4))); // set time of last sucessfull sync
break;
case "Dropbox":
case Dropbox:
// do the thing
break;
default:
LOGGER.warn("no cloud vendor found!");
break;
}
zipFile.delete(); // delete zipfile in cem_UI directory
Platform.runLater(() -> {
@ -138,11 +136,12 @@ public class CloudController {
mwc.getPlayBtn().setDisable(false);
mwc.saveSettings();
});
LOGGER.info("synchronization successful!");
} catch (Exception e) {
LOGGER.error("There was an error during syncronisation! Please open a new issue on the cemu_UI github page:", e);
LOGGER.error(
"There was an error during syncronisation! Please open a new issue on the cemu_UI github page:",
e);
}
}
});
@ -199,25 +198,25 @@ public class CloudController {
}
}
public String getFolderID(String cloudService) {
public String getFolderID(CloudService cloudService) {
String folderID = "";
if (cloudService != null) {
if (cloudService.equals("GoogleDrive")) {
if (cloudService == CloudService.GoogleDrive) {
folderID = googleDriveController.getFolderID();
}
if (cloudService.equals("Dropbox")) {
if (cloudService == CloudService.Dropbox) {
}
}
return folderID;
}
public void setFolderID(String folderID, String cloudService) {
public void setFolderID(String folderID, CloudService cloudService) {
if (cloudService != null) {
if (cloudService.equals("GoogleDrive")) {
if (cloudService == CloudService.GoogleDrive) {
googleDriveController.setFolderID(folderID);
}
if (cloudService.equals("Dropbox")) {
if (cloudService == CloudService.Dropbox) {
}
}

29
src/main/java/com/cemu_UI/datatypes/GlobalDataTypes.java

@ -0,0 +1,29 @@
/**
* cemu_UI
*
* Copyright 2017-2018 <@Seil0>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package com.cemu_UI.datatypes;
public class GlobalDataTypes {
public enum CloudService {
GoogleDrive, Dropbox
}
}
Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close