Skip to content

Commit

Permalink
updated to 0.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Seil0 committed Sep 9, 2016
1 parent d0be4f8 commit 4d57bdb
Show file tree
Hide file tree
Showing 21 changed files with 624 additions and 212 deletions.
Binary file modified bin/application/Main.class
Binary file not shown.
Binary file modified bin/application/MainWindowController$1.class
Binary file not shown.
Binary file modified bin/application/MainWindowController$2.class
Binary file not shown.
Binary file modified bin/application/MainWindowController$3.class
Binary file not shown.
Binary file modified bin/application/MainWindowController$4.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified bin/application/MainWindowController$5.class
Binary file not shown.
Binary file modified bin/application/MainWindowController$6.class
Binary file not shown.
Binary file added bin/application/MainWindowController$7$1.class
Binary file not shown.
Binary file added bin/application/MainWindowController$7.class
Binary file not shown.
Binary file added bin/application/MainWindowController$8.class
Binary file not shown.
Binary file modified bin/application/MainWindowController.class
Binary file not shown.
Binary file added bin/application/streamUiData.class
Binary file not shown.
61 changes: 40 additions & 21 deletions src/application/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ public class Main extends Application {

public Stage primaryStage;
private String path;
private String streamingPath = System.getProperty("user.home") + "\\Documents\\HomeFlix";
private String color = "ee3523";
private String autoUpdate = "0";
private String mode = "local"; //local or streaming
private double size = 12;
private int local = 0;
private File dir = new File(System.getProperty("user.home") + "/Documents/HomeFlix"); //Windows: C:/Users/"User"/Documents/HomeFlix OSX: has to be tested Linux: has to be tested(shalt not work!)
private File file = new File(dir + "/config.xml"); //Windows: C:/Users/"User"/Documents/HomeFlix/config.xml OSX: has to be tested Linux: has to be tested(shalt not work!)
Properties props = new Properties();
private MainWindowController mainWindowController;

Expand All @@ -58,7 +62,7 @@ public void start(Stage primaryStage) {
}

public void mainWindow(){
File file = new File("config.xml");

try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml"));
AnchorPane pane = loader.load();
Expand All @@ -68,29 +72,45 @@ public void mainWindow(){
primaryStage.setTitle("Project HomeFlix");
primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/recources/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
//dir exists -> check config.xml TODO nur Windows getestet siehe dir und file
if(dir.exists() == true){
if (file.exists() != true) {
mainWindowController.setPath(firstStart());
mainWindowController.setStreamingPath(streamingPath);
mainWindowController.setColor(color);
mainWindowController.setSize(size);
mainWindowController.setAutoUpdate(autoUpdate);
mainWindowController.setLoaclUI(local);
mainWindowController.setMode(mode);
mainWindowController.saveSettings();
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //starte neu um Bugs zu verhindern
System.exit(0); //beendet sich selbst
}else{
loadSettings();
}
}else{
loadSettings();
dir.mkdir();
mainWindowController.setPath(firstStart());
mainWindowController.setStreamingPath(streamingPath);
mainWindowController.setColor(color);
mainWindowController.setSize(size);
mainWindowController.setAutoUpdate(autoUpdate);
mainWindowController.setLoaclUI(local);
mainWindowController.setMode(mode);
mainWindowController.saveSettings();
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //starte neu um Bugs zu verhindern
System.exit(0); //beendet sich selbst
}

mainWindowController.loadStreamingSettings();
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
mainWindowController.addDataUI();

Scene scene = new Scene(pane); //neue Scen um inhalt der stage anzuzeigen

Expand Down Expand Up @@ -124,24 +144,23 @@ private String firstStart(){

//lädt die einstellungen aus der XML
public void loadSettings(){
File configFile = new File("config.xml");
try {
InputStream inputStream = new FileInputStream(configFile);
InputStream inputStream = new FileInputStream(file);
props.loadFromXML(inputStream);
path = props.getProperty("path");
path = props.getProperty("path"); //setzt Propselement in Pfad
streamingPath = props.getProperty("streamingPath");
color = props.getProperty("color");
autoUpdate = props.getProperty("autoUpdate");
size = Double.parseDouble(props.getProperty("size"));
autoUpdate = props.getProperty("autoUpdate");
local = Integer.parseInt(props.getProperty("local"));

mode = props.getProperty("mode");
inputStream.close();
} catch (IOException e) {
// Auto-generated catch block
System.out.println("An error has occurred!");
e.printStackTrace();
}
}


public static void main(String[] args) {
launch(args);
}
Expand Down
Loading

0 comments on commit 4d57bdb

Please sign in to comment.