added time played in total, code clean up
time played in total, current way is not really nice maybe will be change in a future update
This commit is contained in:
parent
fab1d2d062
commit
7bbe781645
|
@ -43,6 +43,11 @@
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
|
<JFXButton fx:id="reloadRomsBtn" onAction="#reloadRomsBtnAction" prefHeight="38.0" prefWidth="150.0" text="reload roms">
|
||||||
|
<font>
|
||||||
|
<Font name="System Bold" size="14.0" />
|
||||||
|
</font>
|
||||||
|
</JFXButton>
|
||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
<AnchorPane fx:id="settingsAnchorPane" layoutX="38.0" layoutY="27.0" prefHeight="573.0" prefWidth="862.0" style="-fx-background-color: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
<AnchorPane fx:id="settingsAnchorPane" layoutX="38.0" layoutY="27.0" prefHeight="573.0" prefWidth="862.0" style="-fx-background-color: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
||||||
|
@ -60,9 +65,6 @@
|
||||||
</font>
|
</font>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="timePlayedBtn" buttonType="RAISED" layoutX="341.0" layoutY="588.0" onAction="#timePlayedBtnAction" prefHeight="32.0" prefWidth="100.0" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="516.5" AnchorPane.topAnchor="558.0">
|
<JFXButton fx:id="timePlayedBtn" buttonType="RAISED" layoutX="341.0" layoutY="588.0" onAction="#timePlayedBtnAction" prefHeight="32.0" prefWidth="100.0" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="516.5" AnchorPane.topAnchor="558.0">
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="14.0" />
|
|
||||||
</font>
|
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" maxHeight="32.0" onAction="#lastTimePlayedBtnAction" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="516.5" AnchorPane.topAnchor="558.0" />
|
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" maxHeight="32.0" onAction="#lastTimePlayedBtnAction" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="516.5" AnchorPane.topAnchor="558.0" />
|
||||||
</children>
|
</children>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -43,6 +43,11 @@
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
|
<JFXButton fx:id="reloadRomsBtn" onAction="#reloadRomsBtnAction" prefHeight="38.0" prefWidth="150.0" text="reload roms">
|
||||||
|
<font>
|
||||||
|
<Font name="System Bold" size="14.0" />
|
||||||
|
</font>
|
||||||
|
</JFXButton>
|
||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
<AnchorPane fx:id="settingsAnchorPane" layoutX="38.0" layoutY="27.0" prefHeight="573.0" prefWidth="862.0" style="-fx-background-color: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
<AnchorPane fx:id="settingsAnchorPane" layoutX="38.0" layoutY="27.0" prefHeight="573.0" prefWidth="862.0" style="-fx-background-color: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
||||||
|
@ -60,9 +65,6 @@
|
||||||
</font>
|
</font>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="timePlayedBtn" buttonType="RAISED" layoutX="341.0" layoutY="588.0" onAction="#timePlayedBtnAction" prefHeight="32.0" prefWidth="100.0" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="516.5" AnchorPane.topAnchor="558.0">
|
<JFXButton fx:id="timePlayedBtn" buttonType="RAISED" layoutX="341.0" layoutY="588.0" onAction="#timePlayedBtnAction" prefHeight="32.0" prefWidth="100.0" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="516.5" AnchorPane.topAnchor="558.0">
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="14.0" />
|
|
||||||
</font>
|
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" maxHeight="32.0" onAction="#lastTimePlayedBtnAction" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="516.5" AnchorPane.topAnchor="558.0" />
|
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" maxHeight="32.0" onAction="#lastTimePlayedBtnAction" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="516.5" AnchorPane.topAnchor="558.0" />
|
||||||
</children>
|
</children>
|
||||||
|
|
|
@ -63,6 +63,9 @@ public class MainWindowController {
|
||||||
@FXML
|
@FXML
|
||||||
private JFXButton addBtn;
|
private JFXButton addBtn;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private JFXButton reloadRomsBtn;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private JFXButton cemuTFBtn;
|
private JFXButton cemuTFBtn;
|
||||||
|
|
||||||
|
@ -148,7 +151,7 @@ public class MainWindowController {
|
||||||
|
|
||||||
public void setMain(Main main) {
|
public void setMain(Main main) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
dbController = new dbController(this);
|
dbController = new dbController(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initUI(){
|
void initUI(){
|
||||||
|
@ -157,6 +160,7 @@ public class MainWindowController {
|
||||||
colorPicker.setValue(Color.valueOf(getColor()));
|
colorPicker.setValue(Color.valueOf(getColor()));
|
||||||
fullscreenToggleBtn.setSelected(isFullscreen());
|
fullscreenToggleBtn.setSelected(isFullscreen());
|
||||||
addDLC.setDisable(true);
|
addDLC.setDisable(true);
|
||||||
|
edit.setDisable(true);
|
||||||
applyColor();
|
applyColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +171,6 @@ public class MainWindowController {
|
||||||
menuHam.addEventHandler(MouseEvent.MOUSE_PRESSED, (e)->{
|
menuHam.addEventHandler(MouseEvent.MOUSE_PRESSED, (e)->{
|
||||||
if(playTrue){
|
if(playTrue){
|
||||||
playBtnSlideOut();
|
playBtnSlideOut();
|
||||||
lastTimePlayedBtnSlideOut();
|
|
||||||
}
|
}
|
||||||
if(menuTrue == false){
|
if(menuTrue == false){
|
||||||
sideMenuSlideIn();
|
sideMenuSlideIn();
|
||||||
|
@ -201,12 +204,7 @@ public class MainWindowController {
|
||||||
alert.initOwner(main.primaryStage);
|
alert.initOwner(main.primaryStage);
|
||||||
alert.showAndWait();
|
alert.showAndWait();
|
||||||
}else{
|
}else{
|
||||||
System.out.println("show edit window TODO!");
|
System.out.println("show edit window TODO!"); //TODO
|
||||||
double i = 13;
|
|
||||||
double j = 4;
|
|
||||||
i = i/j;
|
|
||||||
System.out.println(Math.ceil(i)); //aufrunden
|
|
||||||
System.out.println(Math.floor(i)); //abrunden
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -226,14 +224,39 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
int i = gameCover.indexOf((selectedEvent).getSource());
|
int i = gameCover.indexOf((selectedEvent).getSource());
|
||||||
gameVBox.remove(i);
|
|
||||||
gameCover.remove(i);
|
Alert alert = new Alert(AlertType.CONFIRMATION);
|
||||||
gameLabel.remove(i);
|
alert.setTitle("remove");
|
||||||
// dbController.removeRom(selectedGameTitleID);
|
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 {
|
||||||
|
gameVBox.remove(i);
|
||||||
|
gameCover.remove(i);
|
||||||
|
gameLabel.remove(i);
|
||||||
|
dbController.removeRom(selectedGameTitleID);
|
||||||
|
gamesAnchorPane.getChildren().remove(i);
|
||||||
|
|
||||||
|
//TODO remove if animations are done
|
||||||
|
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs)
|
||||||
|
System.exit(0); //finishes itself
|
||||||
|
|
||||||
|
} catch (SQLException | IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//TODO nachrück animation
|
//TODO nachrück animation
|
||||||
// platz(i)/4 -> aufrunden = Reihe; plath(i)-(platz(i)/4 -> abrunden*4)
|
// platz(i)/4 -> aufrunden = Reihe; plath(i)-(platz(i)/4 -> abrunden*4)
|
||||||
// jetzt haben wir den platz des gelöschten elements und lönnen alle nachfolgenden nachrücken
|
// jetzt haben wir den platz des gelöschten elements und lönnen alle nachfolgenden nachrücken
|
||||||
gamesAnchorPane.getChildren().remove(i);
|
// double a = 13;
|
||||||
|
// double b = 4;
|
||||||
|
// a = a/b;
|
||||||
|
// System.out.println(Math.ceil(a)); //aufrunden
|
||||||
|
// System.out.println(Math.floor(a)); //abrunden
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -256,7 +279,7 @@ public class MainWindowController {
|
||||||
Alert updateAlert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
|
Alert updateAlert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
|
||||||
updateAlert.setTitle("cemu_UI");
|
updateAlert.setTitle("cemu_UI");
|
||||||
updateAlert.setHeaderText("update "+selectedGameTitle);
|
updateAlert.setHeaderText("update "+selectedGameTitle);
|
||||||
updateAlert.setContentText("pleas select the update directory");
|
updateAlert.setContentText("pleas select the update root directory");
|
||||||
updateAlert.initOwner(main.primaryStage);
|
updateAlert.initOwner(main.primaryStage);
|
||||||
|
|
||||||
Optional<ButtonType> result = updateAlert.showAndWait();
|
Optional<ButtonType> result = updateAlert.showAndWait();
|
||||||
|
@ -306,7 +329,6 @@ public class MainWindowController {
|
||||||
public void handle(MouseEvent event) {
|
public void handle(MouseEvent event) {
|
||||||
if (playTrue) {
|
if (playTrue) {
|
||||||
playBtnSlideOut();
|
playBtnSlideOut();
|
||||||
lastTimePlayedBtnSlideOut();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -316,7 +338,6 @@ public class MainWindowController {
|
||||||
public void handle(MouseEvent event) {
|
public void handle(MouseEvent event) {
|
||||||
if (playTrue) {
|
if (playTrue) {
|
||||||
playBtnSlideOut();
|
playBtnSlideOut();
|
||||||
lastTimePlayedBtnSlideOut();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -329,28 +350,13 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
void playBtnAction(ActionEvent event){
|
void aboutBtnAction(){
|
||||||
dbController.setLastPlayed(selectedGameTitleID);
|
Alert alert = new Alert(AlertType.INFORMATION);
|
||||||
try{
|
alert.setTitle("about");
|
||||||
if(fullscreen){
|
alert.setHeaderText("cemu_UI");
|
||||||
Runtime.getRuntime().exec(getCemuPath()+"\\Cemu.exe -f -g \""+gameExecutePath+"\"");
|
alert.setContentText("cemu_UI by @Seil0 \npre release 0.1.1 \nwww.kellerkinder.xyz");
|
||||||
}else{
|
alert.initOwner(main.primaryStage);
|
||||||
Runtime.getRuntime().exec(getCemuPath()+"\\Cemu.exe -g \""+gameExecutePath+"\"");
|
alert.showAndWait();
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
//Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
void timePlayedBtnAction(ActionEvent event){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
void lastTimePlayedBtnAction(ActionEvent event){
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -367,13 +373,57 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
void aboutBtnAction(){
|
void reloadRomsBtnAction() throws IOException{
|
||||||
Alert alert = new Alert(AlertType.INFORMATION);
|
dbController.loadRomDirectory(getRomPath());
|
||||||
alert.setTitle("about");
|
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs)
|
||||||
alert.setHeaderText("cemu_UI");
|
System.exit(0); //finishes itself
|
||||||
alert.setContentText("cemu_UI by @Seil0 \npre release 0.1.0 \nwww.kellerkinder.xyz");
|
}
|
||||||
alert.initOwner(main.primaryStage);
|
|
||||||
alert.showAndWait();
|
@FXML
|
||||||
|
void playBtnAction(ActionEvent event) throws InterruptedException, IOException{
|
||||||
|
dbController.setLastPlayed(selectedGameTitleID);
|
||||||
|
long startTime;
|
||||||
|
long endTime;
|
||||||
|
int playedTime;
|
||||||
|
int timePlayed;
|
||||||
|
Process p;
|
||||||
|
|
||||||
|
main.primaryStage.setIconified(true);
|
||||||
|
startTime = System.currentTimeMillis();
|
||||||
|
try{
|
||||||
|
|
||||||
|
if(fullscreen){
|
||||||
|
p = Runtime.getRuntime().exec(getCemuPath()+"\\Cemu.exe -f -g \""+gameExecutePath+"\"");
|
||||||
|
}else{
|
||||||
|
p = Runtime.getRuntime().exec(getCemuPath()+"\\Cemu.exe -g \""+gameExecutePath+"\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
p.waitFor();
|
||||||
|
endTime = System.currentTimeMillis();
|
||||||
|
playedTime = (int) Math.floor(((endTime - startTime)/1000/60));
|
||||||
|
System.out.println((endTime - startTime)/1000+"; "+(endTime - startTime)/1000/60+"; "+playedTime);
|
||||||
|
|
||||||
|
|
||||||
|
timePlayed = Integer.parseInt(dbController.getTimePlayed(selectedGameTitleID))+playedTime;
|
||||||
|
System.out.println(timePlayed);
|
||||||
|
|
||||||
|
dbController.setTimePlayed(Integer.toString(timePlayed), selectedGameTitleID);
|
||||||
|
timePlayedBtn.setText(dbController.getTimePlayed(selectedGameTitleID)+ " min");
|
||||||
|
main.primaryStage.setIconified(false);
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
void timePlayedBtnAction(ActionEvent event){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
void lastTimePlayedBtnAction(ActionEvent event){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -483,7 +533,7 @@ public class MainWindowController {
|
||||||
Alert romAlert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
|
Alert romAlert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
|
||||||
romAlert.setTitle("cemu_UI");
|
romAlert.setTitle("cemu_UI");
|
||||||
romAlert.setHeaderText("add new Game");
|
romAlert.setHeaderText("add new Game");
|
||||||
romAlert.setContentText("pleas select the .rpx file from the Game you whish to add");
|
romAlert.setContentText("Please select the .rpx file from the game you want to add.");
|
||||||
romAlert.initOwner(main.primaryStage);
|
romAlert.initOwner(main.primaryStage);
|
||||||
|
|
||||||
Optional<ButtonType> result = romAlert.showAndWait();
|
Optional<ButtonType> result = romAlert.showAndWait();
|
||||||
|
@ -500,7 +550,7 @@ public class MainWindowController {
|
||||||
Alert coverAlert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
|
Alert coverAlert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
|
||||||
coverAlert.setTitle("cemu_UI");
|
coverAlert.setTitle("cemu_UI");
|
||||||
coverAlert.setHeaderText("add new Game");
|
coverAlert.setHeaderText("add new Game");
|
||||||
coverAlert.setContentText("pleas select the cover for the Game you whish to add");
|
coverAlert.setContentText("Please select the cover for the game you want to add.");
|
||||||
coverAlert.initOwner(main.primaryStage);
|
coverAlert.initOwner(main.primaryStage);
|
||||||
|
|
||||||
Optional<ButtonType> coverResult = coverAlert.showAndWait();
|
Optional<ButtonType> coverResult = coverAlert.showAndWait();
|
||||||
|
@ -585,6 +635,7 @@ public class MainWindowController {
|
||||||
|
|
||||||
if(dbController.getLastPlayed(titleID).equals("") || dbController.getLastPlayed(titleID).equals(null)){
|
if(dbController.getLastPlayed(titleID).equals("") || dbController.getLastPlayed(titleID).equals(null)){
|
||||||
lastTimePlayedBtn.setText("Last played, never");
|
lastTimePlayedBtn.setText("Last played, never");
|
||||||
|
timePlayedBtn.setText(dbController.getTimePlayed(titleID)+ " min");
|
||||||
}else{
|
}else{
|
||||||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
|
||||||
|
@ -598,11 +649,12 @@ public class MainWindowController {
|
||||||
}else{
|
}else{
|
||||||
lastTimePlayedBtn.setText("Last played, "+dbController.getLastPlayed(titleID));
|
lastTimePlayedBtn.setText("Last played, "+dbController.getLastPlayed(titleID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timePlayedBtn.setText(dbController.getTimePlayed(titleID)+ " min");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(playTrue == false){
|
if(playTrue == false){
|
||||||
playBtnSlideIn(); //TODO anderes design(mehr details spielzeit, etc.)
|
playBtnSlideIn();
|
||||||
lastTimePlayedBtnSlideIn();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -639,12 +691,13 @@ public class MainWindowController {
|
||||||
cemuTextField.setFocusColor(Color.valueOf(getColor()));
|
cemuTextField.setFocusColor(Color.valueOf(getColor()));
|
||||||
romTextField.setFocusColor(Color.valueOf(getColor()));
|
romTextField.setFocusColor(Color.valueOf(getColor()));
|
||||||
|
|
||||||
|
aboutBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
settingsBtn.setStyle("-fx-text-fill: BLACK;");
|
settingsBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
addBtn.setStyle("-fx-text-fill: BLACK;");
|
addBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
|
reloadRomsBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
playBtn.setStyle("-fx-text-fill: BLACK;");
|
playBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
cemuTFBtn.setStyle(btnStyleBlack);
|
cemuTFBtn.setStyle(btnStyleBlack);
|
||||||
romTFBtn.setStyle(btnStyleBlack);
|
romTFBtn.setStyle(btnStyleBlack);
|
||||||
aboutBtn.setStyle(btnStyleBlack);
|
|
||||||
playBtn.setStyle(btnStyleBlack);
|
playBtn.setStyle(btnStyleBlack);
|
||||||
|
|
||||||
lastTimePlayedBtn.setStyle(timeBtnStyle);
|
lastTimePlayedBtn.setStyle(timeBtnStyle);
|
||||||
|
@ -734,51 +787,42 @@ public class MainWindowController {
|
||||||
|
|
||||||
private void playBtnSlideIn(){
|
private void playBtnSlideIn(){
|
||||||
playBtn.setVisible(true);
|
playBtn.setVisible(true);
|
||||||
|
lastTimePlayedBtn.setVisible(true);
|
||||||
|
timePlayedBtn.setVisible(true);
|
||||||
playTrue = true;
|
playTrue = true;
|
||||||
TranslateTransition translateTransition = new TranslateTransition(Duration.millis(300), playBtn);
|
|
||||||
translateTransition.setFromY(55);
|
TranslateTransition playBtnTransition = new TranslateTransition(Duration.millis(300), playBtn);
|
||||||
translateTransition.setToY(0);
|
playBtnTransition.setFromY(55);
|
||||||
translateTransition.play();
|
playBtnTransition.setToY(0);
|
||||||
|
playBtnTransition.play();
|
||||||
|
|
||||||
|
TranslateTransition lastTimePlayedBtnTransition = new TranslateTransition(Duration.millis(300), lastTimePlayedBtn);
|
||||||
|
lastTimePlayedBtnTransition.setFromY(55);
|
||||||
|
lastTimePlayedBtnTransition.setToY(0);
|
||||||
|
lastTimePlayedBtnTransition.play();
|
||||||
|
|
||||||
|
TranslateTransition timePlayedBtnTransition = new TranslateTransition(Duration.millis(300), timePlayedBtn);
|
||||||
|
timePlayedBtnTransition.setFromY(55);
|
||||||
|
timePlayedBtnTransition.setToY(0);
|
||||||
|
timePlayedBtnTransition.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playBtnSlideOut(){
|
private void playBtnSlideOut(){
|
||||||
playTrue = false;
|
playTrue = false;
|
||||||
TranslateTransition translateTransition = new TranslateTransition(Duration.millis(300), playBtn);
|
TranslateTransition playBtnTransition = new TranslateTransition(Duration.millis(300), playBtn);
|
||||||
translateTransition.setFromY(0);
|
playBtnTransition.setFromY(0);
|
||||||
translateTransition.setToY(56);
|
playBtnTransition.setToY(56);
|
||||||
translateTransition.play();
|
playBtnTransition.play();
|
||||||
}
|
|
||||||
|
TranslateTransition lastTimePlayedBtnTransition = new TranslateTransition(Duration.millis(300), lastTimePlayedBtn);
|
||||||
@SuppressWarnings("unused")
|
lastTimePlayedBtnTransition.setFromY(0);
|
||||||
private void timePlayedBtnSlideIn(){
|
lastTimePlayedBtnTransition.setToY(56);
|
||||||
timePlayedBtn.setVisible(true);
|
lastTimePlayedBtnTransition.play();
|
||||||
TranslateTransition translateTransition = new TranslateTransition(Duration.millis(300), timePlayedBtn);
|
|
||||||
translateTransition.setFromY(55);
|
TranslateTransition timePlayedBtnTransition = new TranslateTransition(Duration.millis(300), timePlayedBtn);
|
||||||
translateTransition.setToY(0);
|
timePlayedBtnTransition.setFromY(0);
|
||||||
translateTransition.play();
|
timePlayedBtnTransition.setToY(56);
|
||||||
}
|
timePlayedBtnTransition.play();
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private void timePlayedBtnSlideOut(){
|
|
||||||
TranslateTransition translateTransition = new TranslateTransition(Duration.millis(300), timePlayedBtn);
|
|
||||||
translateTransition.setFromY(0);
|
|
||||||
translateTransition.setToY(56);
|
|
||||||
translateTransition.play();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void lastTimePlayedBtnSlideIn(){
|
|
||||||
lastTimePlayedBtn.setVisible(true);
|
|
||||||
TranslateTransition translateTransition = new TranslateTransition(Duration.millis(300), lastTimePlayedBtn);
|
|
||||||
translateTransition.setFromY(55);
|
|
||||||
translateTransition.setToY(0);
|
|
||||||
translateTransition.play();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void lastTimePlayedBtnSlideOut(){
|
|
||||||
TranslateTransition translateTransition = new TranslateTransition(Duration.millis(300), lastTimePlayedBtn);
|
|
||||||
translateTransition.setFromY(0);
|
|
||||||
translateTransition.setToY(56);
|
|
||||||
translateTransition.play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editColor(String input){
|
private void editColor(String input){
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.sql.DriverManager;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
@ -28,6 +29,7 @@ public class dbController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private MainWindowController mainWindowController;
|
private MainWindowController mainWindowController;
|
||||||
|
private ArrayList<String> entries = new ArrayList<>();
|
||||||
private String DB_PATH;
|
private String DB_PATH;
|
||||||
private String DB_PATH_games;
|
private String DB_PATH_games;
|
||||||
private Connection connection = null;
|
private Connection connection = null;
|
||||||
|
@ -38,7 +40,6 @@ public class dbController {
|
||||||
loadRomDatabase();
|
loadRomDatabase();
|
||||||
loadGamesDatabase();
|
loadGamesDatabase();
|
||||||
createRomDatabase();
|
createRomDatabase();
|
||||||
loadRomDirectory(mainWindowController.getRomPath());
|
|
||||||
loadRoms();
|
loadRoms();
|
||||||
checkRemoveEntry();
|
checkRemoveEntry();
|
||||||
System.out.println("<==========finished loading sql==========>");
|
System.out.println("<==========finished loading sql==========>");
|
||||||
|
@ -82,6 +83,7 @@ public class dbController {
|
||||||
System.out.println("games database loaded successfull");
|
System.out.println("games database loaded successfull");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//creating database, if db has 0 entries search for all .rpx files in the roms directory and add them
|
||||||
void createRomDatabase() {
|
void createRomDatabase() {
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
|
@ -91,6 +93,22 @@ public class dbController {
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Statement stmt = connection.createStatement();
|
||||||
|
ResultSet rs = stmt.executeQuery("SELECT * FROM local_roms");
|
||||||
|
while (rs.next()) {
|
||||||
|
entries.add(rs.getString(2));
|
||||||
|
}
|
||||||
|
stmt.close();
|
||||||
|
rs.close();
|
||||||
|
}catch (SQLException ea){
|
||||||
|
System.err.println("Ups! an error occured!");
|
||||||
|
ea.printStackTrace();
|
||||||
|
}
|
||||||
|
if(entries.size() == 0){
|
||||||
|
loadRomDirectory(mainWindowController.getRomPath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addRom(String title, String coverPath, String romPath, String titleID, String productCode, String region, String lastPlayed, String timePlayed) throws SQLException{
|
void addRom(String title, String coverPath, String romPath, String titleID, String productCode, String region, String lastPlayed, String timePlayed) throws SQLException{
|
||||||
|
@ -181,7 +199,7 @@ public class dbController {
|
||||||
ImageIO.write(resizeImagePNG, "png", new File(pictureCache+"\\"+rs.getString(3)+".png")); //change path where you want it saved
|
ImageIO.write(resizeImagePNG, "png", new File(pictureCache+"\\"+rs.getString(3)+".png")); //change path where you want it saved
|
||||||
coverPath = pictureCache+"\\"+rs.getString(3)+".png";
|
coverPath = pictureCache+"\\"+rs.getString(3)+".png";
|
||||||
|
|
||||||
addRom(rs.getString(2), coverPath, file.getCanonicalPath(), rs.getString(1), rs.getString(3), rs.getString(5),"","");
|
addRom(rs.getString(2), coverPath, file.getCanonicalPath(), rs.getString(1), rs.getString(3), rs.getString(5),"","0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
|
@ -244,7 +262,7 @@ public class dbController {
|
||||||
void setTimePlayed(String timePlayed, String titleID){
|
void setTimePlayed(String timePlayed, String titleID){
|
||||||
try{
|
try{
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("UPDATE local_roms SET timePlayed='' WHERE titleID = '"+titleID+"';");
|
stmt.executeUpdate("UPDATE local_roms SET timePlayed='"+timePlayed+"' WHERE titleID = '"+titleID+"';");
|
||||||
connection.commit();
|
connection.commit();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
}catch(SQLException e){
|
}catch(SQLException e){
|
||||||
|
@ -257,7 +275,7 @@ public class dbController {
|
||||||
try{
|
try{
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("SELECT timePlayed FROM local_roms WHERE titleID = '"+titleID+"';" );
|
ResultSet rs = stmt.executeQuery("SELECT timePlayed FROM local_roms WHERE titleID = '"+titleID+"';" );
|
||||||
timePlayed = rs.getString(4);
|
timePlayed = rs.getString(1);
|
||||||
stmt.close();
|
stmt.close();
|
||||||
rs.close();
|
rs.close();
|
||||||
}catch(SQLException e){
|
}catch(SQLException e){
|
||||||
|
@ -265,5 +283,6 @@ public class dbController {
|
||||||
}
|
}
|
||||||
return timePlayed;
|
return timePlayed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue