diff --git a/bin/application/DBController.class b/bin/application/DBController.class index 3a16c35..f400ca7 100644 Binary files a/bin/application/DBController.class and b/bin/application/DBController.class differ diff --git a/bin/application/Main.class b/bin/application/Main.class index 1785f2c..9cdfae8 100644 Binary files a/bin/application/Main.class and b/bin/application/Main.class differ diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class index f602b41..8e46a03 100644 Binary files a/bin/application/MainWindowController$1.class and b/bin/application/MainWindowController$1.class differ diff --git a/bin/application/MainWindowController$2.class b/bin/application/MainWindowController$2.class index fba7c04..11fe4aa 100644 Binary files a/bin/application/MainWindowController$2.class and b/bin/application/MainWindowController$2.class differ diff --git a/bin/application/MainWindowController$3.class b/bin/application/MainWindowController$3.class index 2b78f19..4eabe31 100644 Binary files a/bin/application/MainWindowController$3.class and b/bin/application/MainWindowController$3.class differ diff --git a/bin/application/MainWindowController$4.class b/bin/application/MainWindowController$4.class index f00482b..c9da13f 100644 Binary files a/bin/application/MainWindowController$4.class and b/bin/application/MainWindowController$4.class differ diff --git a/bin/application/MainWindowController$5.class b/bin/application/MainWindowController$5.class index 4726153..22237c1 100644 Binary files a/bin/application/MainWindowController$5.class and b/bin/application/MainWindowController$5.class differ diff --git a/bin/application/MainWindowController$6.class b/bin/application/MainWindowController$6.class index c1b2b09..20d20b6 100644 Binary files a/bin/application/MainWindowController$6.class and b/bin/application/MainWindowController$6.class differ diff --git a/bin/application/MainWindowController$7.class b/bin/application/MainWindowController$7.class index 117bf7a..21456a4 100644 Binary files a/bin/application/MainWindowController$7.class and b/bin/application/MainWindowController$7.class differ diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class index 492d6ca..97cb824 100644 Binary files a/bin/application/MainWindowController.class and b/bin/application/MainWindowController.class differ diff --git a/bin/application/apiQuery.class b/bin/application/apiQuery.class index 83ed6ce..b1cd822 100644 Binary files a/bin/application/apiQuery.class and b/bin/application/apiQuery.class differ diff --git a/bin/libraries/commons-lang3-3.5.jar b/bin/libraries/commons-lang3-3.5.jar deleted file mode 100644 index 6328c8d..0000000 Binary files a/bin/libraries/commons-lang3-3.5.jar and /dev/null differ diff --git a/src/application/DBController.java b/src/application/DBController.java index 06e2a69..8e3ba08 100644 --- a/src/application/DBController.java +++ b/src/application/DBController.java @@ -1,4 +1,5 @@ /** + * @author Jannik * DBController for Project HomeFlix * connection is in manual commit! */ @@ -31,11 +32,13 @@ import javafx.scene.text.Text; public class DBController { - public DBController(MainWindowController m) { + public DBController(MainWindowController m, Main main) { mainWindowController = m; + this.main = main; } private MainWindowController mainWindowController; + private Main main; private String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; //path to database file private Image favorite_black = new Image("recources/icons/ic_favorite_black_18dp_1x.png"); private Image favorite_border_black = new Image("recources/icons/ic_favorite_border_black_18dp_1x.png"); @@ -329,8 +332,10 @@ public class DBController { * @throws SQLException * @throws FileNotFoundException * @throws IOException + * if lastName != filmsStreamData.get(b) then set i = 0, file changed */ private void checkAddEntry() throws SQLException, FileNotFoundException, IOException{ + String lastName = ""; System.out.println("checking for entrys to add to DB ..."); String[] entries = new File(mainWindowController.getPath()).list(); Statement stmt = connection.createStatement(); @@ -348,16 +353,20 @@ public class DBController { } for(int b=0; b nameText = new ArrayList(); ArrayList responseText = new ArrayList(); - String fontFamily = mainWindowController.fontFamily; + String fontFamily = main.getFONT_FAMILY(); Image im; int fontSize = (int) Math.round(mainWindowController.size); int j=2; diff --git a/src/application/Main.java b/src/application/Main.java index 00e8242..3c75ecc 100644 --- a/src/application/Main.java +++ b/src/application/Main.java @@ -42,19 +42,22 @@ public class Main extends Application { Stage primaryStage; private String path; - private String streamingPathWin = System.getProperty("user.home") + "\\Documents\\HomeFlix"; - private String streamingPathLinux = System.getProperty("user.home") + "/HomeFlix"; - private String color = "ee3523"; - private String mode = "local"; //local or streaming +// private String streamingPathWin = System.getProperty("user.home") + "\\Documents\\HomeFlix"; +// private String streamingPathLinux = System.getProperty("user.home") + "/HomeFlix"; + private String COLOR = "ee3523"; + private String FONT_FAMILY = "System"; + private String mode = "local"; //local or streaming TODO private String local = System.getProperty("user.language")+"_"+System.getProperty("user.country"); - private boolean autoUpdate = false; - private double size = 17; + private boolean AUTO_UPDATE = false; + private double FONT_SIZE = 17; private ResourceBundle bundle; private MainWindowController mainWindowController; - private File dirWin = new File(System.getProperty("user.home") + "/Documents/HomeFlix"); //Windows: C:/Users/"User"/Documents/HomeFlix - private File dirLinux = new File(System.getProperty("user.home") + "/HomeFlix"); //Linux: /home/"User"/HomeFlix - private File fileWin = new File(dirWin + "/config.xml"); //Windows: C:/Users/"User"/Documents/HomeFlix/config.xml - private File fileLinux = new File(dirLinux + "/config.xml"); //Linux: /home/"User"/HomeFlix/config.xml + private File directory; + private File settingsFile; + private String dirWin = System.getProperty("user.home") + "/Documents/HomeFlix"; //Windows: C:/Users/"User"/Documents/HomeFlix + private String dirLinux = System.getProperty("user.home") + "/HomeFlix"; //Linux: /home/"User"/HomeFlix + private String fileWin = dirWin + "/config.xml"; //Windows: C:/Users/"User"/Documents/HomeFlix/config.xml + private String fileLinux = dirLinux + "/config.xml"; //Linux: /home/"User"/HomeFlix/config.xml @Override public void start(Stage primaryStage) { @@ -74,43 +77,66 @@ public class Main extends Application { primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/recources/Homeflix_Icon_64x64.png"))); //adds application icon mainWindowController = loader.getController(); //Link of FXMLController and controller class - mainWindowController.setAutoUpdate(autoUpdate); //set auto-update + mainWindowController.setAutoUpdate(AUTO_UPDATE); //set auto-update mainWindowController.setMain(this); //call setMain //Linux if directory exists -> check config.xml - if(System.getProperty("os.name").equals("Linux")){ - if(dirLinux.exists() != true){ - dirLinux.mkdir(); - }else if(fileLinux.exists() != true){ - mainWindowController.setPath(firstStart()); - mainWindowController.setStreamingPath(streamingPathLinux); - mainWindowController.setColor(color); - mainWindowController.setSize(size); - mainWindowController.setAutoUpdate(autoUpdate); - mainWindowController.setLocal(local); - mainWindowController.setMode(mode); - mainWindowController.saveSettings(); - Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs) - System.exit(0); //finishes itself - } - //windows - }else{ - if(dirWin.exists() != true){ - dirWin.mkdir(); - }else if(fileWin.exists() != true){ - mainWindowController.setPath(firstStart()); - mainWindowController.setStreamingPath(streamingPathWin); - mainWindowController.setColor(color); - mainWindowController.setSize(size); - mainWindowController.setAutoUpdate(autoUpdate); - mainWindowController.setLocal(local); - mainWindowController.setMode(mode); - mainWindowController.saveSettings(); - Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs) - System.exit(0); //finishes itself - } + if(System.getProperty("os.name").equals("Linux")) { + directory = new File(dirLinux); + settingsFile = new File(fileLinux); + } else { + directory = new File(dirWin); + settingsFile = new File(fileWin); } + if(settingsFile.exists() != true){ + directory.mkdir(); + mainWindowController.setPath(firstStart()); + mainWindowController.setStreamingPath(directory.getAbsolutePath()); + mainWindowController.setColor(COLOR); + mainWindowController.setSize(FONT_SIZE); + mainWindowController.setAutoUpdate(AUTO_UPDATE); + mainWindowController.setLocal(local); + mainWindowController.setMode(mode); + mainWindowController.saveSettings(); + Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs) + System.exit(0); //finishes itse + } + + +// if(System.getProperty("os.name").equals("Linux")){ +// if(dirLinux.exists() != true){ +// dirLinux.mkdir(); +// }else if(fileLinux.exists() != true) { +// mainWindowController.setPath(firstStart()); +// mainWindowController.setStreamingPath(streamingPathLinux); +// mainWindowController.setColor(COLOR); +// mainWindowController.setSize(FONT_SIZE); +// mainWindowController.setAutoUpdate(AUTO_UPDATE); +// mainWindowController.setLocal(local); +// mainWindowController.setMode(mode); +// mainWindowController.saveSettings(); +// Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs) +// System.exit(0); //finishes itself +// } +// //windows +// }else{ +// if(dirWin.exists() != true){ +// dirWin.mkdir(); +// }else if(fileWin.exists() != true){ +// mainWindowController.setPath(firstStart()); +// mainWindowController.setStreamingPath(streamingPathWin); +// mainWindowController.setColor(COLOR); +// mainWindowController.setSize(FONT_SIZE); +// mainWindowController.setAutoUpdate(AUTO_UPDATE); +// mainWindowController.setLocal(local); +// mainWindowController.setMode(mode); +// mainWindowController.saveSettings(); +// Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs) +// System.exit(0); //finishes itself +// } +// } + mainWindowController.loadSettings(); mainWindowController.loadStreamingSettings(); mainWindowController.initUI(); @@ -166,4 +192,12 @@ public class Main extends Application { public static void main(String[] args) { launch(args); } + + public String getFONT_FAMILY() { + return FONT_FAMILY; + } + + public void setFONT_FAMILY(String FONT_FAMILY) { + this.FONT_FAMILY = FONT_FAMILY; + } } \ No newline at end of file diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java index 47e6303..67cd94c 100644 --- a/src/application/MainWindowController.java +++ b/src/application/MainWindowController.java @@ -213,7 +213,6 @@ public class MainWindowController { @SuppressWarnings("unused") private String ratingSortType; private String local; - String fontFamily = "System"; //TODO -> in mainwindowcontroller machen String title; String year; String rating; @@ -518,8 +517,8 @@ public class MainWindowController { void setMain(Main main) { this.main = main; Updater = new updater(this,buildURL, downloadLink, buildNumber); - dbController = new DBController(this); - ApiQuery = new apiQuery(this, dbController); + dbController = new DBController(this, this.main); + ApiQuery = new apiQuery(this, dbController, this.main); } //Initialize the tables (treeTableViewfilm and tableViewStreamingdata) diff --git a/src/application/apiQuery.java b/src/application/apiQuery.java index 69622a5..a9d7d66 100644 --- a/src/application/apiQuery.java +++ b/src/application/apiQuery.java @@ -21,13 +21,15 @@ import javafx.scene.text.Text; public class apiQuery{ - public apiQuery(MainWindowController m, DBController db){ + public apiQuery(MainWindowController m, DBController db, Main main){ mainWindowController=m; dbController=db; + this.main = main; } private MainWindowController mainWindowController; private DBController dbController; + private Main main; private Image im; private String[] responseString = new String[20]; ArrayList responseText = new ArrayList(); @@ -42,7 +44,7 @@ public class apiQuery{ String retdata = null; InputStream is = null; BufferedReader br = null; - String fontFamily = mainWindowController.fontFamily; + String fontFamily = main.getFONT_FAMILY(); int fontSize = (int) Math.round(mainWindowController.size); responseText.removeAll(responseText);