added to option to select a local or streaming source at the first start
This commit is contained in:
parent
2d5887db4f
commit
8ec7653a5e
|
@ -0,0 +1,194 @@
|
|||
package com.cemu_UI.uiElements;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXDialog;
|
||||
import com.jfoenix.controls.JFXDialogLayout;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
public class JFXDirStrmCancelDialog {
|
||||
private String headingText;
|
||||
private String bodyText;
|
||||
private String dialogBtnStyle;
|
||||
private String btn1Text;
|
||||
private String btn2Text;
|
||||
private String cancelText;
|
||||
private int dialogWidth;
|
||||
private int dialogHeight;
|
||||
private EventHandler<ActionEvent> btn1Action;
|
||||
private EventHandler<ActionEvent> btn2Action;
|
||||
private Pane pane;
|
||||
|
||||
/**
|
||||
* Creates a new JFoenix Dialog to show some information with okay and cancel
|
||||
* option
|
||||
*
|
||||
* @param headingText Heading Text, just the heading
|
||||
* @param bodyText body Text, all other text belongs here
|
||||
* @param dialogBtnStyle Style of the okay button
|
||||
* @param dialogWidth dialog width
|
||||
* @param dialogHeight dialog height
|
||||
* @param btn1Action action which is performed if btn1 is clicked
|
||||
* @param btn2Action action which is performed if btn2 is clicked
|
||||
* @param cancelAction action which is performed if the cancel button is clicked
|
||||
* @param pane pane to which the dialog belongs
|
||||
*/
|
||||
public JFXDirStrmCancelDialog(String headingText, String bodyText, String dialogBtnStyle, int dialogWidth,
|
||||
int dialogHeight, EventHandler<ActionEvent> btn1Action, EventHandler<ActionEvent> btn2Action,
|
||||
Pane pane, ResourceBundle bundle) {
|
||||
setHeadingText(headingText);
|
||||
setBodyText(bodyText);
|
||||
setDialogBtnStyle(dialogBtnStyle);
|
||||
setDialogWidth(dialogWidth);
|
||||
setDialogHeight(dialogHeight);
|
||||
setBtn1Action(btn1Action);
|
||||
setBtn2Action(btn2Action);
|
||||
setPane(pane);
|
||||
|
||||
btn1Text = bundle.getString("addDirectory");
|
||||
btn2Text = bundle.getString("addStreamSource");
|
||||
cancelText = bundle.getString("cancelBtnText");
|
||||
}
|
||||
|
||||
public JFXDirStrmCancelDialog() {
|
||||
// Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public void show() {
|
||||
JFXDialogLayout content = new JFXDialogLayout();
|
||||
content.setHeading(new Text(headingText));
|
||||
content.setBody(new Text(bodyText));
|
||||
StackPane stackPane = new StackPane();
|
||||
stackPane.autosize();
|
||||
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
|
||||
|
||||
JFXButton btn1 = new JFXButton(btn1Text);
|
||||
btn1.addEventHandler(ActionEvent.ACTION, (e) -> {
|
||||
dialog.close();
|
||||
});
|
||||
btn1.addEventHandler(ActionEvent.ACTION, btn1Action);
|
||||
btn1.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
|
||||
btn1.setPrefHeight(32);
|
||||
btn1.setStyle(dialogBtnStyle);
|
||||
|
||||
JFXButton btn2 = new JFXButton(btn2Text);
|
||||
btn2.addEventHandler(ActionEvent.ACTION, (e) -> {
|
||||
dialog.close();
|
||||
});
|
||||
btn2.addEventHandler(ActionEvent.ACTION, btn2Action);
|
||||
btn2.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
|
||||
btn2.setPrefHeight(32);
|
||||
btn2.setStyle(dialogBtnStyle);
|
||||
|
||||
JFXButton cancelBtn = new JFXButton(cancelText);
|
||||
cancelBtn.addEventHandler(ActionEvent.ACTION, (e) -> {
|
||||
dialog.close();
|
||||
});
|
||||
cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
|
||||
cancelBtn.setPrefHeight(32);
|
||||
cancelBtn.setStyle(dialogBtnStyle);
|
||||
|
||||
content.setActions(cancelBtn, btn1, btn2);
|
||||
content.setPrefSize(dialogWidth, dialogHeight);
|
||||
pane.getChildren().add(stackPane);
|
||||
AnchorPane.setTopAnchor(stackPane, (pane.getHeight() - content.getPrefHeight()) / 2);
|
||||
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth() - content.getPrefWidth()) / 2);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public String getHeadingText() {
|
||||
return headingText;
|
||||
}
|
||||
|
||||
public void setHeadingText(String headingText) {
|
||||
this.headingText = headingText;
|
||||
}
|
||||
|
||||
public String getBodyText() {
|
||||
return bodyText;
|
||||
}
|
||||
|
||||
public void setBodyText(String bodyText) {
|
||||
this.bodyText = bodyText;
|
||||
}
|
||||
|
||||
public String getDialogBtnStyle() {
|
||||
return dialogBtnStyle;
|
||||
}
|
||||
|
||||
public void setDialogBtnStyle(String dialogBtnStyle) {
|
||||
this.dialogBtnStyle = dialogBtnStyle;
|
||||
}
|
||||
|
||||
public String getBtn1Text() {
|
||||
return btn1Text;
|
||||
}
|
||||
|
||||
public void setBtn1Text(String btn1Text) {
|
||||
this.btn1Text = btn1Text;
|
||||
}
|
||||
|
||||
public String getBtn2Text() {
|
||||
return btn2Text;
|
||||
}
|
||||
|
||||
public void setBtn2Text(String btn2Text) {
|
||||
this.btn2Text = btn2Text;
|
||||
}
|
||||
|
||||
public String getCancelText() {
|
||||
return cancelText;
|
||||
}
|
||||
|
||||
public void setCancelText(String cancelText) {
|
||||
this.cancelText = cancelText;
|
||||
}
|
||||
|
||||
public int getDialogWidth() {
|
||||
return dialogWidth;
|
||||
}
|
||||
|
||||
public void setDialogWidth(int dialogWidth) {
|
||||
this.dialogWidth = dialogWidth;
|
||||
}
|
||||
|
||||
public int getDialogHeight() {
|
||||
return dialogHeight;
|
||||
}
|
||||
|
||||
public void setDialogHeight(int dialogHeight) {
|
||||
this.dialogHeight = dialogHeight;
|
||||
}
|
||||
|
||||
public EventHandler<ActionEvent> getBtn1Action() {
|
||||
return btn1Action;
|
||||
}
|
||||
|
||||
public void setBtn1Action(EventHandler<ActionEvent> btn1Action) {
|
||||
this.btn1Action = btn1Action;
|
||||
}
|
||||
|
||||
public EventHandler<ActionEvent> getBtn2Action() {
|
||||
return btn2Action;
|
||||
}
|
||||
|
||||
public void setBtn2Action(EventHandler<ActionEvent> btn2Action) {
|
||||
this.btn2Action = btn2Action;
|
||||
}
|
||||
|
||||
public Pane getPane() {
|
||||
return pane;
|
||||
}
|
||||
|
||||
public void setPane(Pane pane) {
|
||||
this.pane = pane;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* cemu_UI
|
||||
*
|
||||
* Copyright 2017 <@Seil0>
|
||||
* Copyright 2017-2018 <@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
|
||||
|
@ -43,12 +43,12 @@ public class JFXInfoDialog {
|
|||
|
||||
/**
|
||||
* Creates a new JFoenix Dialog to show some information
|
||||
* @param headingText Heading Text, just the heading
|
||||
* @param bodyText body Text, all other text belongs here
|
||||
* @param dialogBtnStyle Style of the okay button
|
||||
* @param dialogWidth dialog width
|
||||
* @param dialogHeight dialog height
|
||||
* @param pane pane to which the dialog belongs
|
||||
* @param headingText Heading Text, just the heading
|
||||
* @param bodyText body Text, all other text belongs here
|
||||
* @param dialogBtnStyle Style of the okay button
|
||||
* @param dialogWidth dialog width
|
||||
* @param dialogHeight dialog height
|
||||
* @param pane pane to which the dialog belongs
|
||||
*/
|
||||
public JFXInfoDialog(String headingText, String bodyText, String dialogBtnStyle, int dialogWidth, int dialogHeight, Pane pane) {
|
||||
this.headingText = headingText;
|
||||
|
@ -59,6 +59,10 @@ public class JFXInfoDialog {
|
|||
this.pane = pane;
|
||||
}
|
||||
|
||||
public JFXInfoDialog() {
|
||||
// Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public void show() {
|
||||
JFXDialogLayout content = new JFXDialogLayout();
|
||||
content.setHeading(new Text(headingText));
|
||||
|
@ -83,4 +87,52 @@ public class JFXInfoDialog {
|
|||
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth() - content.getPrefWidth()) / 2);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public String getHeadingText() {
|
||||
return headingText;
|
||||
}
|
||||
|
||||
public void setHeadingText(String headingText) {
|
||||
this.headingText = headingText;
|
||||
}
|
||||
|
||||
public String getBodyText() {
|
||||
return bodyText;
|
||||
}
|
||||
|
||||
public void setBodyText(String bodyText) {
|
||||
this.bodyText = bodyText;
|
||||
}
|
||||
|
||||
public String getDialogBtnStyle() {
|
||||
return dialogBtnStyle;
|
||||
}
|
||||
|
||||
public void setDialogBtnStyle(String dialogBtnStyle) {
|
||||
this.dialogBtnStyle = dialogBtnStyle;
|
||||
}
|
||||
|
||||
public int getDialogWidth() {
|
||||
return dialogWidth;
|
||||
}
|
||||
|
||||
public void setDialogWidth(int dialogWidth) {
|
||||
this.dialogWidth = dialogWidth;
|
||||
}
|
||||
|
||||
public int getDialogHeight() {
|
||||
return dialogHeight;
|
||||
}
|
||||
|
||||
public void setDialogHeight(int dialogHeight) {
|
||||
this.dialogHeight = dialogHeight;
|
||||
}
|
||||
|
||||
public Pane getPane() {
|
||||
return pane;
|
||||
}
|
||||
|
||||
public void setPane(Pane pane) {
|
||||
this.pane = pane;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* cemu_UI
|
||||
*
|
||||
* Copyright 2017 <@Seil0>
|
||||
* Copyright 2017-2018 <@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
|
||||
|
@ -19,7 +19,6 @@
|
|||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
package com.cemu_UI.uiElements;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
@ -50,14 +49,14 @@ public class JFXOkayCancelDialog {
|
|||
|
||||
/**
|
||||
* Creates a new JFoenix Dialog to show some information with okay and cancel option
|
||||
* @param headingText Heading Text, just the heading
|
||||
* @param bodyText body Text, all other text belongs here
|
||||
* @param dialogBtnStyle Style of the okay button
|
||||
* @param dialogWidth dialog width
|
||||
* @param dialogHeight dialog height
|
||||
* @param okayAction action which is performed if the okay button is clicked
|
||||
* @param cancelAction action which is performed if the cancel button is clicked
|
||||
* @param pane pane to which the dialog belongs
|
||||
* @param headingText Heading Text, just the heading
|
||||
* @param bodyText body Text, all other text belongs here
|
||||
* @param dialogBtnStyle Style of the okay button
|
||||
* @param dialogWidth dialog width
|
||||
* @param dialogHeight dialog height
|
||||
* @param okayAction action which is performed if the okay button is clicked
|
||||
* @param cancelAction action which is performed if the cancel button is clicked
|
||||
* @param pane pane to which the dialog belongs
|
||||
*/
|
||||
public JFXOkayCancelDialog(String headingText, String bodyText, String dialogBtnStyle, int dialogWidth,
|
||||
int dialogHeight, EventHandler<ActionEvent> okayAction, EventHandler<ActionEvent> cancelAction, Pane pane,
|
||||
|
@ -74,36 +73,63 @@ public class JFXOkayCancelDialog {
|
|||
cancelText = bundle.getString("cancelBtnText");
|
||||
}
|
||||
|
||||
public void show() {
|
||||
public JFXOkayCancelDialog() {
|
||||
// Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public void show() {
|
||||
JFXDialogLayout content = new JFXDialogLayout();
|
||||
content.setHeading(new Text(headingText));
|
||||
content.setBody(new Text(bodyText));
|
||||
StackPane stackPane = new StackPane();
|
||||
stackPane.autosize();
|
||||
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
|
||||
JFXButton okayBtn = new JFXButton(okayText);
|
||||
okayBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
|
||||
dialog.close();
|
||||
});
|
||||
okayBtn.addEventHandler(ActionEvent.ACTION, okayAction);
|
||||
okayBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
|
||||
okayBtn.setPrefHeight(32);
|
||||
okayBtn.setStyle(dialogBtnStyle);
|
||||
JFXButton cancelBtn = new JFXButton(cancelText);
|
||||
cancelBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
|
||||
dialog.close();
|
||||
});
|
||||
cancelBtn.addEventHandler(ActionEvent.ACTION, cancelAction);
|
||||
cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
|
||||
cancelBtn.setPrefHeight(32);
|
||||
cancelBtn.setStyle(dialogBtnStyle);
|
||||
content.setActions(cancelBtn, okayBtn);
|
||||
content.setPrefSize(dialogWidth, dialogHeight);
|
||||
pane.getChildren().add(stackPane);
|
||||
AnchorPane.setTopAnchor(stackPane, (pane.getHeight()-content.getPrefHeight())/2);
|
||||
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth()-content.getPrefWidth())/2);
|
||||
dialog.show();
|
||||
content.setHeading(new Text(headingText));
|
||||
content.setBody(new Text(bodyText));
|
||||
StackPane stackPane = new StackPane();
|
||||
stackPane.autosize();
|
||||
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
|
||||
JFXButton okayBtn = new JFXButton(okayText);
|
||||
okayBtn.addEventHandler(ActionEvent.ACTION, (e) -> {
|
||||
dialog.close();
|
||||
});
|
||||
okayBtn.addEventHandler(ActionEvent.ACTION, okayAction);
|
||||
okayBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
|
||||
okayBtn.setPrefHeight(32);
|
||||
okayBtn.setStyle(dialogBtnStyle);
|
||||
JFXButton cancelBtn = new JFXButton(cancelText);
|
||||
cancelBtn.addEventHandler(ActionEvent.ACTION, (e) -> {
|
||||
dialog.close();
|
||||
});
|
||||
cancelBtn.addEventHandler(ActionEvent.ACTION, cancelAction);
|
||||
cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
|
||||
cancelBtn.setPrefHeight(32);
|
||||
cancelBtn.setStyle(dialogBtnStyle);
|
||||
content.setActions(cancelBtn, okayBtn);
|
||||
content.setPrefSize(dialogWidth, dialogHeight);
|
||||
pane.getChildren().add(stackPane);
|
||||
AnchorPane.setTopAnchor(stackPane, (pane.getHeight() - content.getPrefHeight()) / 2);
|
||||
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth() - content.getPrefWidth()) / 2);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public String getHeadingText() {
|
||||
return headingText;
|
||||
}
|
||||
|
||||
public void setHeadingText(String headingText) {
|
||||
this.headingText = headingText;
|
||||
}
|
||||
|
||||
public String getBodyText() {
|
||||
return bodyText;
|
||||
}
|
||||
|
||||
public void setBodyText(String bodyText) {
|
||||
this.bodyText = bodyText;
|
||||
}
|
||||
|
||||
public String getDialogBtnStyle() {
|
||||
return dialogBtnStyle;
|
||||
}
|
||||
|
||||
public void setDialogBtnStyle(String dialogBtnStyle) {
|
||||
this.dialogBtnStyle = dialogBtnStyle;
|
||||
}
|
||||
|
||||
public String getOkayText() {
|
||||
|
@ -122,6 +148,22 @@ public class JFXOkayCancelDialog {
|
|||
this.cancelText = cancelText;
|
||||
}
|
||||
|
||||
public int getDialogWidth() {
|
||||
return dialogWidth;
|
||||
}
|
||||
|
||||
public void setDialogWidth(int dialogWidth) {
|
||||
this.dialogWidth = dialogWidth;
|
||||
}
|
||||
|
||||
public int getDialogHeight() {
|
||||
return dialogHeight;
|
||||
}
|
||||
|
||||
public void setDialogHeight(int dialogHeight) {
|
||||
this.dialogHeight = dialogHeight;
|
||||
}
|
||||
|
||||
public EventHandler<ActionEvent> getOkayAction() {
|
||||
return okayAction;
|
||||
}
|
||||
|
@ -138,5 +180,13 @@ public class JFXOkayCancelDialog {
|
|||
this.cancelAction = cancelAction;
|
||||
}
|
||||
|
||||
public Pane getPane() {
|
||||
return pane;
|
||||
}
|
||||
|
||||
public void setPane(Pane pane) {
|
||||
this.pane = pane;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* cemu_UI
|
||||
*
|
||||
* Copyright 2017 <@Seil0>
|
||||
* Copyright 2017-2018 <@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
|
||||
|
@ -45,12 +45,12 @@ public class JFXTextAreaInfoDialog {
|
|||
|
||||
/**
|
||||
* Creates a new JFoenix Dialog to show some information
|
||||
* @param headingText Heading Text, just the heading
|
||||
* @param bodyText body Text, all other text belongs here
|
||||
* @param headingText Heading Text, just the heading
|
||||
* @param bodyText body Text, all other text belongs here
|
||||
* @param dialogBtnStyle Style of the okay button
|
||||
* @param dialogWidth dialog width
|
||||
* @param dialogHeight dialog height
|
||||
* @param pane pane to which the dialog belongs
|
||||
* @param dialogWidth dialog width
|
||||
* @param dialogHeight dialog height
|
||||
* @param pane pane to which the dialog belongs
|
||||
*/
|
||||
public JFXTextAreaInfoDialog(String headingText, String bodyText, String dialogBtnStyle, int dialogWidth, int dialogHeight, Pane pane) {
|
||||
this.headingText = headingText;
|
||||
|
@ -61,6 +61,10 @@ public class JFXTextAreaInfoDialog {
|
|||
this.pane = pane;
|
||||
}
|
||||
|
||||
public JFXTextAreaInfoDialog() {
|
||||
// Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public void show() {
|
||||
textArea = new JFXTextArea(bodyText);
|
||||
|
||||
|
@ -88,6 +92,46 @@ public class JFXTextAreaInfoDialog {
|
|||
dialog.show();
|
||||
}
|
||||
|
||||
public String getHeadingText() {
|
||||
return headingText;
|
||||
}
|
||||
|
||||
public void setHeadingText(String headingText) {
|
||||
this.headingText = headingText;
|
||||
}
|
||||
|
||||
public String getBodyText() {
|
||||
return bodyText;
|
||||
}
|
||||
|
||||
public void setBodyText(String bodyText) {
|
||||
this.bodyText = bodyText;
|
||||
}
|
||||
|
||||
public String getDialogBtnStyle() {
|
||||
return dialogBtnStyle;
|
||||
}
|
||||
|
||||
public void setDialogBtnStyle(String dialogBtnStyle) {
|
||||
this.dialogBtnStyle = dialogBtnStyle;
|
||||
}
|
||||
|
||||
public int getDialogWidth() {
|
||||
return dialogWidth;
|
||||
}
|
||||
|
||||
public void setDialogWidth(int dialogWidth) {
|
||||
this.dialogWidth = dialogWidth;
|
||||
}
|
||||
|
||||
public int getDialogHeight() {
|
||||
return dialogHeight;
|
||||
}
|
||||
|
||||
public void setDialogHeight(int dialogHeight) {
|
||||
this.dialogHeight = dialogHeight;
|
||||
}
|
||||
|
||||
public JFXTextArea getTextArea() {
|
||||
return textArea;
|
||||
}
|
||||
|
@ -95,4 +139,13 @@ public class JFXTextAreaInfoDialog {
|
|||
public void setTextArea(JFXTextArea textArea) {
|
||||
this.textArea = textArea;
|
||||
}
|
||||
|
||||
public Pane getPane() {
|
||||
return pane;
|
||||
}
|
||||
|
||||
public void setPane(Pane pane) {
|
||||
this.pane = pane;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,10 +36,12 @@ import javafx.fxml.FXMLLoader;
|
|||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Alert.AlertType;
|
||||
import javafx.scene.control.ButtonBar.ButtonData;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.stage.DirectoryChooser;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class Main extends Application {
|
||||
|
@ -61,7 +63,6 @@ public class Main extends Application {
|
|||
private File configFile;
|
||||
private File posterCache;
|
||||
|
||||
private String path;
|
||||
private String FONT_FAMILY = "System";
|
||||
private String local = System.getProperty("user.language")+"_"+System.getProperty("user.country");
|
||||
private double FONT_SIZE = 17;
|
||||
|
@ -106,7 +107,7 @@ public class Main extends Application {
|
|||
// startup checks
|
||||
if (!configFile.exists()) {
|
||||
directory.mkdir();
|
||||
mainWindowController.addSource(firstStart(), "local");
|
||||
getFirstSource();
|
||||
mainWindowController.setColor("ee3523");
|
||||
mainWindowController.setSize(FONT_SIZE);
|
||||
mainWindowController.setAutoUpdate(false);
|
||||
|
@ -132,8 +133,10 @@ public class Main extends Application {
|
|||
}
|
||||
}
|
||||
|
||||
// Method for first Start
|
||||
private String firstStart(){
|
||||
/** TODO add option to add streaming as first source
|
||||
* when there i no config.xml we need to get the path for the first source from the user
|
||||
*/
|
||||
private void getFirstSource(){
|
||||
switch (System.getProperty("user.language") + "_" + System.getProperty("user.country")) {
|
||||
case "en_US":
|
||||
bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // us_english
|
||||
|
@ -146,26 +149,78 @@ public class Main extends Application {
|
|||
break;
|
||||
}
|
||||
|
||||
// // 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");
|
||||
// } else {
|
||||
// LOGGER.error("The selected folder dosen't exist!");
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// // 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(getPrimaryStage());
|
||||
// if (selectedFile != null && selectedFile.exists()) {
|
||||
// mainWindowController.addSource(selectedFile.getPath(), "stream");
|
||||
// } else {
|
||||
// LOGGER.error("The selected file dosen't exist!");
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// JFXDirStrmCancelDialog selectFirstSource = new JFXDirStrmCancelDialog(bundle.getString("addSourceHeader"),
|
||||
// bundle.getString("addSourceBody"), "", 200, 100, btn1Action, btn2Action, pane, bundle);
|
||||
// selectFirstSource.show();
|
||||
|
||||
|
||||
Alert alert = new Alert(AlertType.CONFIRMATION); //new alert with DirectoryChooser
|
||||
alert.setTitle("Project HomeFlix");
|
||||
alert.setHeaderText(bundle.getString("firstStartHeader"));
|
||||
alert.setContentText(bundle.getString("firstStartContent"));
|
||||
alert.setHeaderText(bundle.getString("addSourceHeader"));
|
||||
alert.setContentText(bundle.getString("addSourceBody"));
|
||||
alert.setResizable(true);
|
||||
|
||||
Optional<ButtonType> result = alert.showAndWait();
|
||||
if (result.get() == ButtonType.OK){
|
||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
File selectedDirectory =
|
||||
directoryChooser.showDialog(primaryStage);
|
||||
path = selectedDirectory.getAbsolutePath();
|
||||
ButtonType buttonDirectory = new ButtonType(bundle.getString("addDirectory"));
|
||||
ButtonType buttonStreaming = new ButtonType(bundle.getString("addStreamSource"));
|
||||
ButtonType buttonCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);
|
||||
|
||||
alert.getButtonTypes().setAll(buttonDirectory, buttonStreaming, buttonCancel);
|
||||
|
||||
Optional<ButtonType> result = alert.showAndWait();
|
||||
if (result.get() == buttonDirectory) {
|
||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
directoryChooser.setTitle(bundle.getString("addDirectory"));
|
||||
File selectedFolder = directoryChooser.showDialog(primaryStage);
|
||||
if (selectedFolder != null && selectedFolder.exists()) {
|
||||
mainWindowController.addSource(selectedFolder.getPath(), "local");
|
||||
} else {
|
||||
LOGGER.error("The selected folder dosen't exist!");
|
||||
System.exit(1);
|
||||
}
|
||||
} else if (result.get() == buttonStreaming) {
|
||||
FileChooser fileChooser = new FileChooser();
|
||||
fileChooser.setTitle("addStreamSource");
|
||||
File selectedFile = fileChooser.showOpenDialog(getPrimaryStage());
|
||||
if (selectedFile != null && selectedFile.exists()) {
|
||||
mainWindowController.addSource(selectedFile.getPath(), "stream");
|
||||
} else {
|
||||
LOGGER.error("The selected file dosen't exist!");
|
||||
System.exit(1);
|
||||
}
|
||||
} else {
|
||||
LOGGER.warn("No directory selected!");
|
||||
LOGGER.warn("No source selected!");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
return path;
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
|
|
@ -267,7 +267,6 @@ public class MainWindowController {
|
|||
private ImageView skip_next_black = new ImageView(new Image("icons/ic_skip_next_black_18dp_1x.png"));
|
||||
private ImageView play_arrow_white = new ImageView(new Image("icons/ic_play_arrow_white_18dp_1x.png"));
|
||||
private ImageView play_arrow_black = new ImageView(new Image("icons/ic_play_arrow_black_18dp_1x.png"));
|
||||
private DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
private MenuItem like = new MenuItem("like");
|
||||
private MenuItem dislike = new MenuItem("dislike"); //TODO one option (like or dislike)
|
||||
private ContextMenu menu = new ContextMenu(like, dislike);
|
||||
|
@ -290,6 +289,7 @@ public class MainWindowController {
|
|||
omdbAPIController = new OMDbAPIController(this, dbController, this.main);
|
||||
}
|
||||
|
||||
// call all init methods
|
||||
void init() {
|
||||
loadSettings();
|
||||
checkAutoUpdate();
|
||||
|
@ -632,10 +632,11 @@ public class MainWindowController {
|
|||
|
||||
@FXML
|
||||
private void addDirectoryBtnAction(){
|
||||
File selectedFolder = directoryChooser.showDialog(null);
|
||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
directoryChooser.setTitle(bundle.getString("addDirectory"));
|
||||
File selectedFolder = directoryChooser.showDialog(main.getPrimaryStage());
|
||||
if (selectedFolder != null && selectedFolder.exists()) {
|
||||
addSource(selectedFolder.getPath(), "local");
|
||||
dbController.refreshDataBase();
|
||||
mainWindowController.addSource(selectedFolder.getPath(), "local");
|
||||
} else {
|
||||
LOGGER.error("The selected folder dosen't exist!");
|
||||
}
|
||||
|
@ -644,7 +645,7 @@ public class MainWindowController {
|
|||
@FXML
|
||||
private void addStreamSourceBtnAction(){
|
||||
FileChooser fileChooser = new FileChooser();
|
||||
fileChooser.setTitle("Open Resource File");
|
||||
fileChooser.setTitle("addStreamSource");
|
||||
File selectedFile = fileChooser.showOpenDialog(main.getPrimaryStage());
|
||||
if (selectedFile != null && selectedFile.exists()) {
|
||||
addSource(selectedFile.getPath(), "stream");
|
||||
|
|
|
@ -60,5 +60,6 @@ imdbRating = IMDB-Bewertung
|
|||
type = Type
|
||||
|
||||
#first start
|
||||
firstStartHeader = Es ist kein Stammverzeichnis f\u00FCr Filme angegeben!
|
||||
firstStartContent = Stammverzeichniss angeben?
|
||||
addSourceHeader = Neue Quelle hinzuf\u00FCgen
|
||||
addSourceBody = HomeFlix konnte keine Quelle finden. \nFüge eine loakels Verzeichniss oder eine Sreaming Datei als neue Quelle hinzu.
|
||||
cancelBtnText = Abbrechen
|
||||
|
|
|
@ -60,5 +60,6 @@ imdbRating = IMDB-Rating
|
|||
type = Type
|
||||
|
||||
#first start
|
||||
firstStartHeader = There is no root directory for movies!
|
||||
firstStartContent = Specify a root directory?
|
||||
addSourceHeader = add a new source
|
||||
addSourceBody = HomeFlix was not able to load a source. \nAdd a new local directory oa a streaming file as new source.
|
||||
cancelBtnText = cancel
|
||||
|
|
Loading…
Reference in New Issue