diff --git a/.classpath b/.classpath
index 3dc26a7..a2e0bc5 100644
--- a/.classpath
+++ b/.classpath
@@ -21,7 +21,7 @@
-
+
diff --git a/bin/.gitignore b/bin/.gitignore
index b42b859..9eb92dc 100644
--- a/bin/.gitignore
+++ b/bin/.gitignore
@@ -1 +1,2 @@
/application/
+/datatypes/
diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class
index 253071c..109d89f 100644
Binary files a/bin/application/MainWindowController$1.class and b/bin/application/MainWindowController$1.class differ
diff --git a/bin/application/MainWindowController$10.class b/bin/application/MainWindowController$10.class
index 7471c5d..efd526b 100644
Binary files a/bin/application/MainWindowController$10.class and b/bin/application/MainWindowController$10.class differ
diff --git a/bin/application/MainWindowController$11.class b/bin/application/MainWindowController$11.class
index cb67c41..8553fb1 100644
Binary files a/bin/application/MainWindowController$11.class and b/bin/application/MainWindowController$11.class differ
diff --git a/bin/application/MainWindowController$12.class b/bin/application/MainWindowController$12.class
index f80e6da..8d58799 100644
Binary files a/bin/application/MainWindowController$12.class and b/bin/application/MainWindowController$12.class differ
diff --git a/bin/application/MainWindowController$2.class b/bin/application/MainWindowController$2.class
index 6675500..0273ed2 100644
Binary files a/bin/application/MainWindowController$2.class and b/bin/application/MainWindowController$2.class differ
diff --git a/bin/application/MainWindowController$3.class b/bin/application/MainWindowController$3.class
index 1856e1c..0cc7da3 100644
Binary files a/bin/application/MainWindowController$3.class and b/bin/application/MainWindowController$3.class differ
diff --git a/bin/application/MainWindowController$4.class b/bin/application/MainWindowController$4.class
index 679bb2e..4aa1e76 100644
Binary files a/bin/application/MainWindowController$4.class and b/bin/application/MainWindowController$4.class differ
diff --git a/bin/application/MainWindowController$5.class b/bin/application/MainWindowController$5.class
index b6d780a..87e4da9 100644
Binary files a/bin/application/MainWindowController$5.class and b/bin/application/MainWindowController$5.class differ
diff --git a/bin/application/MainWindowController$6.class b/bin/application/MainWindowController$6.class
index dede120..5f8003d 100644
Binary files a/bin/application/MainWindowController$6.class and b/bin/application/MainWindowController$6.class differ
diff --git a/bin/application/MainWindowController$7.class b/bin/application/MainWindowController$7.class
index 37c995c..365eaa2 100644
Binary files a/bin/application/MainWindowController$7.class and b/bin/application/MainWindowController$7.class differ
diff --git a/bin/application/MainWindowController$8.class b/bin/application/MainWindowController$8.class
index de7850f..7713d8d 100644
Binary files a/bin/application/MainWindowController$8.class and b/bin/application/MainWindowController$8.class differ
diff --git a/bin/application/MainWindowController$9.class b/bin/application/MainWindowController$9.class
index fe685fe..2956aba 100644
Binary files a/bin/application/MainWindowController$9.class and b/bin/application/MainWindowController$9.class differ
diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class
index b663978..92cdfc9 100644
Binary files a/bin/application/MainWindowController.class and b/bin/application/MainWindowController.class differ
diff --git a/bin/application/SmmdbApiQuery.class b/bin/application/SmmdbApiQuery.class
index a8cc267..3e34317 100644
Binary files a/bin/application/SmmdbApiQuery.class and b/bin/application/SmmdbApiQuery.class differ
diff --git a/bin/datatypes/UIROMDataType.class b/bin/datatypes/UIROMDataType.class
index f09c43b..7264a26 100644
Binary files a/bin/datatypes/UIROMDataType.class and b/bin/datatypes/UIROMDataType.class differ
diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java
index 6112094..71fa69c 100644
--- a/src/application/MainWindowController.java
+++ b/src/application/MainWindowController.java
@@ -272,6 +272,8 @@ public class MainWindowController {
}
void initUI() {
+ LOGGER.info("initializing UI ...");
+
if (getWindowWidth() > 100 && getWindowHeight() > 100) {
mainAnchorPane.setPrefSize(getWindowWidth(), getWindowHeight());
}
@@ -304,6 +306,8 @@ public class MainWindowController {
courseTreeTable.getColumns().add(starsColumn);
courseTreeTable.getColumns().add(idColumn);
courseTreeTable.getColumns().get(3).setVisible(false); //hide idColumn (important)
+
+ LOGGER.info("initializing UI done");
}
/**
@@ -1038,7 +1042,89 @@ public class MainWindowController {
}
});
- games.add(new UIROMDataType(VBox, gameTitleLabel, gameBtn, titleID, romPath));
+ games.add(new UIROMDataType(VBox, gameTitleLabel, gameBtn, imageView, titleID, romPath));
+
+// //THIS IS TESTING AREA!!!!
+// UIROMDataType test = new UIROMDataType(VBox, gameTitleLabel, gameBtn, imageView, titleID, romPath);
+//
+// test.getLabel().setText(title);
+// test.getLabel().setMaxWidth(200);
+// test.getLabel().setPadding(new Insets(0,0,0,8));
+// test.getLabel().setFont(Font.font("System", FontWeight.BOLD, 14));
+//
+// //i think we can do this locally and remove the imageView from the datatype since it's used as graphic
+// test.getImageView().setImage(coverImage);
+// test.getImageView().setFitHeight(300);
+// test.getImageView().setFitWidth(200);
+//
+// test.getButton().setGraphic(test.getImageView());
+// test.getButton().setContextMenu(gameContextMenu);
+// test.getButton().setStyle("-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.8), 10, 0, 0, 3); ");
+// test.getButton().addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler() {
+// @Override
+// public void handle(MouseEvent event) {
+// LOGGER.info("selected: " + title + "; ID: " + titleID);
+// // getting the selected game index by comparing event.getSource() with games.get(i).getButton()
+// for (int i = 0; i < games.size(); i++) {
+// if (games.get(i).getButton() == event.getSource()) {
+// selectedUIDataIndex = i;
+// }
+// }
+//
+// gameExecutePath = romPath;
+// selectedGameTitleID = titleID;
+// selectedGameTitle = title;
+//
+// // underling selected Label
+// lastGameLabel.setStyle("-fx-underline: false;");
+// games.get(selectedUIDataIndex).getLabel().setStyle("-fx-underline: true;");
+// lastGameLabel = games.get(selectedUIDataIndex).getLabel();
+//
+// // setting last played, if lastPlayed is empty game was never played before, else set correct date
+// if (dbController.getLastPlayed(titleID).equals("") || dbController.getLastPlayed(titleID).equals(null)) {
+// lastTimePlayedBtn.setText("Last played, never");
+// totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID) + " min");
+// } else {
+// DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//
+// int today = Integer.parseInt(dtf.format(LocalDate.now()).replaceAll("-", ""));
+// int yesterday = Integer.parseInt(dtf.format(LocalDate.now().minusDays(1)).replaceAll("-", ""));
+// int lastPlayedDay = Integer.parseInt(dbController.getLastPlayed(titleID).replaceAll("-", ""));
+//
+// if (today == lastPlayedDay) {
+// lastTimePlayedBtn.setText("Last played, today");
+// } else if (yesterday == lastPlayedDay) {
+// lastTimePlayedBtn.setText("Last played, yesterday");
+// } else {
+// lastTimePlayedBtn.setText("Last played, " + dbController.getLastPlayed(titleID));
+// }
+// }
+//
+// // setting total playtime, if total playtime > 60 minutes, formate is "x hours x
+// // minutes" (xh x min), else only minutes are showed
+// if (Integer.parseInt(dbController.getTotalPlaytime(titleID)) > 60) {
+// int hoursPlayed = (int) Math.floor(Integer.parseInt(dbController.getTotalPlaytime(titleID)) / 60);
+// int minutesPlayed = Integer.parseInt(dbController.getTotalPlaytime(titleID)) - 60 * hoursPlayed;
+// totalPlaytimeBtn.setText(hoursPlayed + " h " + minutesPlayed + " min");
+// } else {
+// totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID) + " min");
+// }
+//
+// if (!playTrue) {
+// playBtnSlideIn();
+// }
+// if (menuTrue) {
+// sideMenuSlideOut();
+// }
+//
+// }
+// });
+//
+// test.getVBox().setLayoutX(getxPos());
+// test.getVBox().setLayoutY(getyPos());
+// test.getVBox().getChildren().addAll(gameTitleLabel,gameBtn);
+//
+// games.add(test);
}
//add all games saved in games(ArrayList) to the gamesAnchorPane
@@ -1198,8 +1284,16 @@ public class MainWindowController {
* calculates how many games can be displayed in one row
*/
private void generatePosition() {
- int xPosHelperMax = (int) Math.floor((mainAnchorPane.getWidth() - 36) / 217);
-
+ int xPosHelperMax;
+
+ //FIXME somehow the window width is set to 8, if we can find a way to get always the real window with
+ //(at the beginning we have to use prefWidth after resizing Width) we can remove this
+ if (mainAnchorPane.getWidth() < 10) {
+ xPosHelperMax = (int) Math.floor((mainAnchorPane.getPrefWidth() - 36) / 217);
+ } else {
+ xPosHelperMax = (int) Math.floor((mainAnchorPane.getWidth() - 36) / 217);
+ }
+
if(xPosHelper == xPosHelperMax){
oldXPosHelper = xPosHelper;
xPos = 17;
@@ -1209,7 +1303,7 @@ public class MainWindowController {
xPos = xPos + 217;
xPosHelper++;
}
-// System.out.println("Breit: " + mainAnchorPane.getWidth());
+// System.out.println("Breit: " + mainAnchorPane.getPrefWidth());
// System.out.println("xPosHelper: " + xPosHelper);
// System.out.println("yPos: " + yPos);
// System.out.println("xPos: " + xPos);
diff --git a/src/application/SmmdbApiQuery.java b/src/application/SmmdbApiQuery.java
index a0de179..2a99799 100644
--- a/src/application/SmmdbApiQuery.java
+++ b/src/application/SmmdbApiQuery.java
@@ -42,8 +42,8 @@ public class SmmdbApiQuery {
BufferedReader ina = new BufferedReader(new InputStreamReader(apiUrl.openStream()));
output = ina.readLine();
ina.close();
- System.out.println(output);
LOGGER.info("response from " + URL + " was valid");
+ LOGGER.info(output);
} catch (IOException e) {
LOGGER.error("error while making api request or reading response");
LOGGER.error("response from " + URL + " was: " + output, e);
diff --git a/src/datatypes/UIROMDataType.java b/src/datatypes/UIROMDataType.java
index 0a4ba8d..1a57295 100644
--- a/src/datatypes/UIROMDataType.java
+++ b/src/datatypes/UIROMDataType.java
@@ -9,6 +9,7 @@ import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.control.Label;
+import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
public class UIROMDataType {
@@ -16,14 +17,17 @@ public class UIROMDataType {
private final SimpleObjectProperty vBox = new SimpleObjectProperty<>();
private final SimpleObjectProperty