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 // init here as it loads the games to the mwc and the gui, therefore the window must exist
mainWindowController.init(); mainWindowController.init();
mainWindowController.dbController.init(); mainWindowController.getDbController().init();
// if cloud sync is activated start sync // if cloud sync is activated start sync
if(mainWindowController.isCloudSync()) { if(mainWindowController.isCloudSync()) {

View File

@ -265,11 +265,15 @@ public class MainWindowController {
@FXML @FXML
private JFXTreeTableColumn<CourseTableDataType, Integer> timeColumn = new JFXTreeTableColumn<>("time"); private JFXTreeTableColumn<CourseTableDataType, Integer> timeColumn = new JFXTreeTableColumn<>("time");
private enum CloudService {
GoogleDrive, Dropbox
}
Main main; private Main main;
DBController dbController; private DBController dbController;
SmmdbAPIController smmdbAPIController; private SmmdbAPIController smmdbAPIController;
playGame playGame; private playGame playGame;
private static MainWindowController MWC; private static MainWindowController MWC;
private UpdateController updateController; private UpdateController updateController;
private boolean menuTrue = false; private boolean menuTrue = false;
@ -1050,6 +1054,7 @@ public class MainWindowController {
public void handle(ActionEvent event){ public void handle(ActionEvent event){
cloudSync = true; cloudSync = true;
//TODO rework for other cloud services //TODO rework for other cloud services
// CloudService service = CloudService.GoogleDrive;
cloudService = "GoogleDrive"; cloudService = "GoogleDrive";
// start cloud sync in new thread // start cloud sync in new thread
@ -1832,6 +1837,18 @@ public class MainWindowController {
return resizedImage; return resizedImage;
} }
public Main getMain() {
return main;
}
public DBController getDbController() {
return dbController;
}
public void setMainAnchorPane(AnchorPane mainAnchorPane) {
this.mainAnchorPane = mainAnchorPane;
}
public String getCemuPath() { public String getCemuPath() {
return cemuPath; return cemuPath;
} }

View File

@ -54,7 +54,7 @@ public class playGame extends Thread{
Process p; Process p;
Platform.runLater(() -> { Platform.runLater(() -> {
mainWindowController.main.getPrimaryStage().setIconified(true); // minimize cemu_UI mainWindowController.getMain().getPrimaryStage().setIconified(true); // minimize cemu_UI
}); });
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
try { try {
@ -86,14 +86,14 @@ public class playGame extends Thread{
} else { } else {
mainWindowController.totalPlaytimeBtn.setText(dbController.getTotalPlaytime(selectedGameTitleID) + " min"); 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 //sync savegame with cloud service
if (mainWindowController.isCloudSync()) { if (mainWindowController.isCloudSync()) {
mainWindowController.setLastLocalSync(Instant.now().getEpochSecond()); mainWindowController.setLastLocalSync(Instant.now().getEpochSecond());
mainWindowController.main.getCloudController().sync(mainWindowController.getCloudService(), mainWindowController.getMain().getCloudController().sync(mainWindowController.getCloudService(),
mainWindowController.getCemuPath(), mainWindowController.main.getDirectory().getPath()); mainWindowController.getCemuPath(), mainWindowController.getMain().getDirectory().getPath());
} }
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {