code cleanup

This commit is contained in:
Jannik 2018-04-05 09:54:45 +02:00
parent 7813778502
commit f9f63c0f3c
3 changed files with 26 additions and 9 deletions

View File

@ -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()) {

View File

@ -266,10 +266,14 @@ public class MainWindowController {
@FXML
private JFXTreeTableColumn<CourseTableDataType, Integer> timeColumn = new JFXTreeTableColumn<>("time");
Main main;
DBController dbController;
SmmdbAPIController smmdbAPIController;
playGame playGame;
private enum CloudService {
GoogleDrive, Dropbox
}
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;
}

View File

@ -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) {