fixed loading error

* fixed an issue with loading sttings when no cloudService is set
This commit is contained in:
Jannik 2017-08-11 20:01:43 +02:00
parent 07d33df63a
commit 43a7e22254
9 changed files with 37 additions and 17 deletions

1
bin/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/application/

Binary file not shown.

View File

@ -114,4 +114,4 @@
</JFXButton>
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" maxHeight="32.0" minWidth="100.0" onAction="#lastTimePlayedBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="516.5" AnchorPane.topAnchor="558.0" />
</children>
</AnchorPane>
</AnchorPane>

View File

@ -133,21 +133,25 @@ public class CloudController {
public String getFolderID(String cloudService) {
String folderID = "";
if(cloudService.equals("GoogleDrive")) {
folderID = googleDriveController.getFolderID();
}
if(cloudService.equals("Dropbox")) {
if (cloudService != null) {
if(cloudService.equals("GoogleDrive")) {
folderID = googleDriveController.getFolderID();
}
if(cloudService.equals("Dropbox")) {
}
}
return folderID;
}
public void setFolderID(String folderID, String cloudService) {
if(cloudService.equals("GoogleDrive")) {
googleDriveController.setFolderID(folderID);
}
if(cloudService.equals("Dropbox")) {
if (cloudService != null) {
if (cloudService.equals("GoogleDrive")) {
googleDriveController.setFolderID(folderID);
}
if (cloudService.equals("Dropbox")) {
}
}
}
}

View File

@ -75,12 +75,14 @@ public class Main extends Application {
gamesDBFile = new File(dirLinux + "/games.db");
localDB = new File(dirLinux+"/localRoms.db");
pictureCache= new File(dirLinux+"/picture_cache");
pane.setPrefWidth(904); //this could be a kde plasma specific issue
}else{
directory = new File(dirWin);
configFile = new File(dirWin + "/config.xml");
gamesDBFile = new File(dirWin + "/games.db");
localDB = new File(dirWin+"/localRoms.db");
pictureCache= new File(dirWin+"/picture_cache");
pane.setPrefWidth(892);
}
//startup checks

View File

@ -114,4 +114,4 @@
</JFXButton>
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" maxHeight="32.0" minWidth="100.0" onAction="#lastTimePlayedBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="516.5" AnchorPane.topAnchor="558.0" />
</children>
</AnchorPane>
</AnchorPane>

View File

@ -973,7 +973,7 @@ public class MainWindowController {
Image coverImage = new Image(coverFile.toURI().toString());
generatePosition();
System.out.println("add " + getxPos()); //TODO debug
VBox.setLayoutX(getxPos());
VBox.setLayoutY(getyPos());
VBox.getChildren().addAll(gameTitleLabel,gameBtn);
@ -1144,10 +1144,15 @@ public class MainWindowController {
}
//TODO xPosHelper based on window with
//TODO xPosHelper based on window with breite -24(windows, Linx = 36)
private void generatePosition() {
// System.out.println(main.primaryStage.getWidth());
if(xPosHelper == 4){
int xPosHelperMax;
if(System.getProperty("os.name").equals("Linux")){
xPosHelperMax = (int) Math.floor((main.pane.getPrefWidth() - 36) / 217);
} else {
xPosHelperMax = (int) Math.floor((main.pane.getPrefWidth() - 24) / 217);
}
if(xPosHelper == xPosHelperMax){
xPos = 17;
yPos = yPos + 345;
xPosHelper = 1;
@ -1155,6 +1160,10 @@ public class MainWindowController {
xPos = xPos + 217;
xPosHelper++;
}
// System.out.println("Breit: " + main.pane.getPrefWidth());
// System.out.println("xPosHelper: " + xPosHelper);
// System.out.println("yPos: " + yPos);
// System.out.println("xPos: " + xPos);
}
private void applyColor() {
@ -1227,7 +1236,11 @@ public class MainWindowController {
props.setProperty("color", getColor());
props.setProperty("fullscreen", String.valueOf(isFullscreen()));
props.setProperty("cloudSync", String.valueOf(cloudSync));
props.setProperty("cloudService", getCloudService());
if (getCloudService() == null) {
props.setProperty("cloudService", "");
} else {
props.setProperty("cloudService", getCloudService());
}
props.setProperty("folderID", main.cloudController.getFolderID(getCloudService()));
if(System.getProperty("os.name").equals("Linux")){
outputStream = new FileOutputStream(fileLinux);