Browse Source

implemented settings as nested conroller

pull/12/head
Jannik 2 years ago
parent
commit
9af3ad26bd
Signed by: Seil0 GPG Key ID: E8459F3723C52C24
13 changed files with 404 additions and 526 deletions
  1. +22
    -0
      src/main/java/kellerkinder/HomeFlix/application/FilmDetailView.java
  2. +20
    -98
      src/main/java/kellerkinder/HomeFlix/application/Main.java
  3. +86
    -273
      src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
  4. +22
    -0
      src/main/java/kellerkinder/HomeFlix/application/SeriesDetailView.java
  5. +227
    -11
      src/main/java/kellerkinder/HomeFlix/application/SettingsView.java
  6. +2
    -2
      src/main/java/kellerkinder/HomeFlix/controller/DBController.java
  7. +0
    -3
      src/main/java/kellerkinder/HomeFlix/controller/SourcesController.java
  8. +12
    -15
      src/main/java/kellerkinder/HomeFlix/controller/UpdateController.java
  9. +8
    -1
      src/main/java/org/kellerkinder/Alerts/JFX2BtnCancelAlert.java
  10. +1
    -121
      src/main/resources/fxml/MainWindow.fxml
  11. +2
    -2
      src/main/resources/fxml/SettingsView.fxml
  12. +1
    -0
      src/main/resources/locals/HomeFlix-Local_de_DE.properties
  13. +1
    -0
      src/main/resources/locals/HomeFlix-Local_en_US.properties

+ 22
- 0
src/main/java/kellerkinder/HomeFlix/application/FilmDetailView.java View File

@ -1,3 +1,25 @@
/**
* Project-HomeFlix
*
* Copyright 2016-2019 <@Seil0>
*
* 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 kellerkinder.HomeFlix.application;
import java.awt.Desktop;


+ 20
- 98
src/main/java/kellerkinder/HomeFlix/application/Main.java View File

@ -19,55 +19,38 @@
* MA 02110-1301, USA.
*
*/
package kellerkinder.HomeFlix.application;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.ResourceBundle;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.kellerkinder.Alerts.JFX2BtnCancelAlert;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import kellerkinder.HomeFlix.controller.XMLController;
public class Main extends Application {
private Stage primaryStage;
private Scene scene;
private AnchorPane pane;
private MainWindowController mainWindowController;
private static XMLController xmlController;
private ResourceBundle bundle;
private static Logger LOGGER;
public static final String version = "0.7.90";
public static final String buildNumber = "171";
public static final String versionName = "toothless dragon";
@Override
public void start(Stage primaryStage) throws IOException {
LOGGER.info("OS: " + XMLController.getOsName() + " " + XMLController.getOsVers() + " " + XMLController.getOsVers());
LOGGER.info("Java: " + XMLController.getJavaVend() + " " + XMLController.getJavaVers());
LOGGER.info("User: " + XMLController.getUserName() + " " + XMLController.getUserHome());
this.primaryStage = primaryStage;
mainWindow();
}
/**
* initialize the mainWindowController, GUI and load the saved settings or call addFirstSource
* initialize the primaryStage and set the file/directory paths
*/
private void mainWindow(){
//initialize the mainWindowController and the primaryStage
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/fxml/MainWindow.fxml"));
@ -87,22 +70,8 @@ public class Main extends Application {
mainWindowController = loader.getController(); //Link of FXMLController and controller class
mainWindowController.init();
// startup checks
if (!XMLController.getConfigFile().exists()) {
XMLController.getDirHomeFlix().mkdir();
System.out.println("config not found");
addFirstSource();
xmlController.saveSettings();
}
if (!XMLController.getPosterCache().exists()) {
XMLController.getPosterCache().mkdir();
}
} catch (IOException e) {
LOGGER.error(e);
LOGGER.error("Error while loading in Main", e);
}
}
@ -125,70 +94,23 @@ public class Main extends Application {
logFile.delete();
LOGGER = LogManager.getLogger(Main.class.getName());
LOGGER.info("OS: " + XMLController.getOsName() + " " + XMLController.getOsVers() + " " + XMLController.getOsVers());
LOGGER.info("Java: " + XMLController.getJavaVend() + " " + XMLController.getJavaVers());
LOGGER.info("User: " + XMLController.getUserName() + " " + XMLController.getUserHome());
xmlController = new XMLController();
launch(args);
}
/** TODO this should move
* we need to get the path for the first source from the user and add it to
* sources.json, if the user ends the file-/directory-chooser the program will exit
*/
private void addFirstSource() {
switch (XMLController.getSysLocal()) {
case "en_US":
bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // us_english
break;
case "de_DE":
bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.GERMAN); // de_german
break;
default:
bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // default local
break;
}
JFX2BtnCancelAlert selectFirstSource = new JFX2BtnCancelAlert(bundle.getString("addSourceHeader"),
bundle.getString("addSourceBody"),
"-fx-button-type: RAISED; -fx-background-color: #ee3523; -fx-text-fill: BLACK;",
bundle.getString("addDirectory"), bundle.getString("addStreamSource"),
bundle.getString("cancelBtnText"), primaryStage);
// directory action
EventHandler<ActionEvent> btn1Action = new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle(bundle.getString("addDirectory"));
File selectedFolder = directoryChooser.showDialog(primaryStage);
if (selectedFolder != null && selectedFolder.exists()) {
mainWindowController.addSource(selectedFolder.getPath(), "local");
selectFirstSource.getAlert().close();
} else {
LOGGER.error("The selected folder dosen't exist!");
System.exit(1);
}
}
};
if (XMLController.getConfigFile().exists()) {
xmlController.loadSettings();
} else {
xmlController.saveSettings();
}
// streaming action
EventHandler<ActionEvent> btn2Action = new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("addStreamSource");
File selectedFile = fileChooser.showOpenDialog(primaryStage);
if (selectedFile != null && selectedFile.exists()) {
mainWindowController.addSource(selectedFile.getPath(), "stream");
selectFirstSource.getAlert().close();
} else {
LOGGER.error("The selected file dosen't exist!");
System.exit(1);
}
}
};
if (!XMLController.getPosterCache().exists()) {
XMLController.getPosterCache().mkdir();
}
selectFirstSource.setBtn1Action(btn1Action);
selectFirstSource.setBtn2Action(btn2Action);
selectFirstSource.showAndWait();
launch(args);
}
}

+ 86
- 273
src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java View File

@ -41,28 +41,21 @@ import java.util.concurrent.TimeUnit;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.kellerkinder.Alerts.JFX2BtnCancelAlert;
import org.kellerkinder.Alerts.JFXInfoAlert;
import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonObject;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXColorPicker;
import com.jfoenix.controls.JFXHamburger;
import com.jfoenix.controls.JFXSlider;
import com.jfoenix.controls.JFXToggleButton;
import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition;
import javafx.animation.TranslateTransition;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TreeItem;
import javafx.scene.effect.BoxBlur;
import javafx.scene.control.ScrollPane.ScrollBarPolicy;
import javafx.scene.input.MouseEvent;
@ -70,8 +63,6 @@ import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
@ -82,7 +73,6 @@ import kellerkinder.HomeFlix.controller.UpdateController;
import kellerkinder.HomeFlix.controller.XMLController;
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
import kellerkinder.HomeFlix.datatypes.PosterModeElement;
import kellerkinder.HomeFlix.datatypes.SourceDataType;
import kellerkinder.HomeFlix.player.Player;
public class MainWindowController {
@ -99,34 +89,7 @@ public class MainWindowController {
@FXML private JFXButton settingsBtn;
// settings
@FXML private ScrollPane settingsScrollPane;
@FXML private JFXButton updateBtn;
@FXML private JFXButton addDirectoryBtn;
@FXML private JFXButton addStreamSourceBtn;
@FXML private JFXToggleButton autoUpdateToggleBtn;
@FXML private JFXToggleButton autoplayToggleBtn;
@FXML private JFXColorPicker colorPicker;
@FXML private ChoiceBox<String> languageChoisBox = new ChoiceBox<>();
@FXML private ChoiceBox<String> branchChoisBox = new ChoiceBox<>();
@FXML private JFXSlider fontsizeSlider;
@FXML private Label homeflixSettingsLbl;
@FXML private Label mainColorLbl;
@FXML private Label fontsizeLbl;
@FXML private Label languageLbl;
@FXML private Label updateLbl;
@FXML private Label branchLbl;
@FXML private Label sourcesLbl;
@FXML private Label versionLbl;
@FXML private TableView<SourceDataType> sourcesTable;
@FXML private TreeItem<SourceDataType> sourceRoot = new TreeItem<>(new SourceDataType("", ""));
@FXML private TableColumn<SourceDataType, String> sourceColumn;
@FXML private TableColumn<SourceDataType, String> modeColumn;
@FXML private SettingsView settingsViewController;
// poster-mode
@FXML private ScrollPane posterModeScrollPane;
@ -144,18 +107,11 @@ public class MainWindowController {
private boolean menuTrue = false;
private final String version = "0.7.90";
private final String buildNumber = "171";
private final String versionName = "toothless dragon";
private String btnStyle;
private FilmTabelDataType currentTableFilm = new FilmTabelDataType("", "", "", "", false, null);
private ObservableList<String> languages = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)");
private ObservableList<String> branches = FXCollections.observableArrayList("stable", "beta");
private ObservableList<FilmTabelDataType> filmsList = FXCollections.observableArrayList();
private ObservableList<PosterModeElement> posterEmenents = FXCollections.observableArrayList();
private static ObservableList<SourceDataType> sourcesList = FXCollections.observableArrayList();
private LocalDate lastValidCache = LocalDate.now().minusDays(30); // current date - 30 days is the last valid cache date
public MainWindowController() {
@ -171,66 +127,36 @@ public class MainWindowController {
return instance;
}
@FXML
public void initialize() {
instance = this;
xmlController = new XMLController();
dbController = DBController.getInstance();
if (!new File(XMLController.getDirHomeFlix() + "/sources.json").exists()) {
XMLController.getDirHomeFlix().mkdir();
LOGGER.warn("sources file not found");
addFirstSource();
xmlController.saveSettings();
}
}
public void init() {
LOGGER.info("Initializing Project-HomeFlix build " + buildNumber);
xmlController.loadSettings(); // load settings
checkAutoUpdate();
LOGGER.info("Initializing Project-HomeFlix build " + Main.buildNumber);
// initialize the GUI and the DBController
primaryStage = (Stage) mainAnchorPane.getScene().getWindow(); // set primary stage for dialogs
initTabel();
initUI();
posterModeScrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
setLocalUI();
applyColor(); // TODO only on first start
initActions();
dbController.init();
// load data list in gui
addSourceToTable();
posterModeStartup();
}
// Initialize general UI elements
private void initUI() {
//JFXScrollPane.smoothScrolling(posterModeScrollPane);
posterModeScrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
settingsScrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
versionLbl.setText("Version: " + version + " (Build: " + buildNumber + ")");
fontsizeSlider.setValue(XMLController.getFontSize());
colorPicker.setValue(Color.valueOf(XMLController.getColor()));
updateBtn.setFont(Font.font("System", 12));
autoUpdateToggleBtn.setSelected(XMLController.isAutoUpdate());
autoplayToggleBtn.setSelected(XMLController.isAutoplay());
languageChoisBox.setItems(languages);
branchChoisBox.setItems(branches);
if (XMLController.isUseBeta()) {
branchChoisBox.getSelectionModel().select(1);
} else {
branchChoisBox.getSelectionModel().select(0);
}
setLocalUI();
applyColor();
}
/**
* Initialize the tables (treeTableViewfilm and sourcesTable) only needed for
* Tabel-Mode
*/
private void initTabel() {
// sourcesTreeTable
sourceColumn.setCellValueFactory(cellData -> cellData.getValue().pathProperty());
modeColumn.setCellValueFactory(cellData -> cellData.getValue().modeProperty());
sourcesTable.setItems(sourcesList);
checkAutoUpdate(); // TODO async
}
// Initializing the actions
@ -250,37 +176,12 @@ public class MainWindowController {
burgerTask.play();
menuTrue = true;
}
if (settingsScrollPane.isVisible()) {
settingsScrollPane.setVisible(false);
}
});
languageChoisBox.getSelectionModel().selectedIndexProperty().addListener((e, oldValue, newValue) -> {
String local = languageChoisBox.getItems().get((int) newValue).toString();
local = local.substring(local.length() - 6, local.length() - 1); // reading only en_US from English (en_US)
XMLController.setUsrLocal(local);
setLocalUI();
xmlController.saveSettings();
});
branchChoisBox.getSelectionModel().selectedIndexProperty().addListener((e, oldValue, newValue) -> {
if (branchChoisBox.getItems().get((int) newValue).toString() == "beta") {
XMLController.setUseBeta(true);
} else {
XMLController.setUseBeta(false);
}
xmlController.saveSettings();
});
fontsizeSlider.valueProperty().addListener(e -> {
XMLController.setFontSize(fontsizeSlider.getValue());
// TODO add functionality for postermode
xmlController.saveSettings();
});
// Poster-Mode actions
if (settingsViewController.isVisible()) {
settingsViewController.setVisible(false);
}
});primaryStage.setMinHeight(600.00 + 34); // 34 -> window decoration
primaryStage.setMinWidth(1130.00);
}
// Table-Mode fxml actions
@ -293,7 +194,7 @@ public class MainWindowController {
}
if (isSupportedFormat(currentTableFilm)) {
new Player(getCurrentStreamUrl());
new Player(currentTableFilm.getStreamUrl());
} else {
LOGGER.error("using fallback player!");
if (System.getProperty("os.name").contains("Linux")) {
@ -317,7 +218,7 @@ public class MainWindowController {
vlcInfoAlert.showAndWait();
} else {
try {
new ProcessBuilder("vlc", getCurrentStreamUrl()).start();
new ProcessBuilder("vlc", currentTableFilm.getStreamUrl()).start();
} catch (IOException e) {
LOGGER.warn("An error has occurred while opening the file!", e);
}
@ -325,7 +226,7 @@ public class MainWindowController {
} else if (System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac OS X")) {
try {
Desktop.getDesktop().open(new File(getCurrentStreamUrl()));
Desktop.getDesktop().open(new File(currentTableFilm.getStreamUrl()));
} catch (IOException e) {
LOGGER.warn("An error has occurred while opening the file!", e);
}
@ -335,119 +236,78 @@ public class MainWindowController {
}
}
}
@FXML
private void openfolderbtnclicked() {
File dest = new File(getCurrentStreamUrl()).getParentFile();
if (!System.getProperty("os.name").contains("Linux")) {
try {
Desktop.getDesktop().open(dest);
} catch (IOException e) {
e.printStackTrace();
}
}
}
// general fxml actions
@FXML
private void aboutBtnAction() {
String bodyText = "Project HomeFlix \nVersion: " + version + " (Build: " + buildNumber + ") \"" + versionName
+ "\" \n" + XMLController.getLocalBundle().getString("infoText");
String bodyText = "Project HomeFlix \nVersion: " + Main.version + " (Build: " + Main.buildNumber + ") \""
+ Main.versionName + "\" \n" + XMLController.getLocalBundle().getString("infoText");
JFXInfoAlert infoAlert = new JFXInfoAlert("Project HomeFlix", bodyText, btnStyle, primaryStage);
infoAlert.showAndWait();
}
@FXML
private void settingsBtnclicked() {
settingsScrollPane.setVisible(!settingsScrollPane.isVisible());
}
@FXML
private void addDirectoryBtnAction() {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle(XMLController.getLocalBundle().getString("addDirectory"));
File selectedFolder = directoryChooser.showDialog(primaryStage);
if (selectedFolder != null && selectedFolder.exists()) {
addSource(selectedFolder.getPath(), "local");
} else {
LOGGER.error("The selected folder dosen't exist!");
}
}
@FXML
private void addStreamSourceBtnAction() {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(XMLController.getLocalBundle().getString("addStreamSource"));
File selectedFile = fileChooser.showOpenDialog(primaryStage);
if (selectedFile != null && selectedFile.exists()) {
addSource(selectedFile.getPath(), "stream");
} else {
LOGGER.error("The selected file dosen't exist!");
}
}
@FXML
private void colorPickerAction() {
XMLController.setColor(colorPicker.getValue().toString().substring(2, 10));
xmlController.saveSettings();
applyColor();
settingsViewController.setVisible(!settingsViewController.isVisible());
}
@FXML
private void updateBtnAction() {
updateController = new UpdateController(this, buildNumber, XMLController.isUseBeta());
Thread updateThread = new Thread(updateController);
updateThread.setName("Updater");
updateThread.start();
}
@FXML
private void autoUpdateToggleBtnAction() {
XMLController.setAutoUpdate(!XMLController.isAutoUpdate());
xmlController.saveSettings();
}
@FXML
private void autoplayToggleBtnAction() {
XMLController.setAutoplay(!XMLController.isAutoplay());
xmlController.saveSettings();
}
/**
* refresh all films in filmsList and in filmsTable clear the FilmsList and
* FilmRoot children, then update the database
* we need to get the path for the first source from the user and add it to
* sources.json, if the user ends the file-/directory-chooser the program will exit
*/
private void refreshAllFilms() {
filmsList.clear();
dbController.refreshDataBase(); // refreshes the database after a source path was added
filmsList = dbController.getStreamsList(); // returns a list of all films stored in the database
}
private void addFirstSource() {
JFX2BtnCancelAlert selectFirstSource = new JFX2BtnCancelAlert(
XMLController.getLocalBundle().getString("addSourceHeader"),
XMLController.getLocalBundle().getString("addSourceBody"),
"-fx-button-type: RAISED; -fx-background-color: #ee3523; -fx-text-fill: BLACK;",
XMLController.getLocalBundle().getString("addDirectory"),
XMLController.getLocalBundle().getString("addStreamSource"),
XMLController.getLocalBundle().getString("cancelBtnText"), primaryStage);
// directory action
selectFirstSource.setBtn1Action(e -> {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle(XMLController.getLocalBundle().getString("addDirectory"));
File selectedFolder = directoryChooser.showDialog(primaryStage);
if (selectedFolder != null && selectedFolder.exists()) {
selectFirstSource.getAlert().close();
writeSource(selectedFolder.getPath(), "local");
} else {
LOGGER.error("The selected folder dosen't exist!");
System.exit(1);
}
});
// add a all elements of sourcesList to the sources table on the settings pane
public void addSourceToTable() {
for (SourceDataType source : sourcesList) {
sourceRoot.getChildren().add(new TreeItem<SourceDataType>(source)); // add data to root-node
}
// streaming action
selectFirstSource.setBtn2Action(e -> {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(XMLController.getLocalBundle().getString("addStreamSource"));
File selectedFile = fileChooser.showOpenDialog(primaryStage);
if (selectedFile != null && selectedFile.exists()) {
selectFirstSource.getAlert().close();
writeSource(selectedFile.getPath(), "stream");
} else {
LOGGER.error("The selected file dosen't exist!");
System.exit(1);
}
});
selectFirstSource.showAndWait();
}
/**
* add a source to the newsources list
* add a source to the sources file
*
* @param path to the source
* @param mode of the source (local or streaming)
*/
public void addSource(String path, String mode) {
void writeSource(String path, String mode) {
JsonArray newsources = null;
try {
// read old array
File oldSources = new File(XMLController.getDirHomeFlix() + "/sources.json");
if (oldSources.exists()) {
newsources = Json.parse(new FileReader(XMLController.getDirHomeFlix() + "/sources.json")).asArray();
} else {
newsources = Json.array();
}
newsources = oldSources.exists() ? Json.parse(new FileReader(XMLController.getDirHomeFlix() + "/sources.json")).asArray() : Json.array();
// add new source
JsonObject source = Json.object().add("path", path).add("mode", mode);
@ -456,37 +316,28 @@ public class MainWindowController {
newsources.writeTo(writer);
writer.close();
} catch (IOException e) {
LOGGER.error(e);
LOGGER.error("Error while writing sources file!", e);
}
// clear old sources list/table
getSourcesList().clear();
sourceRoot.getChildren().clear();
refreshAllFilms(); // refresh the FilmsList
checkAllPosters(); // check if there is anything to cache
}
/**
* set the color of the GUI-Elements if usedColor is less than checkColor set
* text fill white, else black
*/
private void applyColor() {
void applyColor() {
String menuBtnStyle;
BigInteger usedColor = new BigInteger(XMLController.getColor(), 16);
BigInteger checkColor = new BigInteger("78909cff", 16);
menuHam.getStyleClass().clear();
if (usedColor.compareTo(checkColor) == -1) {
btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + XMLController.getColor() + "; -fx-text-fill: WHITE;";
menuBtnStyle = "-fx-text-fill: WHITE;";
menuHam.getStyleClass().clear();
menuHam.getStyleClass().add("jfx-hamburgerW");
} else {
btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + XMLController.getColor() + "; -fx-text-fill: BLACK;";
menuBtnStyle = "-fx-text-fill: BLACK;";
menuHam.getStyleClass().clear();
menuHam.getStyleClass().add("jfx-hamburgerB");
}
@ -494,14 +345,11 @@ public class MainWindowController {
sideMenuVBox.setStyle("-fx-background-color: #" + XMLController.getColor() + ";");
topHBox.setStyle("-fx-background-color: #" + XMLController.getColor() + ";");
// normal buttons
addDirectoryBtn.setStyle(btnStyle);
addStreamSourceBtn.setStyle(btnStyle);
updateBtn.setStyle(btnStyle);
// menu buttons
settingsBtn.setStyle(menuBtnStyle);
aboutBtn.setStyle(menuBtnStyle);
settingsViewController.updateColor(btnStyle);
}
// slide in in 400ms
@ -524,37 +372,26 @@ public class MainWindowController {
/**
* set the local based on the languageChoisBox selection
*/
private void setLocalUI() {
void setLocalUI() {
// TODO switch expressions
switch (XMLController.getUsrLocal()) {
case "en_US":
XMLController.setLocalBundle(ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US)); // us_English
languageChoisBox.getSelectionModel().select(0);
break;
case "de_DE":
XMLController.setLocalBundle(ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.GERMAN)); // German
languageChoisBox.getSelectionModel().select(1);
break;
default:
XMLController.setLocalBundle(ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US)); // default local
languageChoisBox.getSelectionModel().select(0);
break;
}
settingsViewController.updateGUILocal();
filmDetailViewController.updateGUILocal();
seriesDetailViewController.updateGUILocal();
aboutBtn.setText(XMLController.getLocalBundle().getString("info"));
settingsBtn.setText(XMLController.getLocalBundle().getString("settings"));
updateBtn.setText(XMLController.getLocalBundle().getString("checkUpdates"));
addDirectoryBtn.setText(XMLController.getLocalBundle().getString("addDirectory"));
addStreamSourceBtn.setText(XMLController.getLocalBundle().getString("addStreamSource"));
homeflixSettingsLbl.setText(XMLController.getLocalBundle().getString("homeflixSettingsLbl"));
mainColorLbl.setText(XMLController.getLocalBundle().getString("mainColorLbl"));
fontsizeLbl.setText(XMLController.getLocalBundle().getString("fontsizeLbl"));
languageLbl.setText(XMLController.getLocalBundle().getString("languageLbl"));
autoUpdateToggleBtn.setText(XMLController.getLocalBundle().getString("autoUpdate"));
autoplayToggleBtn.setText(XMLController.getLocalBundle().getString("autoplay"));
branchLbl.setText(XMLController.getLocalBundle().getString("branchLbl"));
}
// if AutoUpdate, then check for updates
@ -563,7 +400,7 @@ public class MainWindowController {
if (XMLController.isAutoUpdate()) {
try {
LOGGER.info("AutoUpdate: looking for updates on startup ...");
updateController = new UpdateController(this, buildNumber, XMLController.isUseBeta());
updateController = new UpdateController(settingsViewController); // TODO this is will crash
Thread updateThread = new Thread(updateController);
updateThread.setName("Updater");
updateThread.start();
@ -599,7 +436,7 @@ public class MainWindowController {
/**
* check if all posters are cached, if not cache the missing ones
*/
private void checkAllPosters() {
void checkAllPosters() {
// get all not cached entries, none of them should have a cached poster
ExecutorService executor = Executors.newFixedThreadPool(5);
@ -621,14 +458,14 @@ public class MainWindowController {
}
// update all elements from the database
refreshAllFilms();
dbController.refreshDataBase(); // refreshes the database after a source path was added
System.out.println("finished refresh");
}
/**
* add all cached films/series to the PosterMode GUI
*/
private void addAllPosters() {
void addAllPosters() {
// refresh the posterModeElements list
posterEmenents.clear();
posterEmenents = dbController.getPosterElementsList(); // returns a list of all PosterElements stored in the database
@ -637,7 +474,6 @@ public class MainWindowController {
for (PosterModeElement element : posterEmenents) {
element.getButton().addEventHandler(MouseEvent.MOUSE_CLICKED, (event) -> {
enableBlur(); // blur the FlowPane
System.out.println("selected: " + element.getStreamURL());
// if the selected element is a file it's a film, else a series
if (new File(element.getStreamURL()).isFile() || element.getStreamURL().contains("http")) {
@ -656,15 +492,14 @@ public class MainWindowController {
System.out.println("added gui elements");
}
// TODO can this be done in dbController?
// TODO can this be done in dbController? with dbController.refreshDataBase();
/**
* check if the cache is to old, if so update asynchron
*/
private void checkCache() {
ExecutorService executor = Executors.newFixedThreadPool(5);
// TODO if filmlist is not used anymore, it cann be removed
for(FilmTabelDataType entry : filmsList) {
for(FilmTabelDataType entry : dbController.getStreamsList()) {
if (dbController.getCacheDate(entry.getStreamUrl()).isBefore(lastValidCache)) {
System.out.println(entry.getTitle() + " chached on: " + dbController.getCacheDate(entry.getStreamUrl()));
Runnable OMDbAPIWorker = new OMDbAPIController(entry, XMLController.getOmdbAPIKey());
@ -686,26 +521,4 @@ public class MainWindowController {
public void disableBlur() {
posterModeFlowPane.setEffect(null);
}
// getter and setter
public FilmTabelDataType getCurrentTableFilm() {
return currentTableFilm;
}
public String getCurrentTitle() {
return currentTableFilm.getTitle();
}
public String getCurrentStreamUrl() {
return currentTableFilm.getStreamUrl();
}
public static ObservableList<SourceDataType> getSourcesList() {
return sourcesList;
}
public JFXButton getUpdateBtn() {
return updateBtn;
}
}

+ 22
- 0
src/main/java/kellerkinder/HomeFlix/application/SeriesDetailView.java View File

@ -1,3 +1,25 @@
/**
* Project-HomeFlix
*
* Copyright 2016-2019 <@Seil0>
*
* 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 kellerkinder.HomeFlix.application;
import java.awt.Desktop;


+ 227
- 11
src/main/java/kellerkinder/HomeFlix/application/SettingsView.java View File

@ -1,10 +1,47 @@
/**
* Project-HomeFlix
*
* Copyright 2016-2019 <@Seil0>
*
* 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 kellerkinder.HomeFlix.application;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXColorPicker;
import com.jfoenix.controls.JFXSlider;
import com.jfoenix.controls.JFXToggleButton;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.ChoiceBox;
@ -12,7 +49,14 @@ import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.ScrollPane.ScrollBarPolicy;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import kellerkinder.HomeFlix.controller.DBController;
import kellerkinder.HomeFlix.controller.UpdateController;
import kellerkinder.HomeFlix.controller.XMLController;
import kellerkinder.HomeFlix.datatypes.SourceDataType;
public class SettingsView {
@ -47,37 +91,209 @@ public class SettingsView {
@FXML private TableColumn<SourceDataType, String> sourceColumn;
@FXML private TableColumn<SourceDataType, String> modeColumn;
private XMLController xmlController;
private static final Logger LOGGER = LogManager.getLogger(FilmDetailView.class.getName());
private ObservableList<String> languages = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)");
private ObservableList<String> branches = FXCollections.observableArrayList("stable", "beta");
private static ObservableList<SourceDataType> sourcesList = FXCollections.observableArrayList();
public void initialize() {
System.out.println("geht");
xmlController = new XMLController();
// initialize the GUI elements
settingsScrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
versionLbl.setText("Version: " + Main.version + " (Build: " + Main.buildNumber + ")");
fontsizeSlider.setValue(XMLController.getFontSize());
colorPicker.setValue(Color.valueOf(XMLController.getColor()));
autoUpdateToggleBtn.setSelected(XMLController.isAutoUpdate());
autoplayToggleBtn.setSelected(XMLController.isAutoplay());
languageChoisBox.setItems(languages);
branchChoisBox.setItems(branches);
branchChoisBox.getSelectionModel().select(XMLController.isUseBeta() ? 1 : 0);
// TODO switch expressions
switch (XMLController.getUsrLocal()) {
case "en_US":
languageChoisBox.getSelectionModel().select(0);
break;
case "de_DE":
languageChoisBox.getSelectionModel().select(1);
break;
default:
languageChoisBox.getSelectionModel().select(0);
break;
}
// initialize the sources table
sourceColumn.setCellValueFactory(cellData -> cellData.getValue().pathProperty());
modeColumn.setCellValueFactory(cellData -> cellData.getValue().modeProperty());
sourcesTable.setItems(sourcesList);
initActions();
loadInitSources();
}
@FXML void addDirectoryBtnAction(ActionEvent event) {
private void initActions() {
languageChoisBox.getSelectionModel().selectedIndexProperty().addListener((e, oldValue, newValue) -> {
String local = languageChoisBox.getItems().get((int) newValue).toString();
local = local.substring(local.length() - 6, local.length() - 1); // reading only en_US from English (en_US)
XMLController.setUsrLocal(local);
xmlController.saveSettings();
MainWindowController.getInstance().setLocalUI();
});
branchChoisBox.getSelectionModel().selectedIndexProperty().addListener((e, oldValue, newValue) -> {
if (branchChoisBox.getItems().get((int) newValue).toString() == "beta") {
XMLController.setUseBeta(true);
} else {
XMLController.setUseBeta(false);
}
xmlController.saveSettings();
});
fontsizeSlider.valueProperty().addListener(e -> {
XMLController.setFontSize(fontsizeSlider.getValue());
xmlController.saveSettings();
// TODO add functionality for postermode
});
}
@FXML
void addStreamSourceBtnAction(ActionEvent event) {
private void addDirectoryBtnAction(ActionEvent event) {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle(XMLController.getLocalBundle().getString("addDirectory"));
File selectedFolder = directoryChooser.showDialog(settingsScrollPane.getScene().getWindow());
if (selectedFolder != null && selectedFolder.exists()) {
addSource(selectedFolder.getPath(), "local");
} else {
LOGGER.error("The selected folder dosen't exist!");
}
}
@FXML
void autoUpdateToggleBtnAction(ActionEvent event) {
private void addStreamSourceBtnAction(ActionEvent event) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(XMLController.getLocalBundle().getString("addStreamSource"));
File selectedFile = fileChooser.showOpenDialog(settingsScrollPane.getScene().getWindow());
if (selectedFile != null && selectedFile.exists()) {
addSource(selectedFile.getPath(), "stream");
} else {
LOGGER.error("The selected file dosen't exist!");
}
}
@FXML
void autoplayToggleBtnAction(ActionEvent event) {
private void autoUpdateToggleBtnAction(ActionEvent event) {
XMLController.setAutoUpdate(!XMLController.isAutoUpdate());
xmlController.saveSettings();
}
@FXML
void colorPickerAction(ActionEvent event) {
private void autoplayToggleBtnAction(ActionEvent event) {
XMLController.setAutoplay(!XMLController.isAutoplay());
xmlController.saveSettings();
}
@FXML
private void colorPickerAction(ActionEvent event) {
XMLController.setColor(colorPicker.getValue().toString().substring(2, 10));
xmlController.saveSettings();
MainWindowController.getInstance().applyColor();
}
@FXML
void updateBtnAction(ActionEvent event) {
private void updateBtnAction(ActionEvent event) {
Thread updateThread = new Thread(new UpdateController(this));
updateThread.setName("Updater");
updateThread.start();
}
/** TODO can this be done async?
* add a source to the sources file and load all new streams
* @param path to the source
* @param mode of the source (local or streaming)
*/
void addSource(String path, String mode) {
JsonArray newsources = null;
try {settingsScrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
// read old array
File oldSources = new File(XMLController.getDirHomeFlix() + "/sources.json");
newsources = oldSources.exists() ? Json.parse(new FileReader(XMLController.getDirHomeFlix() + "/sources.json")).asArray() : Json.array();
// add new source
JsonObject source = Json.object().add("path", path).add("mode", mode);
newsources.add(source);
Writer writer = new FileWriter(XMLController.getDirHomeFlix() + "/sources.json");
newsources.writeTo(writer);
writer.close();
} catch (IOException e) {
LOGGER.error(e);
}
// update the sourcesTable
sourcesList.add(new SourceDataType(path, mode));
DBController.getInstance().refreshDataBase(); // refreshes the database after a source path was added
MainWindowController.getInstance().checkAllPosters(); // check if there is anything new to cache
MainWindowController.getInstance().addAllPosters();
}
// add a all elements of sourcesList to the sources table on the settings pane
private void loadInitSources() {
try {
// create a JsonArray, containing all sources, add each source to the mwc, get all films from it
JsonArray sources = Json.parse(new FileReader(XMLController.getDirHomeFlix() + "/sources.json")).asArray();
for (JsonValue source : sources) {
String path = source.asObject().getString("path", "");
String mode = source.asObject().getString("mode", "");
sourcesList.add(new SourceDataType(path, mode));
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void updateColor(String btnStyle) {
updateBtn.setStyle(btnStyle);
addDirectoryBtn.setStyle(btnStyle);
addStreamSourceBtn.setStyle(btnStyle);
autoUpdateToggleBtn.setToggleColor(Color.valueOf(XMLController.getColor()));
autoUpdateToggleBtn.setToggleLineColor(Color.valueOf(XMLController.getColor()));
autoplayToggleBtn.setToggleColor(Color.valueOf(XMLController.getColor()));
autoplayToggleBtn.setToggleLineColor(Color.valueOf(XMLController.getColor()));
}
public void updateGUILocal() {
homeflixSettingsLbl.setText(XMLController.getLocalBundle().getString("homeflixSettingsLbl"));
mainColorLbl.setText(XMLController.getLocalBundle().getString("mainColorLbl"));
fontsizeLbl.setText(XMLController.getLocalBundle().getString("fontsizeLbl"));
languageLbl.setText(XMLController.getLocalBundle().getString("languageLbl"));
branchLbl.setText(XMLController.getLocalBundle().getString("branchLbl"));
sourcesLbl.setText(XMLController.getLocalBundle().getString("sourcesLbl"));
updateBtn.setText(XMLController.getLocalBundle().getString("checkUpdates"));
addDirectoryBtn.setText(XMLController.getLocalBundle().getString("addDirectory"));
addStreamSourceBtn.setText(XMLController.getLocalBundle().getString("addStreamSource"));
autoUpdateToggleBtn.setText(XMLController.getLocalBundle().getString("autoUpdate"));
autoplayToggleBtn.setText(XMLController.getLocalBundle().getString("autoplay"));
}
public void setVisible(boolean visible) {
settingsScrollPane.setVisible(visible);
}
public boolean isVisible() {
return settingsScrollPane.isVisible();
}
public JFXButton getUpdateBtn() {
return updateBtn;
}
}

+ 2
- 2
src/main/java/kellerkinder/HomeFlix/controller/DBController.java View File

@ -52,8 +52,8 @@ public class DBController {
private static DBController instance = null;
private String DB_PATH;
private Image favorite_black = new Image("icons/ic_favorite_black_18dp_1x.png");
private Image favorite_border_black = new Image("icons/ic_favorite_border_black_18dp_1x.png");
private Image favorite_black = new Image("icons/baseline_favorite_black_48dp.png"); // TODO this should be removed
private Image favorite_border_black = new Image("icons/baseline_favorite_border_black_48dp.png"); // TODO this too
private List<DatabaseDataType> databaseStreams = new ArrayList<DatabaseDataType>(); // contains all films stored in the database
private List<DatabaseDataType> sourceStreams = new ArrayList<DatabaseDataType>(); // contains all films from the sources
private Connection connection = null;


+ 0
- 3
src/main/java/kellerkinder/HomeFlix/controller/SourcesController.java View File

@ -37,9 +37,7 @@ import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue;
import kellerkinder.HomeFlix.application.MainWindowController;
import kellerkinder.HomeFlix.datatypes.DatabaseDataType;
import kellerkinder.HomeFlix.datatypes.SourceDataType;
public class SourcesController {
@ -61,7 +59,6 @@ public class SourcesController {
for (JsonValue source : sources) {
String path = source.asObject().getString("path", "");
String mode = source.asObject().getString("mode", "");
MainWindowController.getSourcesList().add(new SourceDataType(path, mode)); // TODO
if (mode.equals("local"))
addLocalSource(path);


+ 12
- 15
src/main/java/kellerkinder/HomeFlix/controller/UpdateController.java View File

@ -41,12 +41,12 @@ import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue;
import javafx.application.Platform;
import kellerkinder.HomeFlix.application.MainWindowController;
import kellerkinder.HomeFlix.application.Main;
import kellerkinder.HomeFlix.application.SettingsView;
public class UpdateController implements Runnable {
private MainWindowController mainWindowController;
private int buildNumber;
private SettingsView settingsViewController;
private int updateBuildNumber; // tag_name from gitea
private String apiOutput;
@SuppressWarnings("unused")
@ -57,7 +57,6 @@ public class UpdateController implements Runnable {
private String giteaApiRelease = "https://git.mosad.xyz/api/v1/repos/Seil0/Project-HomeFlix/releases";
private URL giteaApiUrl;
private boolean useBeta;
private static final Logger LOGGER = LogManager.getLogger(UpdateController.class.getName());
/**
@ -66,17 +65,15 @@ public class UpdateController implements Runnable {
* @param buildNumber the buildNumber of the used HomeFlix version
* @param useBeta if the updater should query the beta channel
*/
public UpdateController(MainWindowController mwc, String buildNumber, boolean useBeta) {
mainWindowController = mwc;
this.buildNumber = Integer.parseInt(buildNumber);
this.useBeta = useBeta;
public UpdateController(SettingsView svc) {
settingsViewController = svc;
}
@Override
public void run() {
LOGGER.info("beta:" + useBeta + "; checking for updates ...");
LOGGER.info("beta:" + XMLController.isUseBeta() + "; checking for updates ...");
Platform.runLater(() -> {
mainWindowController.getUpdateBtn().setText(XMLController.getLocalBundle().getString("updateBtnChecking"));
settingsViewController.getUpdateBtn().setText(XMLController.getLocalBundle().getString("updateBtnChecking"));
});
try {
@ -96,7 +93,7 @@ public class UpdateController implements Runnable {
JsonObject objectAsset = object.asObject().get("assets").asArray().get(0).asObject();
for(JsonValue objectIt : objectArray) {
if(objectIt.asObject().getBoolean("prerelease", false) == useBeta) {
if(objectIt.asObject().getBoolean("prerelease", false) == XMLController.isUseBeta()) {
// we found the needed release either beta or not
object = objectIt;
objectAsset = objectIt.asObject().get("assets").asArray().get(0).asObject();
@ -108,20 +105,20 @@ public class UpdateController implements Runnable {
updateName = object.asObject().getString("name", "");
updateChanges = object.asObject().getString("body", "");
LOGGER.info("Build: " + buildNumber + ", Update: " + updateBuildNumber);
LOGGER.info("Build: " + Main.buildNumber + ", Update: " + updateBuildNumber);
/**
* Compare the program BuildNumber with the current BuildNumber
* if buildNumber < updateBuildNumber then perform a update
*/
if (buildNumber >= updateBuildNumber) {
if (Integer.parseInt(Main.buildNumber) >= updateBuildNumber) {
Platform.runLater(() -> {
mainWindowController.getUpdateBtn().setText(XMLController.getLocalBundle().getString("updateBtnNoUpdateAvailable"));
settingsViewController.getUpdateBtn().setText(XMLController.getLocalBundle().getString("updateBtnNoUpdateAvailable"));
});
LOGGER.info("no update available");
} else {
Platform.runLater(() -> {
mainWindowController.getUpdateBtn().setText(XMLController.getLocalBundle().getString("updateBtnUpdateAvailable"));
settingsViewController.getUpdateBtn().setText(XMLController.getLocalBundle().getString("updateBtnUpdateAvailable"));
});
LOGGER.info("update available");
browserDownloadUrl = objectAsset.getString("browser_download_url", "");


+ 8
- 1
src/main/java/org/kellerkinder/Alerts/JFX2BtnCancelAlert.java View File

@ -90,7 +90,7 @@ public class JFX2BtnCancelAlert {
JFXButton cancelBtn = new JFXButton();
cancelBtn.setText(cancelText);
cancelBtn.addEventHandler(ActionEvent.ACTION, (e)-> alert.close());
cancelBtn.addEventHandler(ActionEvent.ACTION, (e)-> System.exit(0));
cancelBtn.addEventHandler(ActionEvent.ACTION, (e)-> System.exit(0)); // TODO only on first start
cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
cancelBtn.setPrefHeight(32);
cancelBtn.setStyle(btnStyle);
@ -99,6 +99,13 @@ public class JFX2BtnCancelAlert {
content.setActions(btnOne, btnTwo, cancelBtn);
content.setHeading(new Text(headingText));
content.setBody(new Text(bodyText));
// TODO only on first start
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.setMinWidth(416);
stage.setMinHeight(162);
stage.setOnCloseRequest(event -> System.exit(0));
alert.setContent(content);
alert.showAndWait();
}


+ 1
- 121
src/main/resources/fxml/MainWindow.fxml View File

@ -1,17 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXColorPicker?>
<?import com.jfoenix.controls.JFXHamburger?>
<?import com.jfoenix.controls.JFXSlider?>
<?import com.jfoenix.controls.JFXToggleButton?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.layout.HBox?>
@ -31,119 +23,7 @@
</ScrollPane>
<fx:include fx:id="filmDetailView" source="FilmDetailView.fxml" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0" />
<fx:include fx:id="seriesDetailView" source="SeriesDetailView.fxml" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0" />
<ScrollPane fx:id="settingsScrollPane" fitToHeight="true" fitToWidth="true" prefHeight="568.0" prefWidth="800.0" style="-fx-background: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0">
<content>
<AnchorPane fx:id="settingsAnchorPane" style="-fx-background-color: white;">
<children>
<VBox spacing="30.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<padding>
<Insets bottom="14.0" top="14.0" />
</padding>
<children>
<VBox spacing="25.0">
<padding>
<Insets left="24.0" />
</padding>
<children>
<VBox>
<children>
<Label fx:id="homeflixSettingsLbl" text="HomeFlix Settings">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<Separator prefWidth="200.0">
<padding>
<Insets right="5.0" />
</padding>
</Separator>
</children>
<padding>
<Insets left="-14.0" />
</padding>
</VBox>
<HBox minHeight="25.0" spacing="10.0">
<children>
<Label fx:id="mainColorLbl" prefHeight="25.0" text="Main-Color" />
<JFXColorPicker fx:id="colorPicker" onAction="#colorPickerAction" />
</children>
</HBox>
<HBox spacing="10.0">
<children>
<Label fx:id="fontsizeLbl" text="Fontsize" />
<JFXSlider fx:id="fontsizeSlider" max="48.0" min="2.0" prefWidth="250.0" />
</children>
</HBox>
<HBox spacing="10.0">
<children>
<Label fx:id="languageLbl" prefHeight="25.0" text="Language" />
<ChoiceBox fx:id="languageChoisBox" prefWidth="150.0" />
</children>
</HBox>
<VBox spacing="10.0">
<children>
<Label fx:id="updateLbl" text="Updates" />
<HBox spacing="10.0">
<children>
<JFXButton fx:id="updateBtn" onAction="#updateBtnAction" text="check now" />
<Label fx:id="branchLbl" prefHeight="25.0" text="Branch">
<padding>
<Insets right="-5.0" />
</padding>
</Label>
<ChoiceBox fx:id="branchChoisBox" prefWidth="150.0" />
</children>
</HBox>
<JFXToggleButton fx:id="autoUpdateToggleBtn" onAction="#autoUpdateToggleBtnAction" text="check for updates on startup">
<padding>
<Insets bottom="-5.0" top="-5.0" />
</padding></JFXToggleButton>
<Label fx:id="versionLbl" text="Version" />
</children>
</VBox>
<VBox spacing="10.0">
<children>
<Label fx:id="PlayerLbl" text="Player" />
<JFXToggleButton fx:id="autoplayToggleBtn" onAction="#autoplayToggleBtnAction" text="autoplay">
<VBox.margin>
<Insets />
</VBox.margin>
<padding>
<Insets bottom="-5.0" top="-5.0" />
</padding>
</JFXToggleButton>
</children>
</VBox>
<VBox spacing="10.0">
<children>
<Label fx:id="sourcesLbl" text="Sources" />
<HBox spacing="10.0">
<children>
<JFXButton fx:id="addStreamSourceBtn" onAction="#addStreamSourceBtnAction" prefHeight="32.0" text="add stream source" />
<JFXButton fx:id="addDirectoryBtn" onAction="#addDirectoryBtnAction" prefHeight="32.0" text="add directory" />
</children>
</HBox>
<TableView fx:id="sourcesTable" maxWidth="-Infinity" minHeight="150.0" minWidth="-Infinity" prefWidth="443.0">
<columns>
<TableColumn fx:id="sourceColumn" prefWidth="290.0" resizable="false" text="Sources" />
<TableColumn fx:id="modeColumn" minWidth="130.0" prefWidth="138.0" resizable="false" text="Mode" />
</columns>
</TableView>
</children>
</VBox>
</children>
</VBox>
<VBox spacing="25.0">
<padding>
<Insets left="24.0" />
</padding>
</VBox>
</children>
</VBox>
</children>
</AnchorPane>
</content>
</ScrollPane>
<fx:include fx:id="settingsView" source="SettingsView.fxml" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0" />
<HBox fx:id="topHBox" layoutY="12.0" prefHeight="32.0" prefWidth="900.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<JFXHamburger fx:id="menuHam">


+ 2
- 2
src/main/resources/fxml/SettingsView.fxml View File

@ -16,9 +16,9 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<ScrollPane fx:id="settingsScrollPane" fitToHeight="true" fitToWidth="true" prefHeight="568.0" prefWidth="980.0" visible="false" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="kellerkinder.HomeFlix.application.SettingsView">
<ScrollPane fx:id="settingsScrollPane" fitToHeight="true" fitToWidth="true" prefHeight="568.0" prefWidth="980.0" style="-fx-background-color: #ffffff;" visible="false" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="kellerkinder.HomeFlix.application.SettingsView">
<content>
<AnchorPane fx:id="settingsAnchorPane" style="-fx-background-color: white;">
<AnchorPane fx:id="settingsAnchorPane" style="-fx-background-color: #ffffff;">
<children>
<VBox AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>


+ 1
- 0
src/main/resources/locals/HomeFlix-Local_de_DE.properties View File

@ -22,6 +22,7 @@ updateBtnNoUpdateAvailable = Kein Update verf\u00FCgbar
autoUpdate = beim Start nach Updates suchen:
autoplay = autoplay
branchLbl = Updatezweig
sourcesLbl = Quellen
#column translations
columnStreamUrl = Datei Name


+ 1
- 0
src/main/resources/locals/HomeFlix-Local_en_US.properties View File

@ -22,6 +22,7 @@ updateBtnNoUpdateAvailable = no update available
autoUpdate = check at startup for updates:
autoplay = autoplay
branchLbl = Branch
sourcesLbl = Quellen
#column translations
columnStreamUrl = File Name


Loading…
Cancel
Save