* fixed a few typos
* code clean up
This commit is contained in:
Jannik 2017-11-24 17:07:53 +01:00
parent ba9fd1bb32
commit 922b1443e1
2 changed files with 92 additions and 72 deletions

View File

@ -52,12 +52,12 @@ import javafx.scene.layout.AnchorPane;
public class Main extends Application { public class Main extends Application {
Stage primaryStage; Stage primaryStage;
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";
private File directory; private File directory;
private File configFile; private File configFile;
@ -89,10 +89,10 @@ public class Main extends Application {
primaryStage.setTitle("cemu_UI"); primaryStage.setTitle("cemu_UI");
// primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/resources/Homeflix_Icon_64x64.png"))); //adds application icon // primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/resources/Homeflix_Icon_64x64.png"))); //adds application icon
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");
@ -107,8 +107,8 @@ public class Main extends Application {
pictureCache= new File(dirWin+"/picture_cache"); pictureCache= new File(dirWin+"/picture_cache");
} }
//startup checks // startup checks
//check if client_secret.jason is present // check if client_secret.jason is present
if (Main.class.getResourceAsStream("/client_secret.json") == null) { if (Main.class.getResourceAsStream("/client_secret.json") == null) {
LOGGER.error("client_secret is missing!!!!!"); LOGGER.error("client_secret is missing!!!!!");
@ -156,7 +156,7 @@ public class Main extends Application {
} }
} }
//loading settings and initialize UI, dbController.main() loads all databases // loading settings and initialize UI, dbController.main() loads all databases
mainWindowController.loadSettings(); mainWindowController.loadSettings();
mainWindowController.checkAutoUpdate(); mainWindowController.checkAutoUpdate();
mainWindowController.initActions(); mainWindowController.initActions();
@ -168,17 +168,17 @@ public class Main extends Application {
} }
mainWindowController.addUIData(); mainWindowController.addUIData();
scene = new Scene(pane); //create new scene, append pane to scene scene = new Scene(pane); // create new scene, append pane to scene
scene.getStylesheets().add(Main.class.getResource("/css/MainWindows.css").toExternalForm()); scene.getStylesheets().add(Main.class.getResource("/css/MainWindows.css").toExternalForm());
primaryStage.setScene(scene); //append scene to stage primaryStage.setScene(scene); // append scene to stage
primaryStage.show(); //show stage primaryStage.show(); // show stage
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
private void firstStart(){ private void firstStart(){
Alert alert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser Alert alert = new Alert(AlertType.CONFIRMATION); // new alert with file-chooser
alert.setTitle("cemu_UI"); alert.setTitle("cemu_UI");
alert.setHeaderText("cemu installation"); alert.setHeaderText("cemu installation");
alert.setContentText("please select your cemu installation"); alert.setContentText("please select your cemu installation");
@ -193,7 +193,7 @@ public class Main extends Application {
mainWindowController.setCemuPath(null); mainWindowController.setCemuPath(null);
} }
Alert alert2 = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser Alert alert2 = new Alert(AlertType.CONFIRMATION); // new alert with file-chooser
alert2.setTitle("cemu_UI"); alert2.setTitle("cemu_UI");
alert2.setHeaderText("rom directory"); alert2.setHeaderText("rom directory");
alert2.setContentText("please select your rom directory"); alert2.setContentText("please select your rom directory");
@ -213,8 +213,8 @@ public class Main extends Application {
final ChangeListener<Number> widthListener = new ChangeListener<Number>() { final ChangeListener<Number> widthListener = new ChangeListener<Number>() {
final Timer timer = new Timer(); final Timer timer = new Timer();
TimerTask saveTask = null; //task to execute save operation TimerTask saveTask = null; // task to execute save operation
final long delayTime = 500; //delay until the window size is saved, if the window is resized earlier it will be killed, default is 500ms final long delayTime = 500; // delay until the window size is saved, if the window is resized earlier it will be killed, default is 500ms
@Override @Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, final Number newValue) { public void changed(ObservableValue<? extends Number> observable, Number oldValue, final Number newValue) {
@ -222,12 +222,12 @@ public class Main extends Application {
mainWindowController.refreshplayBtnPosition(); mainWindowController.refreshplayBtnPosition();
//call only if there is enough space for a new row // call only if there is enough space for a new row
if (mainWindowController.getOldXPosHelper() != xPosHelperMax) { if (mainWindowController.getOldXPosHelper() != xPosHelperMax) {
mainWindowController.refreshUIData(); mainWindowController.refreshUIData();
} }
//if saveTask is already running kill it // if saveTask is already running kill it
if (saveTask != null) saveTask.cancel(); if (saveTask != null) saveTask.cancel();
saveTask = new TimerTask() { saveTask = new TimerTask() {
@ -243,8 +243,8 @@ public class Main extends Application {
final ChangeListener<Number> heightListener = new ChangeListener<Number>() { final ChangeListener<Number> heightListener = new ChangeListener<Number>() {
final Timer timer = new Timer(); final Timer timer = new Timer();
TimerTask saveTask = null; //task to execute save operation TimerTask saveTask = null; // task to execute save operation
final long delayTime = 500; //delay until the window size is saved, if the window is resized earlier it will be killed, default is 500ms final long delayTime = 500; // delay until the window size is saved, if the window is resized earlier it will be killed, default is 500ms
@Override @Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, final Number newValue) { public void changed(ObservableValue<? extends Number> observable, Number oldValue, final Number newValue) {
@ -278,14 +278,14 @@ public class Main extends Application {
} }
}; };
//add listener to primaryStage // add listener to primaryStage
primaryStage.widthProperty().addListener(widthListener); primaryStage.widthProperty().addListener(widthListener);
primaryStage.heightProperty().addListener(heightListener); primaryStage.heightProperty().addListener(heightListener);
primaryStage.maximizedProperty().addListener(maximizeListener); primaryStage.maximizedProperty().addListener(maximizeListener);
} }
public static void main(String[] args) { public static void main(String[] args) {
//delete old log file and create new // delete old log file and create new
if(System.getProperty("os.name").equals("Linux")){ if(System.getProperty("os.name").equals("Linux")){
System.setProperty("logFilename", System.getProperty("user.home") + "/cemu_UI/app.log"); System.setProperty("logFilename", System.getProperty("user.home") + "/cemu_UI/app.log");
File logFile = new File(System.getProperty("user.home") + "/cemu_UI/app.log"); File logFile = new File(System.getProperty("user.home") + "/cemu_UI/app.log");

View File

@ -261,7 +261,7 @@ public class MainWindowController {
private boolean useBeta = false; private boolean useBeta = false;
private boolean fullscreen; private boolean fullscreen;
private boolean cloudSync; private boolean cloudSync;
private String cloudService = ""; //set cloud provider (at the moment only GoogleDrive, Dropbox is planed) private String cloudService = ""; // set cloud provider (at the moment only GoogleDrive, Dropbox is planed)
private String cemuPath; private String cemuPath;
private String romPath; private String romPath;
private String gameExecutePath; private String gameExecutePath;
@ -289,7 +289,7 @@ public class MainWindowController {
private File pictureCacheWin = new File(dirWin+"/picture_cache"); private File pictureCacheWin = new File(dirWin+"/picture_cache");
private File pictureCacheLinux = new File(dirLinux+"/picture_cache"); private File pictureCacheLinux = new File(dirLinux+"/picture_cache");
private ObservableList<String> branches = FXCollections.observableArrayList("stable", "beta"); private ObservableList<String> branches = FXCollections.observableArrayList("stable", "beta");
private ObservableList<String> smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); //TODO add more IDs private ObservableList<String> smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); // TODO add more IDs
private ObservableList<UIROMDataType> games = FXCollections.observableArrayList(); private ObservableList<UIROMDataType> games = FXCollections.observableArrayList();
ObservableList<SmmdbApiDataType> courses = FXCollections.observableArrayList(); ObservableList<SmmdbApiDataType> courses = FXCollections.observableArrayList();
ArrayList<Text> courseText = new ArrayList<Text>(); ArrayList<Text> courseText = new ArrayList<Text>();
@ -347,7 +347,7 @@ public class MainWindowController {
applyColor(); applyColor();
//initialize courseTable // initialize courseTable
titleColumn.setPrefWidth(160); titleColumn.setPrefWidth(160);
timeColumn.setPrefWidth(127); timeColumn.setPrefWidth(127);
starsColumn.setPrefWidth(100); starsColumn.setPrefWidth(100);
@ -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");
} }
@ -408,22 +408,14 @@ 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) {
LOGGER.info("edit "+selectedGameTitleID); try {
if (selectedGameTitleID == null) { LOGGER.info("edit "+selectedGameTitleID);
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();
// }
} }
}); });
@ -457,11 +473,11 @@ public class MainWindowController {
Optional<ButtonType> result = alert.showAndWait(); Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){ if (result.get() == ButtonType.OK){
try { try {
//remove game from database // remove game from database
games.remove(selectedUIDataIndex); games.remove(selectedUIDataIndex);
dbController.removeRom(selectedGameTitleID); dbController.removeRom(selectedGameTitleID);
//refresh all games at gamesAnchorPane (UI) // refresh all games at gamesAnchorPane (UI)
refreshUIData(); refreshUIData();
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("error!",e); LOGGER.error("error!",e);
@ -491,7 +507,7 @@ public class MainWindowController {
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;
@ -510,7 +526,7 @@ public class MainWindowController {
LOGGER.info("copying the content of " + updatePath + " to " + destDir.toString()); LOGGER.info("copying the content of " + updatePath + " to " + destDir.toString());
playBtn.setText("updating..."); playBtn.setText("updating...");
playBtn.setDisable(true); playBtn.setDisable(true);
FileUtils.copyDirectory(srcDir, destDir); //TODO progress indicator FileUtils.copyDirectory(srcDir, destDir); // TODO progress indicator
playBtn.setText("play"); playBtn.setText("play");
playBtn.setDisable(false); playBtn.setDisable(false);
LOGGER.info("copying files done!"); LOGGER.info("copying files done!");
@ -555,7 +571,7 @@ public class MainWindowController {
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();
String[] parts = selectedGameTitleID.split("-"); //split string into 2 parts at "-" String[] parts = selectedGameTitleID.split("-"); // split string into 2 parts at "-"
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")) {
@ -573,7 +589,7 @@ public class MainWindowController {
LOGGER.info("copying the content of " + dlcPath + " to " + destDir.toString()); LOGGER.info("copying the content of " + dlcPath + " to " + destDir.toString());
playBtn.setText("copying files..."); playBtn.setText("copying files...");
playBtn.setDisable(true); playBtn.setDisable(true);
FileUtils.copyDirectory(srcDir, destDir); //TODO progress indicator FileUtils.copyDirectory(srcDir, destDir); // TODO progress indicator
playBtn.setText("play"); playBtn.setText("play");
playBtn.setDisable(false); playBtn.setDisable(false);
LOGGER.info("copying files done!"); LOGGER.info("copying files done!");
@ -615,14 +631,14 @@ 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++) {
if (courses.get(i).getId() == id) { if (courses.get(i).getId() == id) {
@ -722,14 +738,14 @@ 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)
System.exit(0); //finishes itself System.exit(0); // finishes itself
} }
@FXML @FXML
void smmdbBtnAction() { void smmdbBtnAction() {
//show smmdbAnchorPane // show smmdbAnchorPane
if (smmdbTrue) { if (smmdbTrue) {
smmdbAnchorPane.setVisible(false); smmdbAnchorPane.setVisible(false);
smmdbTrue = false; smmdbTrue = false;
@ -737,16 +753,16 @@ public class MainWindowController {
smmdbAnchorPane.setVisible(true); smmdbAnchorPane.setVisible(true);
smmdbTrue = true; smmdbTrue = true;
//start query // start query
courses.removeAll(courses); courses.removeAll(courses);
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).getId(),
courses.get(i).getTime(), courses.get(i).getStars()); 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
} }
} }
} }
@ -779,7 +795,7 @@ public class MainWindowController {
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);
@ -797,8 +813,8 @@ public class MainWindowController {
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);
} }
@ -825,7 +841,7 @@ public class MainWindowController {
@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() + "/";
try { try {
@ -836,7 +852,7 @@ public class MainWindowController {
pm.setMillisToPopup(0); pm.setMillisToPopup(0);
pm.setMinimum(0); // tell the progress bar that we start at the beginning of the stream pm.setMinimum(0); // tell the progress bar that we start at the beginning of the stream
pm.setMaximum(conn.getContentLength()); // tell the progress bar the total number of bytes we are going to read. pm.setMaximum(conn.getContentLength()); // tell the progress bar the total number of bytes we are going to read.
FileUtils.copyInputStreamToFile(pmis, new File(downloadFileURL)); //download file + "/mlc01/emulatorSave" FileUtils.copyInputStreamToFile(pmis, new File(downloadFileURL)); // download file + "/mlc01/emulatorSave"
pmis.close(); pmis.close();
LOGGER.info("downloaded successfull"); LOGGER.info("downloaded successfull");
@ -853,7 +869,7 @@ public class MainWindowController {
if (smmDirectory.exists()) { if (smmDirectory.exists()) {
File[] courses = smmDirectory.listFiles(File::isDirectory); File[] courses = smmDirectory.listFiles(File::isDirectory);
//get all existing courses in smm directory, new name is highest number +1 // get all existing courses in smm directory, new name is highest number +1
for (int j = 0; j < courses.length; j++) { for (int j = 0; j < courses.length; j++) {
int courseNumber = Integer.parseInt(courses[j].getName().substring(6)); int courseNumber = Integer.parseInt(courses[j].getName().substring(6));
if (courseNumber > highestCourseNumber) { if (courseNumber > highestCourseNumber) {
@ -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);