diff --git a/src/main/java/kellerkinder/HomeFlix/application/Main.java b/src/main/java/kellerkinder/HomeFlix/application/Main.java index ec61e95..d9012c4 100644 --- a/src/main/java/kellerkinder/HomeFlix/application/Main.java +++ b/src/main/java/kellerkinder/HomeFlix/application/Main.java @@ -55,15 +55,12 @@ public class Main extends Application { private static String osVers = System.getProperty("os.version"); private static String javaVers = System.getProperty("java.version"); private static String javaVend = System.getProperty("java.vendor"); + private static String local = System.getProperty("user.language") + "_" + System.getProperty("user.country"); private String dirWin = userHome + "/Documents/HomeFlix"; // Windows: C:/Users/"User"/Documents/HomeFlix private String dirLinux = userHome + "/HomeFlix"; // Linux: /home/"User"/HomeFlix private File directory; private File configFile; private File posterCache; - - private String FONT_FAMILY = "System"; - private String local = System.getProperty("user.language") + "_" + System.getProperty("user.country"); - private double FONT_SIZE = 17; private ResourceBundle bundle; private static Logger LOGGER; @@ -123,7 +120,7 @@ public class Main extends Application { directory.mkdir(); addFirstSource(); mainWindowController.setColor("ee3523"); - mainWindowController.setSize(FONT_SIZE); + mainWindowController.setFontSize(17.0); mainWindowController.setAutoUpdate(false); mainWindowController.setLocal(local); mainWindowController.saveSettings(); @@ -146,7 +143,7 @@ public class Main extends Application { * sources.json, if the user ends the file-/directory-chooser the program will exit */ private void addFirstSource() { - switch (System.getProperty("user.language") + "_" + System.getProperty("user.country")) { + switch (local) { case "en_US": bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // us_english break; @@ -229,14 +226,6 @@ public class Main extends Application { return pane; } - public String getFONT_FAMILY() { - return FONT_FAMILY; - } - - public void setFONT_FAMILY(String FONT_FAMILY) { - this.FONT_FAMILY = FONT_FAMILY; - } - public File getDirectory() { return directory; } diff --git a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java index 93e75ad..cf22a8d 100644 --- a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java +++ b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java @@ -243,7 +243,6 @@ public class MainWindowController { private String versionName = "glowing vampire"; private String dialogBtnStyle; private String color; - private String ratingSortType; private String local; private String omdbAPIKey; @@ -254,7 +253,7 @@ public class MainWindowController { private String infoText; private String vlcNotInstalled; - public double size; + private double fontSize; private int last; private int indexTable; private int indexList; @@ -273,8 +272,8 @@ public class MainWindowController { private ImageView skip_next_black = new ImageView(new Image("icons/ic_skip_next_black_18dp_1x.png")); private ImageView play_arrow_white = new ImageView(new Image("icons/ic_play_arrow_white_18dp_1x.png")); private ImageView play_arrow_black = new ImageView(new Image("icons/ic_play_arrow_black_18dp_1x.png")); - private MenuItem like = new MenuItem("like"); - private MenuItem dislike = new MenuItem("dislike"); //TODO one option (like or dislike) + private MenuItem like = new MenuItem("like"); + private MenuItem dislike = new MenuItem("dislike"); // TODO one option (like or dislike) private ContextMenu menu = new ContextMenu(like, dislike); private Properties props = new Properties(); @@ -418,7 +417,7 @@ public class MainWindowController { fontsizeSlider.valueProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue ov, Number old_val, Number new_val) { - setSize(fontsizeSlider.getValue()); + setFontSize(fontsizeSlider.getValue()); if (!getCurrentTitle().isEmpty()) { dbController.readCache(getCurrentStreamUrl()); } @@ -515,7 +514,7 @@ public class MainWindowController { debugBtn.setVisible(false); versionLbl.setText("Version: " + version + " (Build: " + buildNumber + ")"); - fontsizeSlider.setValue(getSize()); + fontsizeSlider.setValue(getFontSize()); colorPicker.setValue(Color.valueOf(getColor())); updateBtn.setFont(Font.font("System", 12)); @@ -921,7 +920,7 @@ public class MainWindowController { props.setProperty("autoUpdate", String.valueOf(isAutoUpdate())); props.setProperty("useBeta", String.valueOf(isUseBeta())); props.setProperty("autoplay", String.valueOf(isAutoplay())); - props.setProperty("size", getSize().toString()); + props.setProperty("size", getFontSize().toString()); props.setProperty("local", getLocal()); props.setProperty("ratingSortType", columnFavorite.getSortType().toString()); @@ -952,10 +951,10 @@ public class MainWindowController { } try { - setSize(Double.parseDouble(props.getProperty("size"))); + setFontSize(Double.parseDouble(props.getProperty("size"))); } catch (Exception e) { LOGGER.error("cloud not load fontsize", e); - setSize(17.0); + setFontSize(17.0); } try { @@ -986,13 +985,6 @@ public class MainWindowController { setLocal(System.getProperty("user.language") + "_" + System.getProperty("user.country")); } - try { - setRatingSortType(props.getProperty("ratingSortType")); - } catch (Exception e) { - LOGGER.error("cloud not load autoUpdate", e); - setRatingSortType(""); - } - inputStream.close(); } catch (IOException e) { LOGGER.error(errorSave, e); @@ -1065,12 +1057,12 @@ public class MainWindowController { return currentTableFilm.getStreamUrl(); } - public void setSize(Double input) { - this.size = input; + public void setFontSize(Double input) { + this.fontSize = input; } - public Double getSize() { - return size; + public Double getFontSize() { + return fontSize; } public int getIndexTable() { @@ -1125,14 +1117,6 @@ public class MainWindowController { return sourcesList; } - public String getRatingSortType() { - return ratingSortType; - } - - public void setRatingSortType(String ratingSortType) { - this.ratingSortType = ratingSortType; - } - public ResourceBundle getBundle() { return bundle; } diff --git a/src/main/java/kellerkinder/HomeFlix/controller/DBController.java b/src/main/java/kellerkinder/HomeFlix/controller/DBController.java index b91d970..219d088 100644 --- a/src/main/java/kellerkinder/HomeFlix/controller/DBController.java +++ b/src/main/java/kellerkinder/HomeFlix/controller/DBController.java @@ -550,9 +550,8 @@ public class DBController { ResultSet rs = stmt.executeQuery("SELECT * FROM cache WHERE streamUrl=\"" + streamUrl + "\";"); ArrayList nameText = new ArrayList(); ArrayList responseText = new ArrayList(); - String fontFamily = main.getFONT_FAMILY(); Image im; - int fontSize = (int) Math.round(mainWindowController.size); + int fontSize = (int) Math.round(mainWindowController.getFontSize()); int j = 2; nameText.add(0, new Text(mainWindowController.getBundle().getString("title") + ": ")); @@ -583,8 +582,8 @@ public class DBController { rs.close(); for (int i = 0; i < nameText.size(); i++) { - nameText.get(i).setFont(Font.font(fontFamily, FontWeight.BOLD, fontSize)); - responseText.get(i).setFont(Font.font(fontFamily, fontSize)); + nameText.get(i).setFont(Font.font("System", FontWeight.BOLD, fontSize)); + responseText.get(i).setFont(Font.font("System", fontSize)); } mainWindowController.getTextFlow().getChildren().remove(0,