* jfoenix 9.0.1 -> 9.0.2
* code clean up * last time played and playtime button are now large enough
This commit is contained in:
parent
f7675cf277
commit
3a6a7b7cce
2
pom.xml
2
pom.xml
|
@ -26,7 +26,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jfoenix</groupId>
|
<groupId>com.jfoenix</groupId>
|
||||||
<artifactId>jfoenix</artifactId>
|
<artifactId>jfoenix</artifactId>
|
||||||
<version>9.0.1</version>
|
<version>9.0.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class Main extends Application {
|
||||||
}
|
}
|
||||||
|
|
||||||
// startup checks
|
// startup checks
|
||||||
// check if client_secret.jason is present
|
// check if client_secret.json 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!!!!!");
|
||||||
|
|
||||||
|
@ -142,11 +142,11 @@ public class Main extends Application {
|
||||||
mainWindowController.setLastLocalSync(0);
|
mainWindowController.setLastLocalSync(0);
|
||||||
mainWindowController.setxPosHelper(0);
|
mainWindowController.setxPosHelper(0);
|
||||||
mainWindowController.saveSettings();
|
mainWindowController.saveSettings();
|
||||||
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs)
|
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //TODO check if this really is needed start again (preventing Bugs)
|
||||||
System.exit(0); //finishes itself
|
System.exit(0); //finishes itself
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pictureCache.exists() != true) {
|
if (!pictureCache.exists()) {
|
||||||
pictureCache.mkdir();
|
pictureCache.mkdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,19 @@ public class Main extends Application {
|
||||||
return directory;
|
return directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDirectory(File directory) {
|
public File getConfigFile() {
|
||||||
this.directory = directory;
|
return configFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getGamesDBFile() {
|
||||||
|
return gamesDBFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getReference_gamesFile() {
|
||||||
|
return reference_gamesFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getPictureCache() {
|
||||||
|
return pictureCache;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,12 +302,6 @@ public class MainWindowController {
|
||||||
private double windowWidth;
|
private double windowWidth;
|
||||||
private double windowHeight;
|
private double windowHeight;
|
||||||
private DirectoryChooser directoryChooser = new DirectoryChooser();
|
private DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||||
private File dirWin = new File(System.getProperty("user.home") + "/Documents/cemu_UI");
|
|
||||||
private File dirLinux = new File(System.getProperty("user.home") + "/cemu_UI");
|
|
||||||
private File configFileWin = new File(dirWin + "/config.xml");
|
|
||||||
private File configFileLinux = new File(dirLinux + "/config.xml");
|
|
||||||
private File pictureCacheWin = new File(dirWin + "/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> languages = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)");
|
private ObservableList<String> languages = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)");
|
||||||
private ObservableList<String> smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); // TODO add more IDs
|
private ObservableList<String> smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); // TODO add more IDs
|
||||||
|
@ -376,7 +370,7 @@ public class MainWindowController {
|
||||||
|
|
||||||
public void setMain(Main m) {
|
public void setMain(Main m) {
|
||||||
this.main = m;
|
this.main = m;
|
||||||
dbController = new DBController(this);
|
dbController = new DBController(main, this);
|
||||||
smmdbAPIController = new SmmdbAPIController();
|
smmdbAPIController = new SmmdbAPIController();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -911,7 +905,7 @@ public class MainWindowController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
void lastTimePlayedBtnAction(ActionEvent event) {
|
void lastTimePlayedBtnAction(ActionEvent event) {
|
||||||
|
System.out.println(lastTimePlayedBtn.getWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -1134,15 +1128,9 @@ public class MainWindowController {
|
||||||
errorDialog.show();
|
errorDialog.show();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
File pictureCache;
|
File pictureCache = main.getPictureCache();
|
||||||
String coverName = new File(coverPath).getName();
|
String coverName = new File(coverPath).getName();
|
||||||
try {
|
try {
|
||||||
if (System.getProperty("os.name").equals("Linux")) {
|
|
||||||
pictureCache = getPictureCacheLinux();
|
|
||||||
} else {
|
|
||||||
pictureCache = getPictureCacheWin();
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedImage originalImage = ImageIO.read(new File(coverPath)); //load cover
|
BufferedImage originalImage = ImageIO.read(new File(coverPath)); //load cover
|
||||||
int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : originalImage.getType();
|
int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : originalImage.getType();
|
||||||
BufferedImage resizeImagePNG = resizeImage(originalImage, type, 400, 600);
|
BufferedImage resizeImagePNG = resizeImage(originalImage, type, 400, 600);
|
||||||
|
@ -1651,7 +1639,7 @@ public class MainWindowController {
|
||||||
|
|
||||||
public void saveSettings(){
|
public void saveSettings(){
|
||||||
LOGGER.info("saving Settings ...");
|
LOGGER.info("saving Settings ...");
|
||||||
OutputStream outputStream; //new output-stream
|
|
||||||
try {
|
try {
|
||||||
props.setProperty("cemuPath", getCemuPath());
|
props.setProperty("cemuPath", getCemuPath());
|
||||||
props.setProperty("romPath", getRomDirectoryPath());
|
props.setProperty("romPath", getRomDirectoryPath());
|
||||||
|
@ -1670,11 +1658,7 @@ public class MainWindowController {
|
||||||
props.setProperty("lastLocalSync", String.valueOf(getLastLocalSync()));
|
props.setProperty("lastLocalSync", String.valueOf(getLastLocalSync()));
|
||||||
props.setProperty("windowWidth", String.valueOf(mainAnchorPane.getWidth()));
|
props.setProperty("windowWidth", String.valueOf(mainAnchorPane.getWidth()));
|
||||||
props.setProperty("windowHeight", String.valueOf(mainAnchorPane.getHeight()));
|
props.setProperty("windowHeight", String.valueOf(mainAnchorPane.getHeight()));
|
||||||
if(System.getProperty("os.name").equals("Linux")){
|
OutputStream outputStream = new FileOutputStream(main.getConfigFile()); //new output-stream
|
||||||
outputStream = new FileOutputStream(configFileLinux);
|
|
||||||
}else{
|
|
||||||
outputStream = new FileOutputStream(configFileWin);
|
|
||||||
}
|
|
||||||
props.storeToXML(outputStream, "cemu_UI settings"); //write new .xml
|
props.storeToXML(outputStream, "cemu_UI settings"); //write new .xml
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
LOGGER.info("saving Settings done!");
|
LOGGER.info("saving Settings done!");
|
||||||
|
@ -1689,13 +1673,8 @@ public class MainWindowController {
|
||||||
*/
|
*/
|
||||||
private void loadSettings(){
|
private void loadSettings(){
|
||||||
LOGGER.info("loading settings ...");
|
LOGGER.info("loading settings ...");
|
||||||
InputStream inputStream;
|
|
||||||
try {
|
try {
|
||||||
if(System.getProperty("os.name").equals("Linux")){
|
InputStream inputStream = new FileInputStream(main.getConfigFile());
|
||||||
inputStream = new FileInputStream(configFileLinux);
|
|
||||||
}else{
|
|
||||||
inputStream = new FileInputStream(configFileWin);
|
|
||||||
}
|
|
||||||
props.loadFromXML(inputStream); //new input-stream from .xml
|
props.loadFromXML(inputStream); //new input-stream from .xml
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1894,22 +1873,6 @@ public class MainWindowController {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getPictureCacheLinux() {
|
|
||||||
return pictureCacheLinux;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPictureCacheLinux(File pictureCacheLinux) {
|
|
||||||
this.pictureCacheLinux = pictureCacheLinux;
|
|
||||||
}
|
|
||||||
|
|
||||||
public File getPictureCacheWin() {
|
|
||||||
return pictureCacheWin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPictureCacheWin(File pictureCacheWin) {
|
|
||||||
this.pictureCacheWin = pictureCacheWin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getxPos() {
|
public int getxPos() {
|
||||||
return xPos;
|
return xPos;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,14 +45,17 @@ import org.apache.logging.log4j.Logger;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
import com.cemu_UI.application.Main;
|
||||||
import com.cemu_UI.application.MainWindowController;
|
import com.cemu_UI.application.MainWindowController;
|
||||||
|
|
||||||
public class DBController {
|
public class DBController {
|
||||||
|
|
||||||
public DBController(MainWindowController mwc) {
|
public DBController(Main main, MainWindowController mainWindowController) {
|
||||||
mainWindowController = mwc;
|
this.main = main;
|
||||||
|
this.mainWindowController = mainWindowController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Main main;
|
||||||
private MainWindowController mainWindowController;
|
private MainWindowController mainWindowController;
|
||||||
private ArrayList<String> entries = new ArrayList<>();
|
private ArrayList<String> entries = new ArrayList<>();
|
||||||
private String DB_PATH_localRoms;
|
private String DB_PATH_localRoms;
|
||||||
|
@ -98,16 +101,10 @@ public class DBController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the path to the localRoms.db file and initialize the connection
|
* set the path to the localRoms.db file and initialize the connection
|
||||||
*
|
* games.db contains a reverence list to for the automatic detection mode
|
||||||
* games.dbcontains a reverence list to for the automatic detection mode
|
|
||||||
* TODO rework paths
|
|
||||||
*/
|
*/
|
||||||
private void loadGamesDatabase() {
|
private void loadGamesDatabase() {
|
||||||
if (System.getProperty("os.name").equals("Linux")) {
|
DB_PATH_games = main.getReference_gamesFile().getAbsolutePath();
|
||||||
DB_PATH_games = System.getProperty("user.home") + "/cemu_UI/reference_games.db";
|
|
||||||
} else {
|
|
||||||
DB_PATH_games = System.getProperty("user.home") + "\\Documents\\cemu_UI" + "\\" + "reference_games.db";
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
// create a database connection
|
// create a database connection
|
||||||
connectionGames = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH_games);
|
connectionGames = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH_games);
|
||||||
|
@ -213,15 +210,8 @@ public class DBController {
|
||||||
File dir = new File(directory);
|
File dir = new File(directory);
|
||||||
File appFile;
|
File appFile;
|
||||||
String[] extensions = new String[] { "rpx", "jsp" };
|
String[] extensions = new String[] { "rpx", "jsp" };
|
||||||
File pictureCache;
|
File pictureCache = main.getPictureCache();
|
||||||
String coverPath;
|
String coverPath;
|
||||||
|
|
||||||
if(System.getProperty("os.name").equals("Linux")){
|
|
||||||
pictureCache = mainWindowController.getPictureCacheLinux();
|
|
||||||
}else{
|
|
||||||
pictureCache = mainWindowController.getPictureCacheWin();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Statement stmt = connectionGames.createStatement();
|
Statement stmt = connectionGames.createStatement();
|
||||||
List<File> files = (List<File>) FileUtils.listFiles(dir, extensions, true);
|
List<File> files = (List<File>) FileUtils.listFiles(dir, extensions, true);
|
||||||
|
|
|
@ -213,14 +213,14 @@
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
<HBox fx:id="bottomHBox" alignment="CENTER" layoutX="326.0" layoutY="602.0" prefHeight="48.0" prefWidth="200.0" spacing="10.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
<HBox fx:id="bottomHBox" alignment="CENTER" layoutX="326.0" layoutY="602.0" prefHeight="48.0" prefWidth="200.0" spacing="10.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXButton fx:id="totalPlaytimeBtn" buttonType="RAISED" maxHeight="32.0" maxWidth="150.0" minWidth="125.0" onAction="#totalPlaytimeBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" text="0 h 0 min">
|
<JFXButton fx:id="totalPlaytimeBtn" buttonType="RAISED" maxHeight="32.0" maxWidth="156.0" minHeight="32.0" minWidth="156.0" onAction="#totalPlaytimeBtnAction" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" text="0 h 0 min">
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="playBtn" buttonType="RAISED" maxHeight="28.0" minWidth="100.0" onAction="#playBtnAction" ripplerFill="#00aacc" text="play" textAlignment="CENTER">
|
<JFXButton fx:id="playBtn" buttonType="RAISED" maxHeight="28.0" minWidth="100.0" onAction="#playBtnAction" ripplerFill="#00aacc" text="play" textAlignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" maxHeight="32.0" maxWidth="150.0" minWidth="125.0" onAction="#lastTimePlayedBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" text="Last played, never" />
|
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" maxHeight="32.0" maxWidth="156.0" minHeight="32.0" minWidth="156.0" onAction="#lastTimePlayedBtnAction" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" text="Last played, never" />
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
</children>
|
</children>
|
||||||
|
|
Loading…
Reference in New Issue