cloud/google drive integration part 3

sync and upload are now running in its own thread, this will speedup
start
This commit is contained in:
Seil0 2017-05-01 16:46:00 +02:00
parent 5ddc0d2d56
commit bd81cca0a7
14 changed files with 47 additions and 31 deletions

1
bin/.gitignore vendored
View File

@ -1,2 +1 @@
/cloudControllerInstances/
/application/ /application/

Binary file not shown.

View File

@ -10,7 +10,6 @@
* you can buy me a chocolate in return. - @Seil0 * you can buy me a chocolate in return. - @Seil0
* (license based in Beer-ware, see https://fedoraproject.org/wiki/Licensing/Beerware ) * (license based in Beer-ware, see https://fedoraproject.org/wiki/Licensing/Beerware )
* *
* TODO own thread
*/ */
package application; package application;
@ -45,6 +44,12 @@ public class CloudController {
} }
void sync(String cloudService, String cemuDirectory) { void sync(String cloudService, String cemuDirectory) {
//running sync in a new thread, instead of blocking the main thread
new Thread() {
public void run() {
System.out.println("starting sync in new thread...");
if(cloudService == "GoogleDrive") { if(cloudService == "GoogleDrive") {
try { try {
googleDriveController.sync(cemuDirectory); googleDriveController.sync(cemuDirectory);
@ -56,8 +61,17 @@ public class CloudController {
} }
} }
}.start();
}
void uploadFile(String cloudService, File file) { void uploadFile(String cloudService, File file) {
//running uploadFile in a new thread, instead of blocking the main thread
new Thread() {
public void run() {
System.out.println("starting uploadFile in new thread...");
if(cloudService == "GoogleDrive") { if(cloudService == "GoogleDrive") {
try { try {
googleDriveController.uploadFile(file); googleDriveController.uploadFile(file);
@ -69,11 +83,14 @@ public class CloudController {
} }
} }
}.start();
void download(String cloudService) {
} }
// void download(String cloudService) {
//
// }
public String getFolderID(String cloudService) { public String getFolderID(String cloudService) {
String folderID = ""; String folderID = "";
if(cloudService == "GoogleDrive") { if(cloudService == "GoogleDrive") {

View File

@ -20,6 +20,7 @@ import java.net.URL;
import java.nio.channels.Channels; import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel; import java.nio.channels.ReadableByteChannel;
import java.util.Optional; import java.util.Optional;
import javafx.application.Application; import javafx.application.Application;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.stage.DirectoryChooser; import javafx.stage.DirectoryChooser;
@ -81,8 +82,8 @@ public class Main extends Application {
} }
//startup checks //startup checks
System.out.println(directory.exists()); System.out.println("Directory: " + directory.exists());
System.out.println(configFile.exists()); System.out.println("configfile: " + configFile.exists());
if(directory.exists() != true){ if(directory.exists() != true){
System.out.println("mkdir all"); System.out.println("mkdir all");
directory.mkdir(); directory.mkdir();

View File

@ -145,10 +145,9 @@ public class MainWindowController {
private String selectedGameTitleID; private String selectedGameTitleID;
private String selectedGameTitle; private String selectedGameTitle;
private String color; private String color;
private String version = "0.1.4"; private String version = "0.1.5";
private String buildNumber = "007"; private String buildNumber = "010";
@SuppressWarnings("unused") private String versionName = "Gusty Garden";
private String versionName = "";
private int xPos = -200; private int xPos = -200;
private int yPos = 17; private int yPos = 17;
private int xPosHelper; private int xPosHelper;
@ -433,7 +432,7 @@ public class MainWindowController {
Alert alert = new Alert(AlertType.INFORMATION); Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("about"); alert.setTitle("about");
alert.setHeaderText("cemu_UI"); alert.setHeaderText("cemu_UI");
alert.setContentText("cemu_UI by @Seil0 \npre release "+version+" ("+buildNumber+") \nwww.kellerkinder.xyz"); alert.setContentText("cemu_UI by @Seil0 \nVersion: "+version+" ("+buildNumber+") \""+versionName+"\" \nwww.kellerkinder.xyz");
alert.initOwner(main.primaryStage); alert.initOwner(main.primaryStage);
alert.showAndWait(); alert.showAndWait();
} }