|
|
|
@ -82,6 +82,7 @@ import javafx.scene.text.Font;
|
|
|
|
|
import javafx.scene.text.TextFlow;
|
|
|
|
|
import javafx.stage.DirectoryChooser;
|
|
|
|
|
import javafx.stage.FileChooser;
|
|
|
|
|
import javafx.stage.Stage;
|
|
|
|
|
import javafx.util.Duration;
|
|
|
|
|
import kellerkinder.HomeFlix.controller.DBController;
|
|
|
|
|
import kellerkinder.HomeFlix.controller.OMDbAPIController;
|
|
|
|
@ -155,11 +156,11 @@ public class MainWindowController {
|
|
|
|
|
// poster-mode
|
|
|
|
|
// @FXML private AnchorPane posterModeAnchorPane;
|
|
|
|
|
|
|
|
|
|
private Main main;
|
|
|
|
|
private MainWindowController mainWindowController;
|
|
|
|
|
private UpdateController updateController;
|
|
|
|
|
private DBController dbController;
|
|
|
|
|
private XMLController xmlController;
|
|
|
|
|
private Stage primaryStage;
|
|
|
|
|
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
|
|
|
|
|
|
|
|
|
|
private boolean menuTrue = false;
|
|
|
|
@ -187,17 +188,16 @@ public class MainWindowController {
|
|
|
|
|
private MenuItem dislike = new MenuItem("dislike"); // TODO one option (like or dislike)
|
|
|
|
|
private ContextMenu menu = new ContextMenu(like, dislike);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initialize other objects: Updater, dbController and ApiQuery
|
|
|
|
|
* @param main the main object
|
|
|
|
|
*/
|
|
|
|
|
public MainWindowController(Main main) {
|
|
|
|
|
this.main = main;
|
|
|
|
|
mainWindowController = this;
|
|
|
|
|
xmlController = new XMLController(); // TODO pass it over from main?
|
|
|
|
|
dbController = new DBController(this);
|
|
|
|
|
public MainWindowController() {
|
|
|
|
|
// the constructor
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
public void initialize() {
|
|
|
|
|
mainWindowController = this;
|
|
|
|
|
xmlController = new XMLController();
|
|
|
|
|
dbController = new DBController(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void init() {
|
|
|
|
|
LOGGER.info("Initializing Project-HomeFlix build " + buildNumber);
|
|
|
|
@ -206,6 +206,7 @@ public class MainWindowController {
|
|
|
|
|
checkAutoUpdate();
|
|
|
|
|
|
|
|
|
|
// initialize the GUI and the DBController
|
|
|
|
|
primaryStage = (Stage) mainAnchorPane.getScene().getWindow(); // set primary stage for dialogs
|
|
|
|
|
initTabel();
|
|
|
|
|
initUI();
|
|
|
|
|
initActions();
|
|
|
|
@ -244,10 +245,21 @@ public class MainWindowController {
|
|
|
|
|
|
|
|
|
|
// film Table
|
|
|
|
|
columnStreamUrl.setMaxWidth(0);
|
|
|
|
|
columnTitle.setMaxWidth(190);
|
|
|
|
|
columnTitle.setMaxWidth(182);
|
|
|
|
|
columnFavorite.setMaxWidth(80);
|
|
|
|
|
columnSeason.setMaxWidth(73);
|
|
|
|
|
columnEpisode.setMaxWidth(77);
|
|
|
|
|
columnSeason.setMaxWidth(70);
|
|
|
|
|
columnEpisode.setMaxWidth(70);
|
|
|
|
|
|
|
|
|
|
columnTitle.setMinWidth(182);
|
|
|
|
|
columnFavorite.setMinWidth(80);
|
|
|
|
|
columnSeason.setMinWidth(70);
|
|
|
|
|
columnEpisode.setMinWidth(70);
|
|
|
|
|
|
|
|
|
|
columnTitle.setResizable(false);
|
|
|
|
|
columnFavorite.setResizable(false);
|
|
|
|
|
columnSeason.setResizable(false);
|
|
|
|
|
columnEpisode.setResizable(false);
|
|
|
|
|
|
|
|
|
|
columnFavorite.setStyle("-fx-alignment: CENTER;");
|
|
|
|
|
|
|
|
|
|
filmsTreeTable.setRoot(filmRoot);
|
|
|
|
@ -298,7 +310,6 @@ public class MainWindowController {
|
|
|
|
|
}
|
|
|
|
|
if (settingsTrue) {
|
|
|
|
|
settingsScrollPane.setVisible(false);
|
|
|
|
|
xmlController.saveSettings();
|
|
|
|
|
settingsTrue = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -476,7 +487,7 @@ public class MainWindowController {
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
if (output.contains("which: no vlc") || output == "") {
|
|
|
|
|
JFXInfoAlert vlcInfoAlert = new JFXInfoAlert("Info", getBundle().getString("vlcNotInstalled"), btnStyle, main.getPrimaryStage());
|
|
|
|
|
JFXInfoAlert vlcInfoAlert = new JFXInfoAlert("Info", getBundle().getString("vlcNotInstalled"), btnStyle, primaryStage);
|
|
|
|
|
vlcInfoAlert.showAndWait();
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
@ -525,7 +536,7 @@ public class MainWindowController {
|
|
|
|
|
private void aboutBtnAction() {
|
|
|
|
|
String bodyText = "Project HomeFlix \nVersion: " + version + " (Build: " + buildNumber + ") \""
|
|
|
|
|
+ versionName + "\" \n" + getBundle().getString("infoText");
|
|
|
|
|
JFXInfoAlert infoAlert = new JFXInfoAlert("Project HomeFlix", bodyText, btnStyle, main.getPrimaryStage());
|
|
|
|
|
JFXInfoAlert infoAlert = new JFXInfoAlert("Project HomeFlix", bodyText, btnStyle, primaryStage);
|
|
|
|
|
infoAlert.showAndWait();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -533,7 +544,6 @@ public class MainWindowController {
|
|
|
|
|
private void settingsBtnclicked() {
|
|
|
|
|
if (settingsTrue) {
|
|
|
|
|
settingsScrollPane.setVisible(false);
|
|
|
|
|
xmlController.saveSettings();
|
|
|
|
|
settingsTrue = false;
|
|
|
|
|
} else {
|
|
|
|
|
settingsScrollPane.setVisible(true);
|
|
|
|
@ -545,7 +555,7 @@ public class MainWindowController {
|
|
|
|
|
private void addDirectoryBtnAction(){
|
|
|
|
|
DirectoryChooser directoryChooser = new DirectoryChooser();
|
|
|
|
|
directoryChooser.setTitle(bundle.getString("addDirectory"));
|
|
|
|
|
File selectedFolder = directoryChooser.showDialog(main.getPrimaryStage());
|
|
|
|
|
File selectedFolder = directoryChooser.showDialog(primaryStage);
|
|
|
|
|
if (selectedFolder != null && selectedFolder.exists()) {
|
|
|
|
|
addSource(selectedFolder.getPath(), "local");
|
|
|
|
|
} else {
|
|
|
|
@ -556,8 +566,8 @@ public class MainWindowController {
|
|
|
|
|
@FXML
|
|
|
|
|
private void addStreamSourceBtnAction(){
|
|
|
|
|
FileChooser fileChooser = new FileChooser();
|
|
|
|
|
fileChooser.setTitle("addStreamSource");
|
|
|
|
|
File selectedFile = fileChooser.showOpenDialog(main.getPrimaryStage());
|
|
|
|
|
fileChooser.setTitle(bundle.getString("addStreamSource"));
|
|
|
|
|
File selectedFile = fileChooser.showOpenDialog(primaryStage);
|
|
|
|
|
if (selectedFile != null && selectedFile.exists()) {
|
|
|
|
|
addSource(selectedFile.getPath(), "stream");
|
|
|
|
|
} else {
|
|
|
|
|