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
View File
@@ -1,2 +1 @@
/cloudControllerInstances/
/application/
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+38 -21
View File
@@ -10,7 +10,6 @@
* you can buy me a chocolate in return. - @Seil0
* (license based in Beer-ware, see https://fedoraproject.org/wiki/Licensing/Beerware )
*
* TODO own thread
*/
package application;
@@ -45,35 +44,53 @@ public class CloudController {
}
void sync(String cloudService, String cemuDirectory) {
if(cloudService == "GoogleDrive") {
try {
googleDriveController.sync(cemuDirectory);
} catch (IOException e) {
e.printStackTrace();
}
}
if(cloudService == "Dropbox") {
}
//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") {
try {
googleDriveController.sync(cemuDirectory);
} catch (IOException e) {
e.printStackTrace();
}
}
if(cloudService == "Dropbox") {
}
}
}.start();
}
void uploadFile(String cloudService, File file) {
if(cloudService == "GoogleDrive") {
try {
googleDriveController.uploadFile(file);
} catch (IOException e) {
e.printStackTrace();
}
}
if(cloudService == "Dropbox") {
}
}
//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...");
void download(String cloudService) {
if(cloudService == "GoogleDrive") {
try {
googleDriveController.uploadFile(file);
} catch (IOException e) {
e.printStackTrace();
}
}
if(cloudService == "Dropbox") {
}
}
}.start();
}
// void download(String cloudService) {
//
// }
public String getFolderID(String cloudService) {
String folderID = "";
if(cloudService == "GoogleDrive") {
+3 -2
View File
@@ -20,6 +20,7 @@ import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.util.Optional;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.stage.DirectoryChooser;
@@ -81,8 +82,8 @@ public class Main extends Application {
}
//startup checks
System.out.println(directory.exists());
System.out.println(configFile.exists());
System.out.println("Directory: " + directory.exists());
System.out.println("configfile: " + configFile.exists());
if(directory.exists() != true){
System.out.println("mkdir all");
directory.mkdir();
+4 -5
View File
@@ -145,10 +145,9 @@ public class MainWindowController {
private String selectedGameTitleID;
private String selectedGameTitle;
private String color;
private String version = "0.1.4";
private String buildNumber = "007";
@SuppressWarnings("unused")
private String versionName = "";
private String version = "0.1.5";
private String buildNumber = "010";
private String versionName = "Gusty Garden";
private int xPos = -200;
private int yPos = 17;
private int xPosHelper;
@@ -433,7 +432,7 @@ public class MainWindowController {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("about");
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.showAndWait();
}