code clean up

This commit is contained in:
Jannik 2017-11-24 21:36:03 +01:00
parent 922b1443e1
commit fe6ddedab9
1 changed files with 416 additions and 453 deletions

View File

@ -40,7 +40,6 @@ import java.sql.SQLException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Optional;
import java.util.Properties; import java.util.Properties;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@ -80,9 +79,6 @@ import javafx.event.ActionEvent;
import javafx.event.EventHandler; import javafx.event.EventHandler;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonType;
import javafx.scene.control.ChoiceBox; import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ContextMenu; import javafx.scene.control.ContextMenu;
import javafx.scene.control.Label; import javafx.scene.control.Label;
@ -410,14 +406,14 @@ public class MainWindowController {
@Override @Override
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
try { try {
LOGGER.info("edit "+selectedGameTitleID); LOGGER.info("edit " + selectedGameTitleID);
String[] gameInfo = dbController.getGameInfo(selectedGameTitleID); String[] gameInfo = dbController.getGameInfo(selectedGameTitleID);
//new edit dialog // new edit dialog
String headingText = "edit a game"; String headingText = "edit a game";
String bodyText = "You can edit the tile and rom/cover path."; String bodyText = "You can edit the tile and rom/cover path.";
JFXEditGameDialog editGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 350, 300, JFXEditGameDialog editGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 450,
1, MWC, main.primaryStage, main.pane); 300, 1, MWC, main.primaryStage, main.pane);
editGameDialog.setTitle(gameInfo[0]); editGameDialog.setTitle(gameInfo[0]);
editGameDialog.setCoverPath(gameInfo[1]); editGameDialog.setCoverPath(gameInfo[1]);
editGameDialog.setRomPath(gameInfo[2]); editGameDialog.setRomPath(gameInfo[2]);
@ -426,63 +422,41 @@ public class MainWindowController {
} catch (Exception e) { } catch (Exception e) {
LOGGER.warn("trying to edit " + selectedGameTitleID + ",which is not a valid type!", e); LOGGER.warn("trying to edit " + selectedGameTitleID + ",which is not a valid type!", e);
} }
// if (selectedGameTitleID == null) {
// LOGGER.warn("trying to edit null! null is not valid!");
//
// String headingText = "edit game";
// String bodyText = "please select a game, \""+selectedGameTitleID+"\" is not a valid type!";
// JFXInfoDialog aboutDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 350, 170, main.pane);
// aboutDialog.show();
// } else {
// String[] gameInfo = dbController.getGameInfo(selectedGameTitleID);
//
// //new edit dialog
// String headingText = "edit a game";
// String bodyText = "You can edit the tile and rom/cover path.";
// JFXEditGameDialog editGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 350, 300,
// 1, MWC, main.primaryStage, main.pane);
// editGameDialog.setTitle(gameInfo[0]);
// editGameDialog.setCoverPath(gameInfo[1]);
// editGameDialog.setRomPath(gameInfo[2]);
// editGameDialog.setTitleID(gameInfo[3]);
// editGameDialog.show();
// }
} }
}); });
remove.setOnAction(new EventHandler<ActionEvent>() { remove.setOnAction(new EventHandler<ActionEvent>() {
@Override @Override
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
LOGGER.info("remove "+selectedGameTitleID);
if(selectedGameTitleID == null){
LOGGER.warn("trying to remove null! null is not valid!");
String headingText = "remove game";
String bodyText = "please select a game, \""+selectedGameTitleID+"\" is not a valid type!";
JFXInfoDialog aboutDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 350, 170, main.pane);
aboutDialog.show();
}
else{
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("remove");
alert.setHeaderText("cemu_UI");
alert.setContentText("Are you sure you want to delete "+selectedGameTitle+" ?");
alert.initOwner(main.primaryStage);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
try { try {
// remove game from database LOGGER.info("remove " + selectedGameTitle + "(" + selectedGameTitleID + ")");
games.remove(selectedUIDataIndex); String headingText = "remove \"" + selectedGameTitle + "\"";
dbController.removeRom(selectedGameTitleID); String bodyText = "Are you sure you want to delete " + selectedGameTitle + " ?";
EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>() {
// refresh all games at gamesAnchorPane (UI) @Override
refreshUIData(); public void handle(ActionEvent event) {
try {
games.remove(selectedUIDataIndex); // remove game form games-list
dbController.removeRom(selectedGameTitleID); // remove game from database
refreshUIData(); // refresh all games at gamesAnchorPane (UI)
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("error!",e); LOGGER.error("error while removing ROM from database!", e);
} }
} }
};
EventHandler<ActionEvent> cancelAction = new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
// do nothing
}
};
JFXOkayCancelDialog removeGameDialog = new JFXOkayCancelDialog(headingText, bodyText,
dialogBtnStyle, 350, 170, okayAction, cancelAction, main.pane);
removeGameDialog.show();
} catch (Exception e) {
LOGGER.error("error while removing " + selectedGameTitle + "(" + selectedGameTitleID + ")", e);
} }
} }
}); });
@ -490,31 +464,24 @@ public class MainWindowController {
addUpdate.setOnAction(new EventHandler<ActionEvent>() { addUpdate.setOnAction(new EventHandler<ActionEvent>() {
@Override @Override
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
LOGGER.info("update: "+selectedGameTitleID); try {
if (selectedGameTitleID == null) { LOGGER.info("update: " + selectedGameTitleID);
LOGGER.warn("trying to update null! null is not valid!");
String headingText = "update game";
String bodyText = "please select a game,\n"
+ "\""+selectedGameTitleID+"\" is not a valid type!";
JFXInfoDialog updateGameErrorDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 350, 170, main.pane);
updateGameErrorDialog.show();
} else {
String headingText = "update \"" + selectedGameTitle + "\""; String headingText = "update \"" + selectedGameTitle + "\"";
String bodyText = "pleas select the update root directory"; String bodyText = "pleas select the update root directory";
EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>(){ EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>() {
@Override @Override
public void handle(ActionEvent event){ public void handle(ActionEvent event) {
DirectoryChooser directoryChooser = new DirectoryChooser(); DirectoryChooser directoryChooser = new DirectoryChooser();
File selectedDirecroty = directoryChooser.showDialog(main.primaryStage); File selectedDirecroty = directoryChooser.showDialog(main.primaryStage);
String updatePath = selectedDirecroty.getAbsolutePath(); String updatePath = selectedDirecroty.getAbsolutePath();
String[] parts = selectedGameTitleID.split("-"); // split string into 2 parts at "-" String[] parts = selectedGameTitleID.split("-"); // split string into 2 parts at "-"
File srcDir = new File(updatePath); File srcDir = new File(updatePath);
File destDir; File destDir;
if (System.getProperty("os.name").equals("Linux")) { if (System.getProperty("os.name").equals("Linux")) {
destDir = new File(cemuPath+"/mlc01/usr/title/"+parts[0]+"/"+parts[1]); destDir = new File(cemuPath + "/mlc01/usr/title/" + parts[0] + "/" + parts[1]);
} else { } else {
destDir = new File(cemuPath+"\\mlc01\\usr\\title\\"+parts[0]+"\\"+parts[1]); destDir = new File(cemuPath + "\\mlc01\\usr\\title\\" + parts[0] + "\\" + parts[1]);
} }
// if directory doesn't exist create it // if directory doesn't exist create it
@ -539,13 +506,15 @@ public class MainWindowController {
EventHandler<ActionEvent> cancelAction = new EventHandler<ActionEvent>() { EventHandler<ActionEvent> cancelAction = new EventHandler<ActionEvent>() {
@Override @Override
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
// do nothing
} }
}; };
JFXOkayCancelDialog updateGameDialog = new JFXOkayCancelDialog(headingText, bodyText, JFXOkayCancelDialog updateGameDialog = new JFXOkayCancelDialog(headingText, bodyText,
dialogBtnStyle, 350, 170, okayAction, cancelAction, main.pane); dialogBtnStyle, 350, 170, okayAction, cancelAction, main.pane);
updateGameDialog.show(); updateGameDialog.show();
} catch (Exception e) {
LOGGER.warn("trying to update " + selectedGameTitleID + ",which is not a valid type!", e);
} }
} }
}); });
@ -553,21 +522,13 @@ public class MainWindowController {
addDLC.setOnAction(new EventHandler<ActionEvent>() { addDLC.setOnAction(new EventHandler<ActionEvent>() {
@Override @Override
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
LOGGER.info("add DLC: "+selectedGameTitleID); try {
LOGGER.info("add DLC: " + selectedGameTitleID);
if (selectedGameTitleID == null) {
LOGGER.warn("trying to add a dlc to null! null is not valid!");
String headingText = "add DLC";
String bodyText = "please select a game,\n"
+ "\"" + selectedGameTitleID + "\" is not a valid type!";
JFXInfoDialog addDLCErrorDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 350, 170, main.pane);
addDLCErrorDialog.show();
} else {
String headingText = "add a DLC to \"" + selectedGameTitle + "\""; String headingText = "add a DLC to \"" + selectedGameTitle + "\"";
String bodyText = "pleas select the DLC root directory"; String bodyText = "pleas select the DLC root directory";
EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>(){ EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>() {
@Override @Override
public void handle(ActionEvent event){ public void handle(ActionEvent event) {
DirectoryChooser directoryChooser = new DirectoryChooser(); DirectoryChooser directoryChooser = new DirectoryChooser();
File selectedDirecroty = directoryChooser.showDialog(main.primaryStage); File selectedDirecroty = directoryChooser.showDialog(main.primaryStage);
String dlcPath = selectedDirecroty.getAbsolutePath(); String dlcPath = selectedDirecroty.getAbsolutePath();
@ -575,9 +536,10 @@ public class MainWindowController {
File srcDir = new File(dlcPath); File srcDir = new File(dlcPath);
File destDir; File destDir;
if (System.getProperty("os.name").equals("Linux")) { if (System.getProperty("os.name").equals("Linux")) {
destDir = new File(cemuPath+"/mlc01/usr/title/"+parts[0]+"/"+parts[1]+"/aoc"); destDir = new File(cemuPath + "/mlc01/usr/title/" + parts[0] + "/" + parts[1] + "/aoc");
} else { } else {
destDir = new File(cemuPath+"\\mlc01\\usr\\title\\"+parts[0]+"\\"+parts[1]+"\\aoc"); destDir = new File(
cemuPath + "\\mlc01\\usr\\title\\" + parts[0] + "\\" + parts[1] + "\\aoc");
} }
// if directory doesn't exist create it // if directory doesn't exist create it
@ -602,13 +564,15 @@ public class MainWindowController {
EventHandler<ActionEvent> cancelAction = new EventHandler<ActionEvent>() { EventHandler<ActionEvent> cancelAction = new EventHandler<ActionEvent>() {
@Override @Override
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
// do nothing
} }
}; };
JFXOkayCancelDialog addDLCDialog = new JFXOkayCancelDialog(headingText, bodyText, JFXOkayCancelDialog addDLCDialog = new JFXOkayCancelDialog(headingText, bodyText, dialogBtnStyle,
dialogBtnStyle, 350, 170, okayAction, cancelAction, main.pane); 350, 170, okayAction, cancelAction, main.pane);
addDLCDialog.show(); addDLCDialog.show();
} catch (Exception e) {
LOGGER.warn("trying to add a dlc to " + selectedGameTitleID + ",which is not a valid type!", e);
} }
} }
}); });
@ -634,10 +598,11 @@ public class MainWindowController {
// Change-listener for TreeTable // Change-listener for TreeTable
courseTreeTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Object>() { courseTreeTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Object>() {
@Override @Override
public void changed(ObservableValue<?> observable, Object oldVal, Object newVal){ public void changed(ObservableValue<?> observable, Object oldVal, Object newVal) {
selected = courseTreeTable.getSelectionModel().getSelectedIndex(); //get selected item selected = courseTreeTable.getSelectionModel().getSelectedIndex(); // get selected item
// FIXME if a item is selected and you change the sorting,you can't select a new item // FIXME if a item is selected and you change the sorting,you can't select a new
// item
id = idColumn.getCellData(selected); // get name of selected item id = idColumn.getCellData(selected); // get name of selected item
for (int i = 0; i < courses.size(); i++) { for (int i = 0; i < courses.size(); i++) {
@ -659,7 +624,7 @@ public class MainWindowController {
helpLbl.setOnMouseClicked(new EventHandler<MouseEvent>() { helpLbl.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override @Override
public void handle(MouseEvent mouseEvent) { public void handle(MouseEvent mouseEvent) {
if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){ if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
try { try {
Desktop.getDesktop().browse(new URI("https://github.com/Seil0/cemu_UI/issues/3")); Desktop.getDesktop().browse(new URI("https://github.com/Seil0/cemu_UI/issues/3"));
} catch (IOException | URISyntaxException e) { } catch (IOException | URISyntaxException e) {
@ -704,12 +669,12 @@ public class MainWindowController {
} }
@FXML @FXML
void detailsSlideoutBtnAction(ActionEvent event){ void detailsSlideoutBtnAction(ActionEvent event) {
playBtnSlideOut(); playBtnSlideOut();
} }
@FXML @FXML
void aboutBtnAction(){ void aboutBtnAction() {
String headingText = "cemu_UI"; String headingText = "cemu_UI";
String bodyText = "cemu_UI by @Seil0 \nVersion: " + version + " (" + buildNumber + ") \"" + versionName + "\" \n" String bodyText = "cemu_UI by @Seil0 \nVersion: " + version + " (" + buildNumber + ") \"" + versionName + "\" \n"
+ "This Application is made with free Software\n" + "This Application is made with free Software\n"
@ -736,7 +701,7 @@ public class MainWindowController {
} }
@FXML @FXML
void reloadRomsBtnAction() throws IOException{ void reloadRomsBtnAction() throws IOException {
reloadRomsBtn.setText("reloading..."); reloadRomsBtn.setText("reloading...");
dbController.loadRomDirectory(getRomPath()); // TODO own thread dbController.loadRomDirectory(getRomPath()); // TODO own thread
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); // start again (preventing Bugs) Runtime.getRuntime().exec("java -jar cemu_UI.jar"); // start again (preventing Bugs)
@ -758,9 +723,9 @@ public class MainWindowController {
courses.addAll(smmdbAPIController.startQuery()); courses.addAll(smmdbAPIController.startQuery());
// add query response to courseTreeTable // add query response to courseTreeTable
for(int i = 0; i < courses.size(); i++){ for (int i = 0; i < courses.size(); i++) {
CourseTableDataType helpCourse = new CourseTableDataType(courses.get(i).getTitle(), courses.get(i).getId(), CourseTableDataType helpCourse = new CourseTableDataType(courses.get(i).getTitle(),
courses.get(i).getTime(), courses.get(i).getStars()); courses.get(i).getId(), courses.get(i).getTime(), courses.get(i).getStars());
root.getChildren().add(new TreeItem<CourseTableDataType>(helpCourse)); // add data to root-node root.getChildren().add(new TreeItem<CourseTableDataType>(helpCourse)); // add data to root-node
} }
@ -768,35 +733,35 @@ public class MainWindowController {
} }
@FXML @FXML
void playBtnAction(ActionEvent event) throws InterruptedException, IOException{ void playBtnAction(ActionEvent event) throws InterruptedException, IOException {
dbController.setLastPlayed(selectedGameTitleID); dbController.setLastPlayed(selectedGameTitleID);
playGame = new playGame(this,dbController); playGame = new playGame(this, dbController);
playGame.start(); playGame.start();
} }
@FXML @FXML
void totalPlaytimeBtnAction(ActionEvent event){ void totalPlaytimeBtnAction(ActionEvent event) {
} }
@FXML @FXML
void lastTimePlayedBtnAction(ActionEvent event){ void lastTimePlayedBtnAction(ActionEvent event) {
} }
@FXML @FXML
void cemuTFBtnAction(ActionEvent event) { void cemuTFBtnAction(ActionEvent event) {
File cemuDirectory = directoryChooser.showDialog(main.primaryStage); File cemuDirectory = directoryChooser.showDialog(main.primaryStage);
if(cemuDirectory == null){ if (cemuDirectory == null) {
LOGGER.info("No Directory selected"); LOGGER.info("No Directory selected");
}else{ } else {
setCemuPath(cemuDirectory.getAbsolutePath()); setCemuPath(cemuDirectory.getAbsolutePath());
saveSettings(); saveSettings();
cemuTextField.setText(getCemuPath()); cemuTextField.setText(getCemuPath());
try { try {
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); // start again Runtime.getRuntime().exec("java -jar cemu_UI.jar"); // start again
System.exit(0); //finishes itself System.exit(0); // finishes itself
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("an error occurred", e); LOGGER.error("an error occurred", e);
} }
@ -806,9 +771,9 @@ public class MainWindowController {
@FXML @FXML
void romTFBtnAction(ActionEvent event) { void romTFBtnAction(ActionEvent event) {
File romDirectory = directoryChooser.showDialog(main.primaryStage); File romDirectory = directoryChooser.showDialog(main.primaryStage);
if(romDirectory == null){ if (romDirectory == null) {
LOGGER.info("No Directory selected"); LOGGER.info("No Directory selected");
}else{ } else {
setRomPath(romDirectory.getAbsolutePath()); setRomPath(romDirectory.getAbsolutePath());
saveSettings(); saveSettings();
cemuTextField.setText(getCemuPath()); cemuTextField.setText(getCemuPath());
@ -831,15 +796,16 @@ public class MainWindowController {
@FXML @FXML
void autoUpdateToggleBtnAction(ActionEvent event) { void autoUpdateToggleBtnAction(ActionEvent event) {
if(isAutoUpdate()){ if (isAutoUpdate()) {
setAutoUpdate(false); setAutoUpdate(false);
}else{ } else {
setAutoUpdate(true); setAutoUpdate(true);
} }
saveSettings(); } saveSettings();
}
@FXML @FXML
void smmdbDownloadBtnAction(ActionEvent event){ void smmdbDownloadBtnAction(ActionEvent event) {
String downloadUrl = "http://smmdb.ddns.net/api/downloadcourse?id=" + id + "&type=zip"; String downloadUrl = "http://smmdb.ddns.net/api/downloadcourse?id=" + id + "&type=zip";
String downloadFileURL = getCemuPath() + "/" + id + ".zip"; // getCemuPath() + "/" + smmID + "/" + id + ".rar" String downloadFileURL = getCemuPath() + "/" + id + ".zip"; // getCemuPath() + "/" + smmID + "/" + id + ".rar"
String outputFile = getCemuPath() + "/"; String outputFile = getCemuPath() + "/";
@ -904,29 +870,29 @@ public class MainWindowController {
} }
@FXML @FXML
void cemuTextFieldAction(ActionEvent event){ void cemuTextFieldAction(ActionEvent event) {
setCemuPath(cemuTextField.getText()); setCemuPath(cemuTextField.getText());
saveSettings(); saveSettings();
} }
@FXML @FXML
void romTextFieldAction(ActionEvent event){ void romTextFieldAction(ActionEvent event) {
setRomPath(romTextField.getText()); setRomPath(romTextField.getText());
saveSettings(); saveSettings();
} }
@FXML @FXML
void fullscreenToggleBtnAction(ActionEvent event){ void fullscreenToggleBtnAction(ActionEvent event) {
if(fullscreen){ if (fullscreen) {
fullscreen = false; fullscreen = false;
}else{ } else {
fullscreen = true; fullscreen = true;
} }
saveSettings(); saveSettings();
} }
@FXML @FXML
void cloudSyncToggleBtnAction(ActionEvent event){ void cloudSyncToggleBtnAction(ActionEvent event) {
if(cloudSync) { if(cloudSync) {
cloudSync = false; cloudSync = false;
} else { } else {
@ -972,17 +938,17 @@ public class MainWindowController {
} }
@FXML @FXML
void colorPickerAction(ActionEvent event){ void colorPickerAction(ActionEvent event) {
editColor(colorPicker.getValue().toString()); editColor(colorPicker.getValue().toString());
applyColor(); applyColor();
} }
@FXML @FXML
void addBtnAction(ActionEvent event){ void addBtnAction(ActionEvent event) {
String headingText = "add a new game to cemu_UI"; String headingText = "add a new game to cemu_UI";
String bodyText = ""; String bodyText = "";
JFXEditGameDialog addGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 450, 300, JFXEditGameDialog addGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 450, 300, 0,
0, this, main.primaryStage, main.pane); this, main.primaryStage, main.pane);
addGameDialog.show(); addGameDialog.show();
} }
@ -1156,9 +1122,9 @@ public class MainWindowController {
games.add(uiROMElement); games.add(uiROMElement);
} }
//add all games saved in games(ArrayList) to gamesAnchorPane // add all games saved in games(ArrayList) to gamesAnchorPane
void addUIData() { void addUIData() {
for(int i=0; i<games.size(); i++){ for (int i = 0; i < games.size(); i++) {
gamesAnchorPane.getChildren().add(games.get(i).getVBox()); gamesAnchorPane.getChildren().add(games.get(i).getVBox());
} }
} }
@ -1190,14 +1156,14 @@ public class MainWindowController {
} else { } else {
width = mainAnchorPane.getWidth(); width = mainAnchorPane.getWidth();
} }
playBtn.setLayoutX((width/2)-50); playBtn.setLayoutX((width / 2) - 50);
totalPlaytimeBtn.setLayoutX((width/2)-50-20.5-100); totalPlaytimeBtn.setLayoutX((width / 2) - 50 - 20.5 - 100);
lastTimePlayedBtn.setLayoutX((width/2)+50+20.5); lastTimePlayedBtn.setLayoutX((width / 2) + 50 + 20.5);
} }
void checkAutoUpdate() { void checkAutoUpdate() {
if(isAutoUpdate()){ if (isAutoUpdate()) {
try { try {
LOGGER.info("AutoUpdate: looking for updates on startup ..."); LOGGER.info("AutoUpdate: looking for updates on startup ...");
updateController = new UpdateController(this, buildNumber, useBeta); updateController = new UpdateController(this, buildNumber, useBeta);
@ -1319,14 +1285,14 @@ public class MainWindowController {
courseText.add(4, new Text(difficulty + "\n")); courseText.add(4, new Text(difficulty + "\n"));
courseText.add(5, new Text(autoscroll + "\n")); courseText.add(5, new Text(autoscroll + "\n"));
courseText.add(6, new Text(course.getTime() + "\n")); courseText.add(6, new Text(course.getTime() + "\n"));
courseText.add(7, new Text(new java.util.Date((long)course.getLastmodified()*1000) + "\n")); courseText.add(7, new Text(new java.util.Date((long) course.getLastmodified() * 1000) + "\n"));
courseText.add(8, new Text(new java.util.Date((long)course.getUploaded()*1000) + "\n")); courseText.add(8, new Text(new java.util.Date((long) course.getUploaded() * 1000) + "\n"));
courseText.add(9, new Text(course.getNintendoid() + "\n")); courseText.add(9, new Text(course.getNintendoid() + "\n"));
for(int i=0; i<nameText.size(); i++){ for (int i = 0; i < nameText.size(); i++) {
nameText.get(i).setFont(Font.font ("System", FontWeight.BOLD, 14)); nameText.get(i).setFont(Font.font("System", FontWeight.BOLD, 14));
courseText.get(i).setFont(Font.font ("System", 14)); courseText.get(i).setFont(Font.font("System", 14));
smmdbTextFlow.getChildren().addAll(nameText.get(i),courseText.get(i)); smmdbTextFlow.getChildren().addAll(nameText.get(i), courseText.get(i));
} }
} }
@ -1357,11 +1323,8 @@ public class MainWindowController {
xPosHelper++; xPosHelper++;
} }
// TODO needs testing // System.out.println("Breit: " + main.pane.getWidth());
System.out.println("Breit: " + main.pane.getWidth()); // System.out.println("Breit2: " + mainAnchorPane.getWidth());
System.out.println("Breit2: " + mainAnchorPane.getWidth());
System.out.println("Breite3: " + main.scene.getWidth());
System.out.println("Breite4: " + main.primaryStage.getWidth());
// System.out.println("xPosHelper: " + xPosHelper); // System.out.println("xPosHelper: " + xPosHelper);
// System.out.println("yPos: " + yPos); // System.out.println("yPos: " + yPos);
// System.out.println("xPos: " + xPos); // System.out.println("xPos: " + xPos);
@ -1379,7 +1342,7 @@ public class MainWindowController {
cemuTextField.setFocusColor(Color.valueOf(getColor())); cemuTextField.setFocusColor(Color.valueOf(getColor()));
romTextField.setFocusColor(Color.valueOf(getColor())); romTextField.setFocusColor(Color.valueOf(getColor()));
if(icolor.compareTo(ccolor) == -1){ if (icolor.compareTo(ccolor) == -1) {
dialogBtnStyle = btnStyleWhite; dialogBtnStyle = btnStyleWhite;
aboutBtn.setStyle("-fx-text-fill: WHITE;"); aboutBtn.setStyle("-fx-text-fill: WHITE;");
@ -1401,7 +1364,7 @@ public class MainWindowController {
smmdbBtn.setGraphic(smmdb_white); smmdbBtn.setGraphic(smmdb_white);
menuHam.getStyleClass().add("jfx-hamburgerW"); menuHam.getStyleClass().add("jfx-hamburgerW");
}else{ } else {
dialogBtnStyle = btnStyleBlack; dialogBtnStyle = btnStyleBlack;
aboutBtn.setStyle("-fx-text-fill: BLACK;"); aboutBtn.setStyle("-fx-text-fill: BLACK;");
@ -1425,7 +1388,7 @@ public class MainWindowController {
menuHam.getStyleClass().add("jfx-hamburgerB"); menuHam.getStyleClass().add("jfx-hamburgerB");
} }
for(int i=0; i<games.size(); i++){ for (int i = 0; i < games.size(); i++) {
games.get(i).getButton().setRipplerFill(Paint.valueOf(getColor())); games.get(i).getButton().setRipplerFill(Paint.valueOf(getColor()));
} }
} }