* 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:
Jannik 2018-02-17 17:49:12 +01:00
parent f7675cf277
commit 3a6a7b7cce
5 changed files with 35 additions and 70 deletions

View File

@ -26,7 +26,7 @@
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>9.0.1</version>
<version>9.0.2</version>
</dependency>
<dependency>

View File

@ -116,7 +116,7 @@ public class Main extends Application {
}
// startup checks
// check if client_secret.jason is present
// check if client_secret.json is present
if (Main.class.getResourceAsStream("/client_secret.json") == null) {
LOGGER.error("client_secret is missing!!!!!");
@ -142,11 +142,11 @@ public class Main extends Application {
mainWindowController.setLastLocalSync(0);
mainWindowController.setxPosHelper(0);
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
}
if (pictureCache.exists() != true) {
if (!pictureCache.exists()) {
pictureCache.mkdir();
}
@ -341,7 +341,19 @@ public class Main extends Application {
return directory;
}
public void setDirectory(File directory) {
this.directory = directory;
public File getConfigFile() {
return configFile;
}
public File getGamesDBFile() {
return gamesDBFile;
}
public File getReference_gamesFile() {
return reference_gamesFile;
}
public File getPictureCache() {
return pictureCache;
}
}

View File

@ -302,12 +302,6 @@ public class MainWindowController {
private double windowWidth;
private double windowHeight;
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> languages = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)");
private ObservableList<String> smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); // TODO add more IDs
@ -376,7 +370,7 @@ public class MainWindowController {
public void setMain(Main m) {
this.main = m;
dbController = new DBController(this);
dbController = new DBController(main, this);
smmdbAPIController = new SmmdbAPIController();
}
@ -911,7 +905,7 @@ public class MainWindowController {
@FXML
void lastTimePlayedBtnAction(ActionEvent event) {
System.out.println(lastTimePlayedBtn.getWidth());
}
@FXML
@ -1134,15 +1128,9 @@ public class MainWindowController {
errorDialog.show();
} else {
File pictureCache;
File pictureCache = main.getPictureCache();
String coverName = new File(coverPath).getName();
try {
if (System.getProperty("os.name").equals("Linux")) {
pictureCache = getPictureCacheLinux();
} else {
pictureCache = getPictureCacheWin();
}
BufferedImage originalImage = ImageIO.read(new File(coverPath)); //load cover
int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : originalImage.getType();
BufferedImage resizeImagePNG = resizeImage(originalImage, type, 400, 600);
@ -1651,7 +1639,7 @@ public class MainWindowController {
public void saveSettings(){
LOGGER.info("saving Settings ...");
OutputStream outputStream; //new output-stream
try {
props.setProperty("cemuPath", getCemuPath());
props.setProperty("romPath", getRomDirectoryPath());
@ -1670,11 +1658,7 @@ public class MainWindowController {
props.setProperty("lastLocalSync", String.valueOf(getLastLocalSync()));
props.setProperty("windowWidth", String.valueOf(mainAnchorPane.getWidth()));
props.setProperty("windowHeight", String.valueOf(mainAnchorPane.getHeight()));
if(System.getProperty("os.name").equals("Linux")){
outputStream = new FileOutputStream(configFileLinux);
}else{
outputStream = new FileOutputStream(configFileWin);
}
OutputStream outputStream = new FileOutputStream(main.getConfigFile()); //new output-stream
props.storeToXML(outputStream, "cemu_UI settings"); //write new .xml
outputStream.close();
LOGGER.info("saving Settings done!");
@ -1689,13 +1673,8 @@ public class MainWindowController {
*/
private void loadSettings(){
LOGGER.info("loading settings ...");
InputStream inputStream;
try {
if(System.getProperty("os.name").equals("Linux")){
inputStream = new FileInputStream(configFileLinux);
}else{
inputStream = new FileInputStream(configFileWin);
}
InputStream inputStream = new FileInputStream(main.getConfigFile());
props.loadFromXML(inputStream); //new input-stream from .xml
try {
@ -1894,22 +1873,6 @@ public class MainWindowController {
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() {
return xPos;
}

View File

@ -45,14 +45,17 @@ import org.apache.logging.log4j.Logger;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import com.cemu_UI.application.Main;
import com.cemu_UI.application.MainWindowController;
public class DBController {
public DBController(MainWindowController mwc) {
mainWindowController = mwc;
public DBController(Main main, MainWindowController mainWindowController) {
this.main = main;
this.mainWindowController = mainWindowController;
}
private Main main;
private MainWindowController mainWindowController;
private ArrayList<String> entries = new ArrayList<>();
private String DB_PATH_localRoms;
@ -98,16 +101,10 @@ public class DBController {
/**
* set the path to the localRoms.db file and initialize the connection
*
* games.dbcontains a reverence list to for the automatic detection mode
* TODO rework paths
* games.db contains a reverence list to for the automatic detection mode
*/
private void loadGamesDatabase() {
if (System.getProperty("os.name").equals("Linux")) {
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";
}
DB_PATH_games = main.getReference_gamesFile().getAbsolutePath();
try {
// create a database connection
connectionGames = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH_games);
@ -213,15 +210,8 @@ public class DBController {
File dir = new File(directory);
File appFile;
String[] extensions = new String[] { "rpx", "jsp" };
File pictureCache;
String coverPath;
if(System.getProperty("os.name").equals("Linux")){
pictureCache = mainWindowController.getPictureCacheLinux();
}else{
pictureCache = mainWindowController.getPictureCacheWin();
}
File pictureCache = main.getPictureCache();
String coverPath;
try {
Statement stmt = connectionGames.createStatement();
List<File> files = (List<File>) FileUtils.listFiles(dir, extensions, true);

View File

@ -213,14 +213,14 @@
</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">
<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 fx:id="playBtn" buttonType="RAISED" maxHeight="28.0" minWidth="100.0" onAction="#playBtnAction" ripplerFill="#00aacc" text="play" textAlignment="CENTER">
<font>
<Font name="System Bold" size="14.0" />
</font>
</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>
</HBox>
</children>