minor fixes

* fixed a few typos
* fixed window is resiable to 0x0
* * formating work work
This commit is contained in:
Jannik 2018-02-04 15:19:36 +01:00
parent 54078eb99f
commit 2e3395caea
6 changed files with 49 additions and 49 deletions

View File

@ -180,6 +180,8 @@ public class Main extends Application {
scene = new Scene(pane); // create new scene, append pane to scene
scene.getStylesheets().add(Main.class.getResource("/css/MainWindows.css").toExternalForm());
primaryStage.setMinWidth(265.00);
primaryStage.setMinHeight(425.00);
primaryStage.setScene(scene); // append scene to stage
primaryStage.show(); // show stage
} catch (IOException e) {
@ -187,7 +189,7 @@ public class Main extends Application {
}
}
private void firstStart(){
private void firstStart() {
Alert alert = new Alert(AlertType.CONFIRMATION); // new alert with file-chooser
alert.setTitle("cemu_UI");
alert.setHeaderText("cemu installation");
@ -293,11 +295,11 @@ public class Main extends Application {
public static void main(String[] args) {
// delete old log file and create new
if(osName.equals("Linux")){
if (osName.equals("Linux")) {
System.setProperty("logFilename", userHome + "/cemu_UI/app.log");
File logFile = new File(userHome + "/cemu_UI/app.log");
logFile.delete();
}else{
} else {
System.setProperty("logFilename", userHome + "/Documents/cemu_UI/app.log");
File logFile = new File(userHome + "/Documents/cemu_UI/app.log");
logFile.delete();

View File

@ -1074,7 +1074,7 @@ public class MainWindowController {
} else {
cloudSyncToggleBtn.setSelected(false);
//cloud sync init error dialog
// cloud sync init error dialog
JFXInfoDialog cloudSyncErrorDialog = new JFXInfoDialog(cloudSyncErrorHeadingText,
cloudSyncErrorBodyText, dialogBtnStyle, 450, 170, main.getPane());
cloudSyncErrorDialog.show();

View File

@ -33,18 +33,17 @@ import javafx.application.Platform;
public class playGame extends Thread{
MainWindowController mainWindowController;
DBController dbController;
@SuppressWarnings("unused")
private MainWindowController mainWindowController;
private DBController dbController;
private static final Logger LOGGER = LogManager.getLogger(playGame.class.getName());
public playGame(MainWindowController m, com.cemu_UI.controller.DBController db){
public playGame(MainWindowController m, com.cemu_UI.controller.DBController db) {
mainWindowController = m;
dbController = db;
}
@Override
public void run(){
public void run() {
String selectedGameTitleID = mainWindowController.getSelectedGameTitleID();
String cemuBin = mainWindowController.getCemuPath() + "/Cemu.exe";
String gameExec = "\"" + mainWindowController.getGameExecutePath() + "\"";
@ -58,8 +57,7 @@ public class playGame extends Thread{
mainWindowController.main.getPrimaryStage().setIconified(true); // minimize cemu_UI
});
startTime = System.currentTimeMillis();
try{
try {
if (System.getProperty("os.name").equals("Linux")) {
if(mainWindowController.isFullscreen()){
p = new ProcessBuilder("wine", cemuBin, "-f", "-g", gameExec).start();
@ -74,19 +72,19 @@ public class playGame extends Thread{
}
}
p.waitFor();
p.waitFor(); // wait until cemu is closed so we can calculate the played time
endTime = System.currentTimeMillis();
timePlayedNow = (int) Math.floor(((endTime - startTime)/1000/60));
timePlayed = Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID))+timePlayedNow;
dbController.setTotalPlaytime(Integer.toString(timePlayed), selectedGameTitleID);
Platform.runLater(() -> {
if(Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID)) > 60){
int hoursPlayed = (int) Math.floor(Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID))/60);
int minutesPlayed = Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID))-60*hoursPlayed;
mainWindowController.totalPlaytimeBtn.setText(hoursPlayed+"h "+minutesPlayed+"min");
}else{
mainWindowController.totalPlaytimeBtn.setText(dbController.getTotalPlaytime(selectedGameTitleID)+ " min");
if (Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID)) > 60) {
int hoursPlayed = (int) Math.floor(Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID)) / 60);
int minutesPlayed = Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID)) - 60 * hoursPlayed;
mainWindowController.totalPlaytimeBtn.setText(hoursPlayed + "h " + minutesPlayed + "min");
} else {
mainWindowController.totalPlaytimeBtn.setText(dbController.getTotalPlaytime(selectedGameTitleID) + " min");
}
mainWindowController.main.getPrimaryStage().setIconified(false); // maximize cemu_UI
});
@ -98,8 +96,8 @@ public class playGame extends Thread{
mainWindowController.getCemuPath(), mainWindowController.main.getDirectory().getPath());
}
}catch (IOException | InterruptedException e){
e.printStackTrace();
} catch (IOException | InterruptedException e) {
LOGGER.error(e);
}
}

View File

@ -66,7 +66,7 @@ public class DBController {
* load ROM and games database
* load all games
*/
public void init(){
public void init() {
LOGGER.info("<========== starting loading sql ==========>");
loadRomDatabase();
loadGamesDatabase();
@ -79,18 +79,18 @@ public class DBController {
*
* TODO this should be called LocalGames
*/
private void loadRomDatabase(){
private void loadRomDatabase() {
if (System.getProperty("os.name").equals("Linux")) {
DB_PATH_localRoms = System.getProperty("user.home") + "/cemu_UI/localRoms.db";
}else{
} else {
DB_PATH_localRoms = System.getProperty("user.home") + "\\Documents\\cemu_UI" + "\\" + "localRoms.db";
}
try {
// create a database connection
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH_localRoms);
connection.setAutoCommit(false); //AutoCommit to false -> manual commit is active
connection.setAutoCommit(false); // AutoCommit to false -> manual commit is active
} catch (SQLException e) {
// if the error message is "out of memory", it probably means no database file is found
// if the error message is "out of memory", probably no database file is found
LOGGER.error("error while loading the ROM database", e);
}
LOGGER.info("ROM database loaded successfull");

View File

@ -18,7 +18,7 @@
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.TextFlow?>
<AnchorPane fx:id="mainAnchorPane" prefHeight="600.0" prefWidth="904.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.cemu_UI.application.MainWindowController">
<AnchorPane fx:id="mainAnchorPane" minHeight="405.0" minWidth="260.0" prefHeight="600.0" prefWidth="904.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.cemu_UI.application.MainWindowController">
<children>
<ScrollPane fx:id="mainScrollPane" fitToWidth="true" layoutY="38.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
<content>

View File

@ -33,7 +33,7 @@ timeColumn = time
# Strings
editHeadingText = edit
editBodyText = You can edit the tile and rom/cover path.
editBodyText = You can edit the tile and ROM/cover path.
removeHeadingText = remove
removeBodyText = Are you sure you want to delete
addUpdateHeadingText = update
@ -49,15 +49,15 @@ aboutBtnHeadingText = cemu_UI
aboutBtnBodyText = This Application is made with free Software\nand licensed under the terms of GNU GPL 3.\n\nwww.kellerkinder.xyz
cloudSyncWaringHeadingText = activate cloud savegame sync (beta)
cloudSyncWaringBodyText = WARNING this is a completly WIP cloud save integration,\nit's NOT recomended to use this!!\n\nUse it on your own risk and backup everthing before!
cloudSyncWaringBodyText = WARNING this is a completely WIP cloud save integration,\nit's NOT recommended to use this!!\n\nUse it on your own risk and backup everything before!
cloudSyncErrorHeadingText = Error while initializing cloud sync!
cloudSyncErrorBodyText = There was some truble while initializing cloud sync.\nPlease upload the app.log (which can be found in the cemu_UI directory)\nto \"https://github.com/Seil0/cemu_UI/issues\" so we can fix this.
cloudSyncErrorBodyText = There was some trouble while initializing cloud sync.\nPlease upload the app.log (which can be found in the cemu_UI directory)\nto \"https://github.com/Seil0/cemu_UI/issues\" so we can fix this.
addGameBtnHeadingText = add a new game to cemu_UI
addGameBtnBodyText =
addBtnReturnErrorHeadingText = Error while adding a new Game!
addBtnReturnErrorBodyText = There was some truble adding your game.\nOne of the needed values was empty, please try again to add your game.
addBtnReturnErrorBodyText = There was some trouble adding your game.\nOne of the needed values was empty, please try again to add your game.
lastPlayed = Last played,
today = today
yesterday = yesterday
@ -82,6 +82,6 @@ titleID = title ID
romPath = ROM path
coverPath = cover path
editGameDialogHeadingTextError = Error while adding a new Game!
editGameDialogBodyTextError = There was some truble adding your game.\nOne of the needed values was empty, please try again to add your game.
editGameDialogBodyTextError = There was some trouble adding your game.\nOne of the needed values was empty, please try again to add your game.
editGameDialogSelectPathBtn = select .rpx file
editGameDialogSelectCoverBtn = select cover file