diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..0499fc0
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
index cd2946a..3dd2f04 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,3 +45,6 @@ $RECYCLE.BIN/
Network Trash Folder
Temporary Items
.apdisk
+ProjectHomeFlix.jar
+jfoenix.jar
+minimal-json-0.9.4.jar
diff --git a/.project b/.project
new file mode 100644
index 0000000..5457f9b
--- /dev/null
+++ b/.project
@@ -0,0 +1,23 @@
+
+
+ Project HomeFlix
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.xtext.ui.shared.xtextBuilder
+
+
+
+
+
+ org.eclipse.xtext.ui.shared.xtextNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3a21537
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/bin/Homeflix_Icon_64x64.png b/bin/Homeflix_Icon_64x64.png
new file mode 100644
index 0000000..64787d6
Binary files /dev/null and b/bin/Homeflix_Icon_64x64.png differ
diff --git a/bin/Homeflix_Poster.png b/bin/Homeflix_Poster.png
new file mode 100644
index 0000000..9f2aa98
Binary files /dev/null and b/bin/Homeflix_Poster.png differ
diff --git a/bin/application/DBController$1.class b/bin/application/DBController$1.class
new file mode 100644
index 0000000..6925686
Binary files /dev/null and b/bin/application/DBController$1.class differ
diff --git a/bin/application/DBController.class b/bin/application/DBController.class
new file mode 100644
index 0000000..006445c
Binary files /dev/null and b/bin/application/DBController.class differ
diff --git a/bin/application/HomeFlix-Local_de_DE.properties b/bin/application/HomeFlix-Local_de_DE.properties
new file mode 100644
index 0000000..50ed795
--- /dev/null
+++ b/bin/application/HomeFlix-Local_de_DE.properties
@@ -0,0 +1,15 @@
+# HomeFlix-Local_de_DE.properties German Local
+info = Info
+settings = Einstellungen
+play = play
+openFolder = Ordner \u00F6ffnen
+chooseFolder = Ordner auswählen
+fontSize = Schriftgr\u00F6\u00DFe:
+checkUpdates = Auf Update pr\u00FCfen
+autoUpdate = beim Start nach Updates suchen:
+version = Version:
+columnName = Name
+columnRating = Bewertung
+columnDatName = Datei Name
+errorUpdate = Es ist ein Fehler aufgetreten! \n Um Hilfe zu erhalten besuchen Sie \nwww.kellerkinder.xyz oder support@kellerkinder.xyz
+infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz
\ No newline at end of file
diff --git a/bin/application/HomeFlix-Local_en_US.properties b/bin/application/HomeFlix-Local_en_US.properties
new file mode 100644
index 0000000..25a9919
--- /dev/null
+++ b/bin/application/HomeFlix-Local_en_US.properties
@@ -0,0 +1,15 @@
+# HomeFlix-Local_en_US.properties US-English Local and default
+info = Info
+settings = Settings
+play = play
+openFolder = open Folder
+chooseFolder = choose Directory
+fontSize = font size:
+checkUpdates = check for updates
+autoUpdate = check at startup for updates:
+version = Version:
+columnName = Name
+columnRating = Rating
+columnDatName = File Name
+errorUpdate = An error has occurred! \n To get help, visit \n nwww.kellerkinder.xyz or support@kellerkinder.xyz
+infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz
\ No newline at end of file
diff --git a/bin/application/Main.class b/bin/application/Main.class
new file mode 100644
index 0000000..a83a966
Binary files /dev/null and b/bin/application/Main.class differ
diff --git a/bin/application/MainWindow.fxml b/bin/application/MainWindow.fxml
new file mode 100644
index 0000000..e44b558
--- /dev/null
+++ b/bin/application/MainWindow.fxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class
new file mode 100644
index 0000000..7f2237a
Binary files /dev/null and b/bin/application/MainWindowController$1.class differ
diff --git a/bin/application/MainWindowController$2$1.class b/bin/application/MainWindowController$2$1.class
new file mode 100644
index 0000000..f20a801
Binary files /dev/null and b/bin/application/MainWindowController$2$1.class differ
diff --git a/bin/application/MainWindowController$2$2.class b/bin/application/MainWindowController$2$2.class
new file mode 100644
index 0000000..20a7145
Binary files /dev/null and b/bin/application/MainWindowController$2$2.class differ
diff --git a/bin/application/MainWindowController$2$3.class b/bin/application/MainWindowController$2$3.class
new file mode 100644
index 0000000..7c34a8b
Binary files /dev/null and b/bin/application/MainWindowController$2$3.class differ
diff --git a/bin/application/MainWindowController$2$4.class b/bin/application/MainWindowController$2$4.class
new file mode 100644
index 0000000..b91a643
Binary files /dev/null and b/bin/application/MainWindowController$2$4.class differ
diff --git a/bin/application/MainWindowController$2$5.class b/bin/application/MainWindowController$2$5.class
new file mode 100644
index 0000000..e670191
Binary files /dev/null and b/bin/application/MainWindowController$2$5.class differ
diff --git a/bin/application/MainWindowController$2$6.class b/bin/application/MainWindowController$2$6.class
new file mode 100644
index 0000000..8f4224d
Binary files /dev/null and b/bin/application/MainWindowController$2$6.class differ
diff --git a/bin/application/MainWindowController$2.class b/bin/application/MainWindowController$2.class
new file mode 100644
index 0000000..9769d9c
Binary files /dev/null and b/bin/application/MainWindowController$2.class differ
diff --git a/bin/application/MainWindowController$3.class b/bin/application/MainWindowController$3.class
new file mode 100644
index 0000000..b3eb020
Binary files /dev/null and b/bin/application/MainWindowController$3.class differ
diff --git a/bin/application/MainWindowController$4.class b/bin/application/MainWindowController$4.class
new file mode 100644
index 0000000..91832b3
Binary files /dev/null and b/bin/application/MainWindowController$4.class differ
diff --git a/bin/application/MainWindowController$5.class b/bin/application/MainWindowController$5.class
new file mode 100644
index 0000000..1380ab2
Binary files /dev/null and b/bin/application/MainWindowController$5.class differ
diff --git a/bin/application/MainWindowController$6.class b/bin/application/MainWindowController$6.class
new file mode 100644
index 0000000..57aa192
Binary files /dev/null and b/bin/application/MainWindowController$6.class differ
diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class
new file mode 100644
index 0000000..1cab0b0
Binary files /dev/null and b/bin/application/MainWindowController.class differ
diff --git a/bin/application/application.css b/bin/application/application.css
new file mode 100644
index 0000000..83d6f33
--- /dev/null
+++ b/bin/application/application.css
@@ -0,0 +1 @@
+/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */
\ No newline at end of file
diff --git a/bin/application/uiData.class b/bin/application/uiData.class
new file mode 100644
index 0000000..9b06b70
Binary files /dev/null and b/bin/application/uiData.class differ
diff --git a/bin/menu_icon_black.png b/bin/menu_icon_black.png
new file mode 100644
index 0000000..19711de
Binary files /dev/null and b/bin/menu_icon_black.png differ
diff --git a/build.fxbuild b/build.fxbuild
new file mode 100644
index 0000000..a7511ff
--- /dev/null
+++ b/build.fxbuild
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/config.xml b/config.xml
new file mode 100644
index 0000000..ada16c4
--- /dev/null
+++ b/config.xml
@@ -0,0 +1,10 @@
+
+
+
+Project HomeFlix settings
+ee3523
+0
+12.0
+1
+C:\Users\Jannik\Videos\Beispielfilme
+
diff --git a/src/Homeflix_Icon_64x64.png b/src/Homeflix_Icon_64x64.png
new file mode 100644
index 0000000..64787d6
Binary files /dev/null and b/src/Homeflix_Icon_64x64.png differ
diff --git a/src/Homeflix_Poster.png b/src/Homeflix_Poster.png
new file mode 100644
index 0000000..9f2aa98
Binary files /dev/null and b/src/Homeflix_Poster.png differ
diff --git a/src/application/DBController.java b/src/application/DBController.java
new file mode 100644
index 0000000..958eb0a
--- /dev/null
+++ b/src/application/DBController.java
@@ -0,0 +1,216 @@
+package application;
+
+import java.sql.Connection; //für Datenbank
+import java.sql.DriverManager; //für Datenbank
+import java.sql.PreparedStatement; //für Datenbank
+import java.sql.ResultSet; //für Datenbank
+import java.sql.SQLException; //für Datenbank
+import java.sql.Statement; //für Datenbank
+import java.io.File;//für Dateien einlesen
+
+class DBController {
+
+ @SuppressWarnings("unused")
+ private MainWindowController mainWindowController;
+ private static final DBController dbcontroller = new DBController();
+ private static Connection connection;
+ private static final String DB_PATH = System.getProperty("user.dir") + "/" + "Homeflix.db"; // der Pfad der Datenbank-Datei
+ private String path;
+ File f;
+ File file[]; //ArrayList für die Dateien
+
+ static {
+ try {
+ Class.forName("org.sqlite.JDBC"); //Datenbanktreiber
+ } catch (ClassNotFoundException e) {
+ System.err.println("Fehler beim Laden des JDBC-Treibers");
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String input) {
+ DBController datenbank = DBController.getInstance(); //neues Datenbank-Objekt wird erstellt
+ datenbank.setPath(input); // Pfad zuweisen
+ datenbank.f = new File(datenbank.getPath()); // für Datenbank-Datei einlesen
+ datenbank.file = datenbank.f.listFiles(); // für Datenbank-Datei einlesen
+ datenbank.verbindeDatenbank();
+ datenbank.fuelleDatenbank();
+ //datenbank.defavorisieren("Frozen");
+ //datenbank.favorisieren("Frozen");
+ //datenbank.ausgebenTitel();
+ //System.out.println("Pfad: " + datenbank.getPfad("Frozen"));
+ //System.out.println("Bewertung: " + datenbank.getFavStatus("Frozen"));
+ }
+
+ DBController(){
+ }
+
+ private static DBController getInstance(){
+ return dbcontroller;
+ }
+// Die Datenbak wird mit Hilfe des JDBC-Treibers eingebunden
+ public void verbindeDatenbank() {
+ try {
+ if (connection != null)
+ return;
+ System.out.println("Erstelle Verbindung zur Datenbank...");
+ connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
+ if (!connection.isClosed())
+ System.out.println("...Verbindung hergestellt");
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ public void run() {
+ try {
+ if (!connection.isClosed() && connection != null) {
+ connection.close();
+ if (connection.isClosed())
+ System.out.println("Verbindung getrennt");
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+// Die Dateien werden in die Datenbank geschrieben
+ public void fuelleDatenbank() {
+
+ try {
+ System.out.println("Erstelle Einträge");
+ Statement stmt = connection.createStatement();
+ stmt.executeUpdate("DROP TABLE IF EXISTS filme;");
+ stmt.executeUpdate("CREATE TABLE filme (titel, pfad, bewertung);"); // Tabelle "filme" und die Spalten "titel", "pfad", "bewertung" erstellen
+
+ PreparedStatement ps = connection.prepareStatement("INSERT INTO filme VALUES (?, ?, ?);"); // SQL Befehl
+
+ //System.out.println(file.length);
+
+ for(int i=0;i!=file.length;i++) // Geht alle Dateien im Verzeichniss durch
+ {
+ //System.out.println(file[i].getName());
+ ps.setString(1, ohneEndung(file[i].getName())); // definiert Name als String in der ersten Spalte
+ ps.setString(2,file[i].getName()); // definiert Pfad als String in der zweiten Spalte
+ ps.setInt(3, 0); // definiert Bewertung als Integer in der dritten Spalte
+ ps.addBatch(); // fügt den Eintrag hinzu
+ }
+
+ connection.setAutoCommit(false);
+ ps.executeBatch(); // scheibt alle Einträge in die Datenbank
+ connection.setAutoCommit(true);
+ //connection.close();
+ } catch (SQLException e) {
+ System.err.println("Konnte nicht ausgeführt werden");
+ e.printStackTrace();
+ }
+ }
+
+ public void ausgeben(){
+ System.out.println("Einträge ausgeben");
+ try {
+ Statement stmt = connection.createStatement();
+ mainWindowController = new MainWindowController();
+ ResultSet rs = stmt.executeQuery("SELECT * FROM filme;");
+ while (rs.next()) {
+// MainWindowController mainWindowController = new MainWindowController();
+ }
+ //rs.close();
+// mainWindowController.initTabel();
+
+
+ } catch (SQLException e) {
+ System.err.println("Konnte nicht ausgeführt werden");
+ e.printStackTrace();
+ }
+
+
+ }
+// Kontroll Methode, ob ein Film wirklich in der Datenbank ist
+ public String getTitel(String name){
+ try {
+ Statement stmt = connection.createStatement();
+ ResultSet rs = stmt.executeQuery("SELECT titel, pfad FROM filme WHERE titel = '"+name+"';" );
+ return rs.getString("titel");
+ } catch (SQLException e) {
+ System.err.println("Konnte nicht ausgeführt werden");
+ e.printStackTrace();
+ }
+ return "Error 404";
+ }
+// gibt den Pfad eines bestimmten Films
+ public String getPfad(String name){
+ try {
+ Statement stmt = connection.createStatement();
+ ResultSet rs = stmt.executeQuery("SELECT titel, pfad FROM filme WHERE titel = '"+name+"';" ); //SQL Befehl
+ return rs.getString("pfad");
+ } catch (SQLException e) {
+ System.err.println("Konnte nicht ausgeführt werden");
+ e.printStackTrace();
+ }
+ return "Error 404";
+ }
+// gibt die Favorisierung eines bestimmten Films
+ public boolean getFavStatus(String name){
+ try {
+ Statement stmt = connection.createStatement();
+ ResultSet rs = stmt.executeQuery("SELECT titel, bewertung FROM filme WHERE titel = '"+name+"';" ); //SQL Befehl
+ System.out.println(rs.getInt("bewertung"));
+ if((rs.getInt("bewertung")) == 1){
+ return true;
+ }
+ else{
+ return false;
+ }
+ } catch (SQLException e) {
+ System.err.println("Konnte nicht ausgeführt werden");
+ e.printStackTrace();
+ return false;
+ }
+ }
+// setzt die Defavorisierung eines bestimmten Films
+ public void defavorisieren(String name){
+ System.out.println("setze Bewertung");
+ try {
+ Statement stmt = connection.createStatement();
+ String sql = ("UPDATE filme SET bewertung=0 WHERE titel='"+name+"';"); //SQL Befehl
+ stmt.executeUpdate(sql);
+ connection.setAutoCommit(false);
+ connection.setAutoCommit(true);
+ } catch (SQLException e) {
+ System.err.println("Konnte nicht ausgeführt werden");
+ e.printStackTrace();
+ }
+ }
+// setzt die Favorisierung eines bestimmten Films
+ public void favorisieren(String name){
+ System.out.println("setze Bewertung");
+ try {
+ Statement stmt = connection.createStatement();
+ String sql = ("UPDATE filme SET bewertung=1 WHERE titel='"+name+"';"); //SQL Befehl
+ stmt.executeUpdate(sql);
+ connection.setAutoCommit(false);
+ connection.setAutoCommit(true);
+ } catch (SQLException e) {
+ System.err.println("Konnte nicht ausgeführt werden");
+ e.printStackTrace();
+ }
+ }
+//entfernt die Endung
+ private static String ohneEndung (String str) {
+
+ if (str == null) return null;
+ int pos = str.lastIndexOf(".");
+ if (pos == -1) return str;
+ return str.substring(0, pos);
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path.replace("\\", "\\\\");
+ }
+}
diff --git a/src/application/HomeFlix-Local_de_DE.properties b/src/application/HomeFlix-Local_de_DE.properties
new file mode 100644
index 0000000..50ed795
--- /dev/null
+++ b/src/application/HomeFlix-Local_de_DE.properties
@@ -0,0 +1,15 @@
+# HomeFlix-Local_de_DE.properties German Local
+info = Info
+settings = Einstellungen
+play = play
+openFolder = Ordner \u00F6ffnen
+chooseFolder = Ordner auswählen
+fontSize = Schriftgr\u00F6\u00DFe:
+checkUpdates = Auf Update pr\u00FCfen
+autoUpdate = beim Start nach Updates suchen:
+version = Version:
+columnName = Name
+columnRating = Bewertung
+columnDatName = Datei Name
+errorUpdate = Es ist ein Fehler aufgetreten! \n Um Hilfe zu erhalten besuchen Sie \nwww.kellerkinder.xyz oder support@kellerkinder.xyz
+infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz
\ No newline at end of file
diff --git a/src/application/HomeFlix-Local_en_US.properties b/src/application/HomeFlix-Local_en_US.properties
new file mode 100644
index 0000000..25a9919
--- /dev/null
+++ b/src/application/HomeFlix-Local_en_US.properties
@@ -0,0 +1,15 @@
+# HomeFlix-Local_en_US.properties US-English Local and default
+info = Info
+settings = Settings
+play = play
+openFolder = open Folder
+chooseFolder = choose Directory
+fontSize = font size:
+checkUpdates = check for updates
+autoUpdate = check at startup for updates:
+version = Version:
+columnName = Name
+columnRating = Rating
+columnDatName = File Name
+errorUpdate = An error has occurred! \n To get help, visit \n nwww.kellerkinder.xyz or support@kellerkinder.xyz
+infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz
\ No newline at end of file
diff --git a/src/application/Main.java b/src/application/Main.java
new file mode 100644
index 0000000..b7248c6
--- /dev/null
+++ b/src/application/Main.java
@@ -0,0 +1,148 @@
+/**
+ * Project HomeFlix
+ *
+ * Copyright 2016
+ *
+ * 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;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Optional;
+import java.util.Properties;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Scene;
+import javafx.scene.control.Alert;
+import javafx.scene.control.Alert.AlertType;
+import javafx.scene.control.ButtonType;
+import javafx.scene.image.Image;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.paint.Color;
+import javafx.stage.DirectoryChooser;
+import javafx.stage.Stage;
+
+public class Main extends Application {
+
+ public Stage primaryStage;
+ private String path;
+ private String color = "ee3523";
+ private String autoUpdate = "0";
+ private double size = 12;
+ private int local = 0;
+ Properties props = new Properties();
+ private MainWindowController mainWindowController;
+
+ @Override
+ public void start(Stage primaryStage) {
+ this.primaryStage = primaryStage;
+ mainWindow();
+ }
+
+ public void mainWindow(){
+ File file = new File("config.xml");
+ try {
+ FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml"));
+ AnchorPane pane = loader.load();
+ primaryStage.setMinHeight(600.00);
+ primaryStage.setMinWidth(900.00);
+ primaryStage.setResizable(false);
+ primaryStage.setTitle("Project HomeFlix");
+ primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/Homeflix_Icon_64x64.png"))); //fügt Anwendungsicon hinzu
+
+
+ mainWindowController = loader.getController(); //verknüpfung von FXMLController und Controller Klasse
+ mainWindowController.setAutoUpdate(autoUpdate); //setzt autoupdate
+ mainWindowController.setMain(this); //aufruf setMain
+
+ //prüft ob config.xml vorhanden, wenn nicht hole Pfad und schreibe Daten in Controller
+ if (file.exists() != true) {
+ mainWindowController.setPath(firstStart());
+ mainWindowController.setColor(color);
+ mainWindowController.setSize(size);
+ mainWindowController.setAutoUpdate(autoUpdate);
+ mainWindowController.setLoaclUI(local);
+ mainWindowController.saveSettings();
+ Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //starte neu um Bugs zu verhindern
+ System.exit(0); //beendet sich selbst
+ }else{
+ loadSettings();
+ }
+
+ mainWindowController.applyColor(); //setzt die Theme Farbe
+ mainWindowController.cbLocal.getSelectionModel().select(mainWindowController.getLocal()); //setzt local
+ mainWindowController.mainColor.setValue(Color.valueOf(mainWindowController.getColor()));
+ mainWindowController.loadData(); //läd die Daten im Controller
+
+ Scene scene = new Scene(pane); //neue Scen um inhalt der stage anzuzeigen
+
+ primaryStage.setScene(scene);
+ primaryStage.show(); //zeige scene
+ } catch (IOException e) {
+ // Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ //methode für den erstmaligen Start
+ private String firstStart(){
+ Alert alert = new Alert(AlertType.CONFIRMATION); //neuer alert mit filechooser
+ alert.setTitle("Project HomeFlix");
+ alert.setHeaderText("Es ist kein Stammverzeichniss für Filme angegeben!");
+ alert.setContentText("Stammverzeichniss angeben?");
+
+ Optional result = alert.showAndWait();
+ if (result.get() == ButtonType.OK){
+ DirectoryChooser directoryChooser = new DirectoryChooser();
+ File selectedDirectory =
+ directoryChooser.showDialog(primaryStage);
+ path = selectedDirectory.getAbsolutePath();
+
+ } else {
+ path = "";
+ }
+ return path;
+ }
+
+ //lädt die einstellungen aus der XML
+ public void loadSettings(){
+ File configFile = new File("config.xml");
+ try {
+ InputStream inputStream = new FileInputStream(configFile);
+ props.loadFromXML(inputStream);
+ path = props.getProperty("path");
+ color = props.getProperty("color");
+ autoUpdate = props.getProperty("autoUpdate");
+ size = Double.parseDouble(props.getProperty("size"));
+ local = Integer.parseInt(props.getProperty("local"));
+
+ inputStream.close();
+ } catch (IOException e) {
+ // Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
\ No newline at end of file
diff --git a/src/application/MainWindow.fxml b/src/application/MainWindow.fxml
new file mode 100644
index 0000000..e44b558
--- /dev/null
+++ b/src/application/MainWindow.fxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java
new file mode 100644
index 0000000..cc4e46c
--- /dev/null
+++ b/src/application/MainWindowController.java
@@ -0,0 +1,854 @@
+/**
+ * Project HomeFlix
+ *
+ * Copyright 2016
+ *
+ * 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;
+
+import java.awt.Desktop;
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.math.BigInteger;
+import java.net.URL;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.util.Locale;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.Scanner;
+
+import com.eclipsesource.json.Json;
+import com.eclipsesource.json.JsonObject;
+import com.jfoenix.controls.JFXButton;
+import com.jfoenix.controls.JFXColorPicker;
+import com.jfoenix.controls.JFXDialog;
+import com.jfoenix.controls.JFXSlider;
+import com.jfoenix.controls.JFXTextArea;
+import com.jfoenix.controls.JFXTextField;
+import com.jfoenix.controls.JFXToggleButton;
+
+import javafx.beans.property.ReadOnlyObjectWrapper;
+import javafx.beans.property.ReadOnlyStringWrapper;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
+import javafx.fxml.FXML;
+import javafx.geometry.Insets;
+import javafx.scene.control.Alert;
+import javafx.scene.control.Alert.AlertType;
+import javafx.scene.control.ChoiceBox;
+import javafx.scene.control.Label;
+import javafx.scene.control.TreeItem;
+import javafx.scene.control.TreeTableColumn;
+import javafx.scene.control.TreeTableColumn.CellDataFeatures;
+import javafx.scene.control.TreeTableView;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.layout.VBox;
+import javafx.scene.paint.Color;
+import javafx.scene.text.Font;
+import javafx.scene.text.FontWeight;
+import javafx.stage.DirectoryChooser;
+
+public class MainWindowController {
+ @FXML
+ private AnchorPane anpane;
+ @FXML
+ private AnchorPane settingsan = new AnchorPane();
+ @FXML
+ private VBox topVBox;
+ @FXML
+ private VBox menuBox = new VBox();
+ @FXML
+ private VBox settingsBox = new VBox();
+ @FXML
+ private TreeTableView treeTableViewfilm;
+ @FXML
+ private JFXTextArea ta1;
+ @FXML
+ private JFXButton menubtn;
+ @FXML
+ private JFXButton playbtn;
+ @FXML
+ private JFXButton openfolderbtn;
+ @FXML
+ private JFXButton returnBtn;
+ @FXML
+ private JFXButton forwardBtn;
+ @FXML
+ private JFXButton infoBtn = new JFXButton("Info");
+ @FXML
+ private JFXButton demoBtn = new JFXButton("Beheben");
+ @FXML
+ private JFXButton settingsBtn = new JFXButton("Settings");
+ @FXML
+ private JFXButton updateBtn = new JFXButton("Auf Update prüfen");
+ @FXML
+ private JFXButton directoryBtn = new JFXButton("Ordner auswählen");
+ @FXML
+ private JFXToggleButton autoupdateBtn = new JFXToggleButton();
+ @FXML
+ public JFXTextField tfPfad = new JFXTextField();
+ @FXML
+ private JFXTextField tfsearch;
+ @FXML
+ public JFXColorPicker mainColor = new JFXColorPicker();
+ @FXML
+ public ChoiceBox cbLocal = new ChoiceBox();
+ @FXML
+ public JFXSlider sl1 = new JFXSlider();
+ @FXML
+ private JFXDialog dialog = new JFXDialog();
+ @FXML
+ private Label versionlbl = new Label();
+ @FXML
+ private Label sizelbl = new Label("Schriftgröße:");
+ @FXML
+ private Label aulbl = new Label("beim starten nach Updates suchen:");
+ @FXML
+ private ImageView image1;
+
+ @FXML
+ TreeItem root = new TreeItem<>(new uiData(1.0, "filme","1"));
+ @FXML
+ TreeTableColumn columnRating = new TreeTableColumn<>("Bewertung");
+ @FXML
+ TreeTableColumn columnName = new TreeTableColumn<>("Name");
+ @FXML
+ TreeTableColumn columnDatName = new TreeTableColumn<>("Datei Name");
+
+ private boolean menutrue = false; //merker für menubtn (öffnen oder schließen)
+ private boolean settingstrue = false;
+ private String version = "0.3.5";
+ private String versionURL = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/version";
+ private String downloadLink = "";
+ private String updateDataURL = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/ProjectHomeFlix.jar";
+
+ private String errorUpdate;
+ private String infoText;
+ private String aktVersion;
+ private String path;
+ private String color;
+ private String Name;
+ private String datPath;
+ private String autoUpdate;
+ private double size;
+ private int last;
+ private int selected;
+ private int next;
+ private int local;
+ private File selectedFolder;
+ private ResourceBundle bundle;
+
+ private ObservableList newDaten = FXCollections.observableArrayList();
+ private ObservableList filterData = FXCollections.observableArrayList();
+ private ObservableList locals = FXCollections.observableArrayList("english", "deutsch");
+ private Image imHF = new Image("Homeflix_Poster.png");
+ private ImageView menu_icon_black = new ImageView(new Image("menu_icon_black.png"));
+// private ImageView menu_icon_white = new ImageView(new Image("menu_icon_white.png"));
+ private DirectoryChooser directoryChooser = new DirectoryChooser();
+ Properties props = new Properties();
+
+ //wenn menubtn clicked
+ /**
+ * TODO fix directory bug under linux
+ * TODO change value of Text-color change
+ * TODO menu icon white
+ */
+ @FXML
+ private void menubtnclicked(){
+ if(menutrue == false){
+ anpane.getChildren().addAll(menuBox);
+
+ //infobtn clicked
+ infoBtn.setOnAction(new EventHandler(){
+ @Override
+ public void handle(ActionEvent event) {
+ Alert alert = new Alert(AlertType.INFORMATION);
+ alert.setTitle("Info");
+ alert.setHeaderText("Project HomeFlix");
+ alert.setContentText(infoText);
+ alert.showAndWait();
+ }
+ });
+
+ //setteingsbtn clicked, deklarieren der actions der Objekte die bei settingsbtn angezeigt werden
+ settingsBtn.setOnAction(new EventHandler() {
+ @Override
+ public void handle(ActionEvent event){
+ if(settingstrue == false){
+ anpane.getChildren().addAll(settingsBox);
+
+ tfPfad.setOnAction(new EventHandler(){
+ @Override
+ public void handle(ActionEvent event){
+ setPath(tfPfad.getText());
+ saveSettings();
+ }
+ });
+ directoryBtn.setOnAction(new EventHandler() {
+ @Override
+ public void handle(ActionEvent event){
+ selectedFolder = directoryChooser.showDialog(null);
+ if(selectedFolder == null){
+ System.out.println("No Directory selected");
+ }else{
+ setPath(selectedFolder.getAbsolutePath());
+ saveSettings();
+ tfPfad.setText(getPath());
+ try {
+ Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //starte neu
+ System.exit(0); //beendet sich selbst
+ } catch (IOException e) {
+ System.out.println("es ist ein Fehler aufgetreten");
+ e.printStackTrace();
+ }
+ }
+ }
+ });
+ mainColor.setOnAction(new EventHandler(){
+ @Override
+ public void handle(ActionEvent event){
+ editColor(mainColor.getValue().toString());
+ applyColor();
+ }
+ });
+ sl1.valueProperty().addListener(new ChangeListener() {
+ @Override
+ public void changed(ObservableValue extends Number> ov,Number old_val, Number new_val) {
+ setSize(sl1.getValue());
+ ta1.setFont(Font.font("System", size));
+ saveSettings();
+ }
+ });
+
+ //updater
+ updateBtn.setOnAction(new EventHandler() {
+ @Override
+ public void handle(ActionEvent event){
+ update();
+ }
+ });
+ autoupdateBtn.setOnAction(new EventHandler(){
+ @Override
+ public void handle(ActionEvent event) {
+ if(autoUpdate.equals("0")){
+ setAutoUpdate("1");
+ saveSettings();
+ }else{
+ setAutoUpdate("0");
+ saveSettings();
+ }
+ }
+ });
+
+ settingstrue = true;
+ }else{
+ anpane.getChildren().removeAll(settingsBox);
+ setPath(tfPfad.getText());
+ saveSettings();
+ settingstrue = false;
+ }
+ }
+ });
+
+ //demoBtn clicked
+ demoBtn.setOnAction(new EventHandler(){
+ @Override
+ public void handle(ActionEvent event) {
+ /**
+ * TODO DBController
+ */
+// loadData();
+ }
+ });
+
+ menutrue = true;
+ }else{
+ anpane.getChildren().removeAll(menuBox);
+ menutrue = false;
+ }
+ if(settingstrue == true){
+ anpane.getChildren().removeAll(settingsBox);
+ setPath(tfPfad.getText());
+ saveSettings();
+ settingstrue = false;
+ }
+ }
+
+ @FXML
+ private void playbtnclicked(){
+ try {
+ Desktop.getDesktop().open(new File(getPath()+"\\"+ datPath)); //öffnt die aktuell ausgewählte Datei
+ } catch (IOException e) {
+ // Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @FXML
+ private void openfolderbtnclicked(){
+ try {
+ Desktop.getDesktop().open(new File(getPath())); //öffnet den aktuellen Pfad
+ } catch (IOException e) {
+ // Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @FXML
+ private void returnBtnclicked(){
+ treeTableViewfilm.getSelectionModel().select(last);
+ }
+
+ @FXML
+ private void forwardBtnclicked(){
+ treeTableViewfilm.getSelectionModel().select(next);
+ }
+
+ //"Main" Methode die beim start von der Klasse Main aufgerufen wird, initialiesirung der einzellnen UI-Objekte
+ @SuppressWarnings({ "static-access"})
+ public void setMain(Main main) {
+
+ loadSettings();
+ initTabel();
+
+ infoBtn.setPrefWidth(130);
+ infoBtn.setPrefHeight(32);
+ infoBtn.setFont(Font.font("System", FontWeight.BOLD, 15));
+
+ settingsBtn.setPrefWidth(130);
+ settingsBtn.setPrefHeight(32);
+ settingsBtn.setFont(Font.font("System", FontWeight.BOLD, 15));
+
+ demoBtn.setPrefWidth(130);
+ demoBtn.setPrefHeight(32);
+ demoBtn.setFont(Font.font("System", FontWeight.BOLD, 15));
+ demoBtn.setDisable(false);
+
+ menubtn.setText("");
+ menubtn.setMaxSize(32, 32);
+
+ tfPfad.setPrefWidth(250);
+ tfPfad.setPromptText("Pfad");
+ tfPfad.setText(getPath());
+
+ sl1.setMaxWidth(250);
+ sl1.setMin(2);
+ sl1.setMax(48);
+ sl1.setValue(getSize());
+
+ cbLocal.setItems(locals);
+
+ updateBtn.setFont(Font.font("System", 12));
+
+ directoryBtn.setFont(Font.font("System", 12));
+ directoryBtn.setMaxSize(180, 25);
+
+ if(autoUpdate.equals("1")){
+ autoupdateBtn.setSelected(true);
+ update();
+ }else{
+ autoupdateBtn.setSelected(false);
+ }
+
+ versionlbl.setText("Version: "+version);
+
+ menuBox.setSpacing(2.5); //Zeilenabstand
+ menuBox.setPadding(new Insets(2.5,0,0,2.5)); // abstand zum Rand
+ menuBox.getChildren().addAll(infoBtn, settingsBtn,demoBtn);
+ menuBox.setFillWidth(true);
+
+ AnchorPane.setTopAnchor(menuBox, 33d);
+ AnchorPane.setBottomAnchor(menuBox, 0d);
+
+ settingsBox.setStyle("-fx-background-color: #FFFFFF;");
+ settingsBox.getChildren().add(settingsan);
+
+ settingsan.getChildren().addAll(tfPfad, directoryBtn, mainColor, sizelbl, sl1, cbLocal, updateBtn, aulbl, autoupdateBtn, versionlbl);
+
+ settingsan.setTopAnchor(tfPfad, 5d);
+ settingsan.setLeftAnchor(tfPfad, 5d);
+
+ settingsan.setTopAnchor(directoryBtn, 5d);
+ settingsan.setLeftAnchor(directoryBtn, 260d);
+
+ settingsan.setTopAnchor(mainColor, 40d);
+ settingsan.setLeftAnchor(mainColor, 5d);
+
+ settingsan.setTopAnchor(sizelbl, 75d);
+ settingsan.setLeftAnchor(sizelbl, 5d);
+
+ settingsan.setTopAnchor(sl1, 110d);
+ settingsan.setLeftAnchor(sl1, 5d);
+
+ settingsan.setTopAnchor(cbLocal, 145d);
+ settingsan.setLeftAnchor(cbLocal, 5d);
+
+ settingsan.setTopAnchor(updateBtn, 180d);
+ settingsan.setLeftAnchor(updateBtn, 5d);
+
+ settingsan.setTopAnchor(aulbl, 215d);
+ settingsan.setLeftAnchor(aulbl, 5d);
+
+ settingsan.setTopAnchor(autoupdateBtn, 230d);
+ settingsan.setLeftAnchor(autoupdateBtn, 5d);
+
+ settingsan.setTopAnchor(versionlbl, 280d);
+ settingsan.setLeftAnchor(versionlbl, 5d);
+
+ AnchorPane.setTopAnchor(settingsBox, 34d);
+ AnchorPane.setRightAnchor(settingsBox, 0d);
+ AnchorPane.setBottomAnchor(settingsBox, 0d);
+ AnchorPane.setLeftAnchor(settingsBox, 130d);
+
+ ta1.setWrapText(true);
+ ta1.setEditable(false);
+ ta1.setFont(Font.font("System", getSize()));
+
+ image1.setImage(imHF);
+
+ tfsearch.textProperty().addListener(new ChangeListener() {
+ @SuppressWarnings("unchecked")
+ @Override
+ public void changed(ObservableValue extends String> observable,String oldValue, String newValue) {
+ int counter = newDaten.size();
+ filterData.removeAll(filterData);
+ root.getChildren().remove(0,root.getChildren().size());
+
+ for(int i = 0; i < counter; i++){
+ if(newDaten.get(i).getFilmName().toLowerCase().contains(tfsearch.getText().toLowerCase())){
+ filterData.add(newDaten.get(i));
+ }
+ }
+
+ for(int i = 0; i < filterData.size(); i++){
+ root.getChildren().addAll(new TreeItem(filterData.get(i))); //fügt daten zur Rootnode hinzu
+ }
+ }
+ });
+
+ cbLocal.getSelectionModel().selectedIndexProperty()
+ .addListener(new ChangeListener() {
+ public void changed(ObservableValue extends Number> ov, Number value, Number new_value) {
+ setLocal(new_value.intValue());
+ setLoaclUI(local);
+ saveSettings();
+ }
+ });
+ }
+
+ //initialisierung der TreeTabelView
+ @SuppressWarnings("unchecked")
+ private void initTabel(){
+
+ root.setExpanded(true);
+
+ columnRating.setMaxWidth(120);
+ columnName.setMaxWidth(240);
+ columnDatName.setMaxWidth(0);
+
+ treeTableViewfilm.setRoot(root);
+ treeTableViewfilm.setColumnResizePolicy( TreeTableView.CONSTRAINED_RESIZE_POLICY );
+ treeTableViewfilm.setShowRoot(false);
+
+ //inhalt in Zelle schreiben
+ columnName.setCellValueFactory((CellDataFeatures p) ->
+ new ReadOnlyStringWrapper(p.getValue().getValue().getFilmName()));
+
+ columnRating.setCellValueFactory((CellDataFeatures p) ->
+ new ReadOnlyObjectWrapper(p.getValue().getValue().getFilmBewertung()));
+
+ columnDatName.setCellValueFactory((CellDataFeatures p) ->
+ new ReadOnlyStringWrapper(p.getValue().getValue().getDataName()));
+
+ treeTableViewfilm.getColumns().addAll(columnName, columnRating, columnDatName);
+
+ //Changelistener für TreeTable
+ treeTableViewfilm.getSelectionModel().selectedItemProperty().addListener(new ChangeListener