code clean up
* Code is under GNU GPL version 3 now * reworked the addGame() Method * text fixes
This commit is contained in:
parent
8d49ce902e
commit
05f6f7e664
|
@ -1 +1,3 @@
|
||||||
/application/
|
/application/
|
||||||
|
/datatypes/
|
||||||
|
/cloudControllerInstances/
|
||||||
|
|
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.
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.
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.
|
@ -3,14 +3,22 @@
|
||||||
*
|
*
|
||||||
* Copyright 2017 <@Seil0>
|
* Copyright 2017 <@Seil0>
|
||||||
*
|
*
|
||||||
* "THE CHOCOLATE-WARE LICENSE" (Revision 1):
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* As long as you retain this notice this software is licensed under the GNU GENERAL PUBLIC LICENSE Version 3,
|
* it under the terms of the GNU General Public License as published by
|
||||||
* with the following additions:
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* If we meet some day, and you think this stuff is worth it,
|
* (at your option) any later version.
|
||||||
* you can buy me a chocolate in return. - @Seil0
|
|
||||||
* (license based in Beer-ware, see https://fedoraproject.org/wiki/Licensing/Beerware )
|
|
||||||
*
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package application;
|
package application;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
|
@ -3,14 +3,22 @@
|
||||||
*
|
*
|
||||||
* Copyright 2017 <@Seil0>
|
* Copyright 2017 <@Seil0>
|
||||||
*
|
*
|
||||||
* "THE CHOCOLATE-WARE LICENSE" (Revision 1):
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* As long as you retain this notice this software is licensed under the GNU GENERAL PUBLIC LICENSE Version 3,
|
* it under the terms of the GNU General Public License as published by
|
||||||
* with the following additions:
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* If we meet some day, and you think this stuff is worth it,
|
* (at your option) any later version.
|
||||||
* you can buy me a chocolate in return. - @Seil0
|
|
||||||
* (license based in Beer-ware, see https://fedoraproject.org/wiki/Licensing/Beerware )
|
|
||||||
*
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package application;
|
package application;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
|
@ -3,14 +3,22 @@
|
||||||
*
|
*
|
||||||
* Copyright 2017 <@Seil0>
|
* Copyright 2017 <@Seil0>
|
||||||
*
|
*
|
||||||
* "THE CHOCOLATE-WARE LICENSE" (Revision 1):
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* As long as you retain this notice this software is licensed under the GNU GENERAL PUBLIC LICENSE Version 3,
|
* it under the terms of the GNU General Public License as published by
|
||||||
* with the following additions:
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* If we meet some day, and you think this stuff is worth it,
|
* (at your option) any later version.
|
||||||
* you can buy me a chocolate in return. - @Seil0
|
|
||||||
* (license based in Beer-ware, see https://fedoraproject.org/wiki/Licensing/Beerware )
|
|
||||||
*
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package application;
|
package application;
|
||||||
|
|
||||||
import java.awt.Desktop;
|
import java.awt.Desktop;
|
||||||
|
@ -956,178 +964,179 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add game to games(ArrayList) and initialize all needed actions (start, time stamps, titleID)
|
* add game to games (ArrayList) and initialize all needed actions (start, time stamps, titleID)
|
||||||
* @param title : game title
|
* @param title : game title
|
||||||
* @param coverPath : path to cover (cache)
|
* @param coverPath : path to cover (cache)
|
||||||
* @param romPath : path to rom file (.rpx)
|
* @param romPath : path to ROM file (.rpx)
|
||||||
* @param titleID : rom ID
|
* @param titleID : ROM ID
|
||||||
*/
|
*/
|
||||||
void addGame(String title, String coverPath, String romPath, String titleID){
|
void addGame(String title, String coverPath, String romPath, String titleID){
|
||||||
ImageView imageView = new ImageView();
|
|
||||||
Label gameTitleLabel = new Label(title);
|
|
||||||
File coverFile = new File(coverPath);
|
|
||||||
VBox VBox = new VBox();
|
VBox VBox = new VBox();
|
||||||
|
Label gameTitleLabel = new Label();
|
||||||
JFXButton gameBtn = new JFXButton();
|
JFXButton gameBtn = new JFXButton();
|
||||||
Image coverImage = new Image(coverFile.toURI().toString());
|
ImageView imageView = new ImageView();
|
||||||
|
Image coverImage = new Image(new File(coverPath).toURI().toString());
|
||||||
|
|
||||||
generatePosition();
|
generatePosition();
|
||||||
LOGGER.info("add " + getxPos()); //TODO debug
|
// LOGGER.info("add " + getxPos()); //TODO debug
|
||||||
VBox.setLayoutX(getxPos());
|
|
||||||
VBox.setLayoutY(getyPos());
|
|
||||||
VBox.getChildren().addAll(gameTitleLabel,gameBtn);
|
|
||||||
gameTitleLabel.setMaxWidth(200);
|
|
||||||
gameTitleLabel.setPadding(new Insets(0,0,0,8));
|
|
||||||
gameTitleLabel.setFont(Font.font("System", FontWeight.BOLD, 14));
|
|
||||||
imageView.setImage(coverImage);
|
|
||||||
imageView.setFitHeight(300);
|
|
||||||
imageView.setFitWidth(200);
|
|
||||||
gameBtn.setGraphic(imageView);
|
|
||||||
gameBtn.setContextMenu(gameContextMenu);
|
|
||||||
gameBtn.setStyle("-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.8), 10, 0, 0, 3); ");
|
|
||||||
gameBtn.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
|
|
||||||
@Override
|
|
||||||
public void handle(MouseEvent event) {
|
|
||||||
LOGGER.info("selected: "+title+"; ID: "+titleID);
|
|
||||||
//getting the selected game index by comparing event.getSource() with games.get(i).getButton()
|
|
||||||
for(int i=0; i<games.size(); i++){
|
|
||||||
if(games.get(i).getButton() == event.getSource()){
|
|
||||||
selectedUIDataIndex = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gameExecutePath = romPath;
|
|
||||||
selectedGameTitleID = titleID;
|
|
||||||
selectedGameTitle = title;
|
|
||||||
|
|
||||||
//underling selected Label
|
|
||||||
lastGameLabel.setStyle("-fx-underline: false;");
|
|
||||||
games.get(selectedUIDataIndex).getLabel().setStyle("-fx-underline: true;");
|
|
||||||
lastGameLabel = games.get(selectedUIDataIndex).getLabel();
|
|
||||||
|
|
||||||
//setting last played, if lastPlayed is empty game was never played before, else set correct date
|
|
||||||
if(dbController.getLastPlayed(titleID).equals("") || dbController.getLastPlayed(titleID).equals(null)){
|
|
||||||
lastTimePlayedBtn.setText("Last played, never");
|
|
||||||
totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID)+ " min");
|
|
||||||
}else{
|
|
||||||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
||||||
|
|
||||||
int today = Integer.parseInt(dtf.format(LocalDate.now()).replaceAll("-", ""));
|
|
||||||
int yesterday = Integer.parseInt(dtf.format(LocalDate.now().minusDays(1)).replaceAll("-", ""));
|
|
||||||
int lastPlayedDay = Integer.parseInt(dbController.getLastPlayed(titleID).replaceAll("-", ""));
|
|
||||||
|
|
||||||
if(today == lastPlayedDay){
|
|
||||||
lastTimePlayedBtn.setText("Last played, today");
|
|
||||||
}else if(yesterday == lastPlayedDay){
|
|
||||||
lastTimePlayedBtn.setText("Last played, yesterday");
|
|
||||||
}else{
|
|
||||||
lastTimePlayedBtn.setText("Last played, "+dbController.getLastPlayed(titleID));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//setting total playtime, if total playtime > 60 minutes, formate is "x hours x minutes" (xh x min), else only minutes are showed
|
|
||||||
if(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;
|
|
||||||
totalPlaytimeBtn.setText(hoursPlayed+" h "+minutesPlayed+" min");
|
|
||||||
}else{
|
|
||||||
totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID)+ " min");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!playTrue) {
|
|
||||||
playBtnSlideIn();
|
|
||||||
}
|
|
||||||
if (menuTrue) {
|
|
||||||
sideMenuSlideOut();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
games.add(new UIROMDataType(VBox, gameTitleLabel, gameBtn, imageView, titleID, romPath));
|
|
||||||
|
|
||||||
// //THIS IS TESTING AREA!!!!
|
// VBox.setLayoutX(getxPos());
|
||||||
// UIROMDataType test = new UIROMDataType(VBox, gameTitleLabel, gameBtn, imageView, titleID, romPath);
|
// VBox.setLayoutY(getyPos());
|
||||||
//
|
// VBox.getChildren().addAll(gameTitleLabel,gameBtn);
|
||||||
// test.getLabel().setText(title);
|
// gameTitleLabel.setMaxWidth(200);
|
||||||
// test.getLabel().setMaxWidth(200);
|
// gameTitleLabel.setPadding(new Insets(0,0,0,8));
|
||||||
// test.getLabel().setPadding(new Insets(0,0,0,8));
|
// gameTitleLabel.setFont(Font.font("System", FontWeight.BOLD, 14));
|
||||||
// test.getLabel().setFont(Font.font("System", FontWeight.BOLD, 14));
|
// imageView.setImage(coverImage);
|
||||||
//
|
// imageView.setFitHeight(300);
|
||||||
// //i think we can do this locally and remove the imageView from the datatype since it's used as graphic
|
// imageView.setFitWidth(200);
|
||||||
// test.getImageView().setImage(coverImage);
|
// gameBtn.setGraphic(imageView);
|
||||||
// test.getImageView().setFitHeight(300);
|
// gameBtn.setContextMenu(gameContextMenu);
|
||||||
// test.getImageView().setFitWidth(200);
|
// gameBtn.setStyle("-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.8), 10, 0, 0, 3); ");
|
||||||
//
|
// gameBtn.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
|
||||||
// test.getButton().setGraphic(test.getImageView());
|
// @Override
|
||||||
// test.getButton().setContextMenu(gameContextMenu);
|
// public void handle(MouseEvent event) {
|
||||||
// test.getButton().setStyle("-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.8), 10, 0, 0, 3); ");
|
// LOGGER.info("selected: "+title+"; ID: "+titleID);
|
||||||
// test.getButton().addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
|
// //getting the selected game index by comparing event.getSource() with games.get(i).getButton()
|
||||||
// @Override
|
// for(int i=0; i<games.size(); i++){
|
||||||
// public void handle(MouseEvent event) {
|
// if(games.get(i).getButton() == event.getSource()){
|
||||||
// LOGGER.info("selected: " + title + "; ID: " + titleID);
|
// selectedUIDataIndex = i;
|
||||||
// // getting the selected game index by comparing event.getSource() with games.get(i).getButton()
|
// }
|
||||||
// for (int i = 0; i < games.size(); i++) {
|
// }
|
||||||
// if (games.get(i).getButton() == event.getSource()) {
|
//
|
||||||
// selectedUIDataIndex = i;
|
// gameExecutePath = romPath;
|
||||||
// }
|
// selectedGameTitleID = titleID;
|
||||||
// }
|
// selectedGameTitle = title;
|
||||||
//
|
//
|
||||||
// gameExecutePath = romPath;
|
// //underling selected Label
|
||||||
// selectedGameTitleID = titleID;
|
// lastGameLabel.setStyle("-fx-underline: false;");
|
||||||
// selectedGameTitle = title;
|
// games.get(selectedUIDataIndex).getLabel().setStyle("-fx-underline: true;");
|
||||||
//
|
// lastGameLabel = games.get(selectedUIDataIndex).getLabel();
|
||||||
// // underling selected Label
|
//
|
||||||
// lastGameLabel.setStyle("-fx-underline: false;");
|
// //setting last played, if lastPlayed is empty game was never played before, else set correct date
|
||||||
// games.get(selectedUIDataIndex).getLabel().setStyle("-fx-underline: true;");
|
// if(dbController.getLastPlayed(titleID).equals("") || dbController.getLastPlayed(titleID).equals(null)){
|
||||||
// lastGameLabel = games.get(selectedUIDataIndex).getLabel();
|
// lastTimePlayedBtn.setText("Last played, never");
|
||||||
//
|
// totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID)+ " min");
|
||||||
// // setting last played, if lastPlayed is empty game was never played before, else set correct date
|
// }else{
|
||||||
// if (dbController.getLastPlayed(titleID).equals("") || dbController.getLastPlayed(titleID).equals(null)) {
|
// DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
// lastTimePlayedBtn.setText("Last played, never");
|
//
|
||||||
// totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID) + " min");
|
// int today = Integer.parseInt(dtf.format(LocalDate.now()).replaceAll("-", ""));
|
||||||
// } else {
|
// int yesterday = Integer.parseInt(dtf.format(LocalDate.now().minusDays(1)).replaceAll("-", ""));
|
||||||
// DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
// int lastPlayedDay = Integer.parseInt(dbController.getLastPlayed(titleID).replaceAll("-", ""));
|
||||||
//
|
//
|
||||||
// int today = Integer.parseInt(dtf.format(LocalDate.now()).replaceAll("-", ""));
|
// if(today == lastPlayedDay){
|
||||||
// int yesterday = Integer.parseInt(dtf.format(LocalDate.now().minusDays(1)).replaceAll("-", ""));
|
// lastTimePlayedBtn.setText("Last played, today");
|
||||||
// int lastPlayedDay = Integer.parseInt(dbController.getLastPlayed(titleID).replaceAll("-", ""));
|
// }else if(yesterday == lastPlayedDay){
|
||||||
//
|
// lastTimePlayedBtn.setText("Last played, yesterday");
|
||||||
// if (today == lastPlayedDay) {
|
// }else{
|
||||||
// lastTimePlayedBtn.setText("Last played, today");
|
// lastTimePlayedBtn.setText("Last played, "+dbController.getLastPlayed(titleID));
|
||||||
// } else if (yesterday == lastPlayedDay) {
|
// }
|
||||||
// lastTimePlayedBtn.setText("Last played, yesterday");
|
// }
|
||||||
// } else {
|
//
|
||||||
// lastTimePlayedBtn.setText("Last played, " + dbController.getLastPlayed(titleID));
|
// //setting total playtime, if total playtime > 60 minutes, formate is "x hours x minutes" (xh x min), else only minutes are showed
|
||||||
// }
|
// if(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;
|
||||||
// // setting total playtime, if total playtime > 60 minutes, formate is "x hours x
|
// totalPlaytimeBtn.setText(hoursPlayed+" h "+minutesPlayed+" min");
|
||||||
// // minutes" (xh x min), else only minutes are showed
|
// }else{
|
||||||
// if (Integer.parseInt(dbController.getTotalPlaytime(titleID)) > 60) {
|
// totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID)+ " min");
|
||||||
// int hoursPlayed = (int) Math.floor(Integer.parseInt(dbController.getTotalPlaytime(titleID)) / 60);
|
// }
|
||||||
// int minutesPlayed = Integer.parseInt(dbController.getTotalPlaytime(titleID)) - 60 * hoursPlayed;
|
//
|
||||||
// totalPlaytimeBtn.setText(hoursPlayed + " h " + minutesPlayed + " min");
|
// if (!playTrue) {
|
||||||
// } else {
|
// playBtnSlideIn();
|
||||||
// totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID) + " min");
|
// }
|
||||||
// }
|
// if (menuTrue) {
|
||||||
//
|
|
||||||
// if (!playTrue) {
|
|
||||||
// playBtnSlideIn();
|
|
||||||
// }
|
|
||||||
// if (menuTrue) {
|
|
||||||
// sideMenuSlideOut();
|
// sideMenuSlideOut();
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
//
|
// games.add(new UIROMDataType(VBox, gameTitleLabel, gameBtn, imageView, titleID, romPath));
|
||||||
// test.getVBox().setLayoutX(getxPos());
|
|
||||||
// test.getVBox().setLayoutY(getyPos());
|
//THIS IS TESTING AREA!!!!
|
||||||
// test.getVBox().getChildren().addAll(gameTitleLabel,gameBtn);
|
UIROMDataType uiROMElement = new UIROMDataType(VBox, gameTitleLabel, gameBtn, imageView, titleID, romPath);
|
||||||
//
|
|
||||||
// games.add(test);
|
uiROMElement.getLabel().setText(title);
|
||||||
|
uiROMElement.getLabel().setMaxWidth(200);
|
||||||
|
uiROMElement.getLabel().setPadding(new Insets(0,0,0,8));
|
||||||
|
uiROMElement.getLabel().setFont(Font.font("System", FontWeight.BOLD, 14));
|
||||||
|
|
||||||
|
// i think we can do this locally and remove the imageView from the data type since it's used as graphic
|
||||||
|
uiROMElement.getImageView().setImage(coverImage);
|
||||||
|
uiROMElement.getImageView().setFitHeight(300);
|
||||||
|
uiROMElement.getImageView().setFitWidth(200);
|
||||||
|
|
||||||
|
uiROMElement.getButton().setGraphic(uiROMElement.getImageView());
|
||||||
|
uiROMElement.getButton().setContextMenu(gameContextMenu);
|
||||||
|
uiROMElement.getButton().setStyle("-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.8), 10, 0, 0, 3); ");
|
||||||
|
uiROMElement.getButton().addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
|
||||||
|
@Override
|
||||||
|
public void handle(MouseEvent event) {
|
||||||
|
LOGGER.info("selected: " + title + "; ID: " + titleID);
|
||||||
|
// getting the selected game index by comparing event.getSource() with games.get(i).getButton()
|
||||||
|
for (int i = 0; i < games.size(); i++) {
|
||||||
|
if (games.get(i).getButton() == event.getSource()) {
|
||||||
|
selectedUIDataIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gameExecutePath = romPath;
|
||||||
|
selectedGameTitleID = titleID;
|
||||||
|
selectedGameTitle = title;
|
||||||
|
|
||||||
|
// underlining selected Label
|
||||||
|
lastGameLabel.setStyle("-fx-underline: false;");
|
||||||
|
games.get(selectedUIDataIndex).getLabel().setStyle("-fx-underline: true;");
|
||||||
|
lastGameLabel = games.get(selectedUIDataIndex).getLabel();
|
||||||
|
|
||||||
|
// setting last played, if lastPlayed is empty game was never played before, else set correct date
|
||||||
|
if (dbController.getLastPlayed(titleID).equals("") || dbController.getLastPlayed(titleID).equals(null)) {
|
||||||
|
lastTimePlayedBtn.setText("Last played, never");
|
||||||
|
totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID) + " min");
|
||||||
|
} else {
|
||||||
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
|
||||||
|
int today = Integer.parseInt(dtf.format(LocalDate.now()).replaceAll("-", ""));
|
||||||
|
int yesterday = Integer.parseInt(dtf.format(LocalDate.now().minusDays(1)).replaceAll("-", ""));
|
||||||
|
int lastPlayedDay = Integer.parseInt(dbController.getLastPlayed(titleID).replaceAll("-", ""));
|
||||||
|
|
||||||
|
if (lastPlayedDay == today) {
|
||||||
|
lastTimePlayedBtn.setText("Last played, today");
|
||||||
|
} else if (lastPlayedDay == yesterday) {
|
||||||
|
lastTimePlayedBtn.setText("Last played, yesterday");
|
||||||
|
} else {
|
||||||
|
lastTimePlayedBtn.setText("Last played, " + dbController.getLastPlayed(titleID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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) {
|
||||||
|
int hoursPlayed = (int) Math.floor(Integer.parseInt(dbController.getTotalPlaytime(titleID)) / 60);
|
||||||
|
int minutesPlayed = Integer.parseInt(dbController.getTotalPlaytime(titleID)) - 60 * hoursPlayed;
|
||||||
|
totalPlaytimeBtn.setText(hoursPlayed + " h " + minutesPlayed + " min");
|
||||||
|
} else {
|
||||||
|
totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID) + " min");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!playTrue) {
|
||||||
|
playBtnSlideIn();
|
||||||
|
}
|
||||||
|
if (menuTrue) {
|
||||||
|
sideMenuSlideOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
uiROMElement.getVBox().setLayoutX(getxPos());
|
||||||
|
uiROMElement.getVBox().setLayoutY(getyPos());
|
||||||
|
uiROMElement.getVBox().getChildren().addAll(gameTitleLabel,gameBtn);
|
||||||
|
|
||||||
|
// add uiROMElement to games list
|
||||||
|
games.add(uiROMElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
//add all games saved in games(ArrayList) to the 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());
|
||||||
|
|
|
@ -1,7 +1,24 @@
|
||||||
/**
|
/**
|
||||||
* smmdbapi query
|
* cemu_UI
|
||||||
* api query, return all courses as ArrayList
|
*
|
||||||
|
* Copyright 2017 <@Seil0>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package application;
|
package application;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
|
|
@ -3,14 +3,22 @@
|
||||||
*
|
*
|
||||||
* Copyright 2017 <@Seil0>
|
* Copyright 2017 <@Seil0>
|
||||||
*
|
*
|
||||||
* "THE CHOCOLATE-WARE LICENSE" (Revision 1):
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* As long as you retain this notice this software is licensed under the GNU GENERAL PUBLIC LICENSE Version 3,
|
* it under the terms of the GNU General Public License as published by
|
||||||
* with the following additions:
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* If we meet some day, and you think this stuff is worth it,
|
* (at your option) any later version.
|
||||||
* you can buy me a chocolate in return. - @Seil0
|
|
||||||
* (license based in Beer-ware, see https://fedoraproject.org/wiki/Licensing/Beerware )
|
|
||||||
*
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package application;
|
package application;
|
||||||
|
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
|
|
@ -3,13 +3,20 @@
|
||||||
*
|
*
|
||||||
* Copyright 2017 <@Seil0>
|
* Copyright 2017 <@Seil0>
|
||||||
*
|
*
|
||||||
* "THE CHOCOLATE-WARE LICENSE" (Revision 1):
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* As long as you retain this notice this software is licensed under the GNU GENERAL PUBLIC LICENSE Version 3,
|
* it under the terms of the GNU General Public License as published by
|
||||||
* with the following additions:
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* If we meet some day, and you think this stuff is worth it,
|
* (at your option) any later version.
|
||||||
* you can buy me a chocolate in return. - @Seil0
|
|
||||||
* (license based in Beer-ware, see https://fedoraproject.org/wiki/Licensing/Beerware )
|
|
||||||
*
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package application;
|
package application;
|
||||||
|
|
|
@ -1,3 +1,24 @@
|
||||||
|
/**
|
||||||
|
* cemu_UI
|
||||||
|
*
|
||||||
|
* Copyright 2017 <@Seil0>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
package cloudControllerInstances;
|
package cloudControllerInstances;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
|
|
@ -1,6 +1,24 @@
|
||||||
/**
|
/**
|
||||||
* Datatype used in the TreeTableview for
|
* cemu_UI
|
||||||
|
*
|
||||||
|
* Copyright 2017 <@Seil0>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package datatypes;
|
package datatypes;
|
||||||
|
|
||||||
import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject;
|
import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject;
|
||||||
|
@ -16,7 +34,10 @@ public class CourseTableDataType extends RecursiveTreeObject<CourseTableDataType
|
||||||
public final StringProperty id;
|
public final StringProperty id;
|
||||||
public final IntegerProperty time;
|
public final IntegerProperty time;
|
||||||
public final IntegerProperty stars;
|
public final IntegerProperty stars;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data type used in the TreeTableview for
|
||||||
|
*/
|
||||||
public CourseTableDataType(String title, String id, int time, int stars) {
|
public CourseTableDataType(String title, String id, int time, int stars) {
|
||||||
this.title = new SimpleStringProperty(title);
|
this.title = new SimpleStringProperty(title);
|
||||||
this.id = new SimpleStringProperty(id);
|
this.id = new SimpleStringProperty(id);
|
||||||
|
|
|
@ -1,6 +1,24 @@
|
||||||
/**
|
/**
|
||||||
* Datatype used for the smmdbapi query
|
* cemu_UI
|
||||||
|
*
|
||||||
|
* Copyright 2017 <@Seil0>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package datatypes;
|
package datatypes;
|
||||||
|
|
||||||
import javafx.beans.property.IntegerProperty;
|
import javafx.beans.property.IntegerProperty;
|
||||||
|
@ -23,6 +41,9 @@ public class SmmdbApiDataType {
|
||||||
private final StringProperty nintendoid = new SimpleStringProperty();
|
private final StringProperty nintendoid = new SimpleStringProperty();
|
||||||
private final StringProperty title = new SimpleStringProperty();
|
private final StringProperty title = new SimpleStringProperty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data type used for the smmdbapi query
|
||||||
|
*/
|
||||||
public SmmdbApiDataType(final int courseTheme, final int gameStyle, final int difficulty, final int lastmodified,
|
public SmmdbApiDataType(final int courseTheme, final int gameStyle, final int difficulty, final int lastmodified,
|
||||||
final int uploaded, final int autoScroll, final int stars, final int time,
|
final int uploaded, final int autoScroll, final int stars, final int time,
|
||||||
final String owner, final String id, final String nintendoid, final String title) {
|
final String owner, final String id, final String nintendoid, final String title) {
|
||||||
|
|
|
@ -1,6 +1,24 @@
|
||||||
/**
|
/**
|
||||||
* Datatype used for UI ROM elements
|
* cemu_UI
|
||||||
|
*
|
||||||
|
* Copyright 2017 <@Seil0>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package datatypes;
|
package datatypes;
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
|
@ -21,6 +39,9 @@ public class UIROMDataType {
|
||||||
private final StringProperty titleID = new SimpleStringProperty();
|
private final StringProperty titleID = new SimpleStringProperty();
|
||||||
private final StringProperty romPath = new SimpleStringProperty();
|
private final StringProperty romPath = new SimpleStringProperty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data type used for UI ROM elements all uiROMElemts are of this data type
|
||||||
|
*/
|
||||||
public UIROMDataType (final VBox vBox, final Label label, final JFXButton button, final ImageView imageView, final String titleID, final String romPath){
|
public UIROMDataType (final VBox vBox, final Label label, final JFXButton button, final ImageView imageView, final String titleID, final String romPath){
|
||||||
this.vBox.set(vBox);
|
this.vBox.set(vBox);
|
||||||
this.label.set(label);
|
this.label.set(label);
|
||||||
|
|
Loading…
Reference in New Issue