clean up
* fixed a few typos * code clean up
This commit is contained in:
parent
ba9fd1bb32
commit
922b1443e1
@ -55,7 +55,7 @@ public class Main extends Application {
|
|||||||
public MainWindowController mainWindowController; // TODO find a better way
|
public MainWindowController mainWindowController; // TODO find a better way
|
||||||
CloudController cloudController;
|
CloudController cloudController;
|
||||||
AnchorPane pane;
|
AnchorPane pane;
|
||||||
private Scene scene;
|
Scene scene; // TODO make private
|
||||||
private String dirWin = System.getProperty("user.home") + "/Documents/cemu_UI"; // Windows: C:/Users/"User"/Documents/cemu_UI
|
private String dirWin = System.getProperty("user.home") + "/Documents/cemu_UI"; // Windows: C:/Users/"User"/Documents/cemu_UI
|
||||||
private String dirLinux = System.getProperty("user.home") + "/cemu_UI"; // Linux: /home/"User"/cemu_UI
|
private String dirLinux = System.getProperty("user.home") + "/cemu_UI"; // Linux: /home/"User"/cemu_UI
|
||||||
private String gamesDBdownloadURL = "https://github.com/Seil0/cemu_UI/raw/master/downloadContent/games.db";
|
private String gamesDBdownloadURL = "https://github.com/Seil0/cemu_UI/raw/master/downloadContent/games.db";
|
||||||
@ -92,7 +92,7 @@ public class Main extends Application {
|
|||||||
mainWindowController = loader.getController(); // Link of FXMLController and controller class
|
mainWindowController = loader.getController(); // Link of FXMLController and controller class
|
||||||
mainWindowController.setMain(this); // call setMain
|
mainWindowController.setMain(this); // call setMain
|
||||||
|
|
||||||
//get os and the right paths
|
// get OS and the specific paths
|
||||||
if (System.getProperty("os.name").equals("Linux")) {
|
if (System.getProperty("os.name").equals("Linux")) {
|
||||||
directory = new File(dirLinux);
|
directory = new File(dirLinux);
|
||||||
configFile = new File(dirLinux + "/config.xml");
|
configFile = new File(dirLinux + "/config.xml");
|
||||||
|
@ -365,7 +365,7 @@ public class MainWindowController {
|
|||||||
courseTreeTable.getColumns().add(timeColumn);
|
courseTreeTable.getColumns().add(timeColumn);
|
||||||
courseTreeTable.getColumns().add(starsColumn);
|
courseTreeTable.getColumns().add(starsColumn);
|
||||||
courseTreeTable.getColumns().add(idColumn);
|
courseTreeTable.getColumns().add(idColumn);
|
||||||
courseTreeTable.getColumns().get(3).setVisible(false); //hide idColumn (important)
|
courseTreeTable.getColumns().get(3).setVisible(false); // the idColumn should not bee displayed
|
||||||
|
|
||||||
LOGGER.info("initializing UI done");
|
LOGGER.info("initializing UI done");
|
||||||
}
|
}
|
||||||
@ -409,21 +409,13 @@ public class MainWindowController {
|
|||||||
edit.setOnAction(new EventHandler<ActionEvent>() {
|
edit.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
|
try {
|
||||||
LOGGER.info("edit "+selectedGameTitleID);
|
LOGGER.info("edit "+selectedGameTitleID);
|
||||||
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);
|
String[] gameInfo = dbController.getGameInfo(selectedGameTitleID);
|
||||||
|
|
||||||
//new edit dialog
|
//new edit dialog
|
||||||
String headingText = "activate cloud savegame sync (beta)";
|
String headingText = "edit a game";
|
||||||
String bodyText = "You just activate the cloud savegame sync function of cemu_UI, "
|
String bodyText = "You can edit the tile and rom/cover path.";
|
||||||
+ "\nwhich is currently in beta. Are you sure you want to do this?";
|
|
||||||
JFXEditGameDialog editGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 350, 300,
|
JFXEditGameDialog editGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 350, 300,
|
||||||
1, MWC, main.primaryStage, main.pane);
|
1, MWC, main.primaryStage, main.pane);
|
||||||
editGameDialog.setTitle(gameInfo[0]);
|
editGameDialog.setTitle(gameInfo[0]);
|
||||||
@ -431,7 +423,31 @@ public class MainWindowController {
|
|||||||
editGameDialog.setRomPath(gameInfo[2]);
|
editGameDialog.setRomPath(gameInfo[2]);
|
||||||
editGameDialog.setTitleID(gameInfo[3]);
|
editGameDialog.setTitleID(gameInfo[3]);
|
||||||
editGameDialog.show();
|
editGameDialog.show();
|
||||||
|
} catch (Exception 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();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -873,7 +889,7 @@ public class MainWindowController {
|
|||||||
ZipFile zipFile = new ZipFile(source);
|
ZipFile zipFile = new ZipFile(source);
|
||||||
zipFile.extractAll(destination);
|
zipFile.extractAll(destination);
|
||||||
|
|
||||||
//rename zipfile
|
// rename zip-file
|
||||||
File course = new File(destination + "/course000");
|
File course = new File(destination + "/course000");
|
||||||
course.renameTo( new File(destination + "/" + courseName));
|
course.renameTo( new File(destination + "/" + courseName));
|
||||||
LOGGER.info("Added new course: " + courseName + ", full path is: " + destination + "/" + courseName);
|
LOGGER.info("Added new course: " + courseName + ", full path is: " + destination + "/" + courseName);
|
||||||
@ -963,10 +979,9 @@ public class MainWindowController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
void addBtnAction(ActionEvent event){
|
void addBtnAction(ActionEvent event){
|
||||||
String headingText = "activate cloud savegame sync (beta)";
|
String headingText = "add a new game to cemu_UI";
|
||||||
String bodyText = "You just activate the cloud savegame sync function of cemu_UI, "
|
String bodyText = "";
|
||||||
+ "\nwhich is currently in beta. Are you sure you want to do this?";
|
JFXEditGameDialog addGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 450, 300,
|
||||||
JFXEditGameDialog addGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 350, 300,
|
|
||||||
0, this, main.primaryStage, main.pane);
|
0, this, main.primaryStage, main.pane);
|
||||||
addGameDialog.show();
|
addGameDialog.show();
|
||||||
}
|
}
|
||||||
@ -1108,8 +1123,10 @@ public class MainWindowController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// setting total playtime, if total playtime > 60 minutes, format is "x hours x minutes" (x h x min),
|
/**
|
||||||
// else only minutes are showed
|
* setting total playtime, if total playtime > 60 minutes, format is "x hours x
|
||||||
|
* minutes" (x h x min), else only minutes are showed
|
||||||
|
*/
|
||||||
if (Integer.parseInt(dbController.getTotalPlaytime(titleID)) > 60) {
|
if (Integer.parseInt(dbController.getTotalPlaytime(titleID)) > 60) {
|
||||||
int hoursPlayed = (int) Math.floor(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;
|
int minutesPlayed = Integer.parseInt(dbController.getTotalPlaytime(titleID)) - 60 * hoursPlayed;
|
||||||
@ -1340,8 +1357,11 @@ public class MainWindowController {
|
|||||||
xPosHelper++;
|
xPosHelper++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// System.out.println("Breit: " + main.pane.getWidth());
|
// TODO needs testing
|
||||||
// System.out.println("Breit2: " + mainAnchorPane.getWidth());
|
System.out.println("Breit: " + main.pane.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);
|
||||||
|
Loading…
Reference in New Issue
Block a user