added cemu_UIs material styled dialogs
* added cemu_UIs material styled dialogs * new about dialog * finished log4j work * code cleanup
This commit is contained in:
parent
a3efefe43f
commit
8dbce96a25
|
@ -0,0 +1,86 @@
|
||||||
|
/**
|
||||||
|
* cemu_UI
|
||||||
|
*
|
||||||
|
* Copyright 2017 <@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 com.cemu_UI.uiElements;
|
||||||
|
|
||||||
|
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 JFXInfoDialog {
|
||||||
|
|
||||||
|
private String headingText;
|
||||||
|
private String bodyText;
|
||||||
|
private String dialogBtnStyle;
|
||||||
|
private int dialogWidth;
|
||||||
|
private int dialogHeight;
|
||||||
|
private Pane pane;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
public JFXInfoDialog(String headingText, String bodyText, String dialogBtnStyle, int dialogWidth, int dialogHeight, Pane pane) {
|
||||||
|
this.headingText = headingText;
|
||||||
|
this.bodyText = bodyText;
|
||||||
|
this.dialogBtnStyle = dialogBtnStyle;
|
||||||
|
this.dialogWidth = dialogWidth;
|
||||||
|
this.dialogHeight = dialogHeight;
|
||||||
|
this.pane = pane;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show() {
|
||||||
|
JFXDialogLayout content = new JFXDialogLayout();
|
||||||
|
content.setHeading(new Text(headingText));
|
||||||
|
content.setBody(new Text(bodyText));
|
||||||
|
content.setPrefSize(dialogWidth, dialogHeight);
|
||||||
|
StackPane stackPane = new StackPane();
|
||||||
|
stackPane.autosize();
|
||||||
|
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
|
||||||
|
JFXButton button = new JFXButton("Okay");
|
||||||
|
button.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
|
@Override
|
||||||
|
public void handle(ActionEvent event) {
|
||||||
|
dialog.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
|
||||||
|
button.setPrefHeight(32);
|
||||||
|
button.setStyle(dialogBtnStyle);
|
||||||
|
content.setActions(button);
|
||||||
|
pane.getChildren().add(stackPane);
|
||||||
|
AnchorPane.setTopAnchor(stackPane, (pane.getHeight() - content.getPrefHeight()) / 2);
|
||||||
|
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth() - content.getPrefWidth()) / 2);
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,142 @@
|
||||||
|
/**
|
||||||
|
* cemu_UI
|
||||||
|
*
|
||||||
|
* Copyright 2017 <@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 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 JFXOkayCancelDialog {
|
||||||
|
|
||||||
|
private String headingText;
|
||||||
|
private String bodyText;
|
||||||
|
private String dialogBtnStyle;
|
||||||
|
private String okayText;
|
||||||
|
private String cancelText;
|
||||||
|
private int dialogWidth;
|
||||||
|
private int dialogHeight;
|
||||||
|
private EventHandler<ActionEvent> okayAction;
|
||||||
|
private EventHandler<ActionEvent> cancelAction;
|
||||||
|
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 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,
|
||||||
|
ResourceBundle bundle) {
|
||||||
|
this.headingText = headingText;
|
||||||
|
this.bodyText = bodyText;
|
||||||
|
this.dialogBtnStyle = dialogBtnStyle;
|
||||||
|
this.dialogWidth = dialogWidth;
|
||||||
|
this.dialogHeight = dialogHeight;
|
||||||
|
this.okayAction = okayAction;
|
||||||
|
this.cancelAction = cancelAction;
|
||||||
|
this.pane = pane;
|
||||||
|
okayText = bundle.getString("okayBtnText");
|
||||||
|
cancelText = bundle.getString("cancelBtnText");
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOkayText() {
|
||||||
|
return okayText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOkayText(String okayText) {
|
||||||
|
this.okayText = okayText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCancelText() {
|
||||||
|
return cancelText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelText(String cancelText) {
|
||||||
|
this.cancelText = cancelText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EventHandler<ActionEvent> getOkayAction() {
|
||||||
|
return okayAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOkayAction(EventHandler<ActionEvent> okayAction) {
|
||||||
|
this.okayAction = okayAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EventHandler<ActionEvent> getCancelAction() {
|
||||||
|
return cancelAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelAction(EventHandler<ActionEvent> cancelAction) {
|
||||||
|
this.cancelAction = cancelAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
/**
|
||||||
|
* cemu_UI
|
||||||
|
*
|
||||||
|
* Copyright 2017 <@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 com.cemu_UI.uiElements;
|
||||||
|
|
||||||
|
import com.jfoenix.controls.JFXButton;
|
||||||
|
import com.jfoenix.controls.JFXDialog;
|
||||||
|
import com.jfoenix.controls.JFXDialogLayout;
|
||||||
|
import com.jfoenix.controls.JFXTextArea;
|
||||||
|
|
||||||
|
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 JFXTextAreaInfoDialog {
|
||||||
|
|
||||||
|
private String headingText;
|
||||||
|
private String bodyText;
|
||||||
|
private String dialogBtnStyle;
|
||||||
|
private int dialogWidth;
|
||||||
|
private int dialogHeight;
|
||||||
|
private JFXTextArea textArea;
|
||||||
|
private Pane pane;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
public JFXTextAreaInfoDialog(String headingText, String bodyText, String dialogBtnStyle, int dialogWidth, int dialogHeight, Pane pane) {
|
||||||
|
this.headingText = headingText;
|
||||||
|
this.bodyText = bodyText;
|
||||||
|
this.dialogBtnStyle = dialogBtnStyle;
|
||||||
|
this.dialogWidth = dialogWidth;
|
||||||
|
this.dialogHeight = dialogHeight;
|
||||||
|
this.pane = pane;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show() {
|
||||||
|
textArea = new JFXTextArea(bodyText);
|
||||||
|
|
||||||
|
JFXDialogLayout content = new JFXDialogLayout();
|
||||||
|
content.setHeading(new Text(headingText));
|
||||||
|
content.setBody(textArea);
|
||||||
|
content.setPrefSize(dialogWidth, dialogHeight);
|
||||||
|
StackPane stackPane = new StackPane();
|
||||||
|
stackPane.autosize();
|
||||||
|
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
|
||||||
|
JFXButton button = new JFXButton("Okay");
|
||||||
|
button.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
|
@Override
|
||||||
|
public void handle(ActionEvent event) {
|
||||||
|
dialog.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
|
||||||
|
button.setPrefHeight(32);
|
||||||
|
button.setStyle(dialogBtnStyle);
|
||||||
|
content.setActions(button);
|
||||||
|
pane.getChildren().add(stackPane);
|
||||||
|
AnchorPane.setTopAnchor(stackPane, (pane.getHeight() - content.getPrefHeight()) / 2);
|
||||||
|
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth() - content.getPrefWidth()) / 2);
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public JFXTextArea getTextArea() {
|
||||||
|
return textArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextArea(JFXTextArea textArea) {
|
||||||
|
this.textArea = textArea;
|
||||||
|
}
|
||||||
|
}
|
|
@ -191,6 +191,10 @@ public class Main extends Application {
|
||||||
public void setPrimaryStage(Stage primaryStage) {
|
public void setPrimaryStage(Stage primaryStage) {
|
||||||
this.primaryStage = primaryStage;
|
this.primaryStage = primaryStage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AnchorPane getPane( ) {
|
||||||
|
return pane;
|
||||||
|
}
|
||||||
|
|
||||||
public String getFONT_FAMILY() {
|
public String getFONT_FAMILY() {
|
||||||
return FONT_FAMILY;
|
return FONT_FAMILY;
|
||||||
|
|
|
@ -45,6 +45,7 @@ import java.util.ResourceBundle;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import com.cemu_UI.uiElements.JFXInfoDialog;
|
||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
import com.jfoenix.controls.JFXColorPicker;
|
import com.jfoenix.controls.JFXColorPicker;
|
||||||
import com.jfoenix.controls.JFXHamburger;
|
import com.jfoenix.controls.JFXHamburger;
|
||||||
|
@ -137,7 +138,7 @@ public class MainWindowController {
|
||||||
private JFXButton forwardBtn;
|
private JFXButton forwardBtn;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private JFXButton infoBtn;
|
private JFXButton aboutBtn;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private JFXButton settingsBtn;
|
private JFXButton settingsBtn;
|
||||||
|
@ -251,7 +252,9 @@ public class MainWindowController {
|
||||||
private String version = "0.5.2";
|
private String version = "0.5.2";
|
||||||
private String buildNumber = "131";
|
private String buildNumber = "131";
|
||||||
private String versionName = "solidify cow";
|
private String versionName = "solidify cow";
|
||||||
|
private String dialogBtnStyle;
|
||||||
|
|
||||||
|
// text strings
|
||||||
private String errorPlay;
|
private String errorPlay;
|
||||||
private String errorOpenStream;
|
private String errorOpenStream;
|
||||||
private String errorMode;
|
private String errorMode;
|
||||||
|
@ -518,11 +521,7 @@ public class MainWindowController {
|
||||||
try {
|
try {
|
||||||
dbController.refresh(name, selected);
|
dbController.refresh(name, selected);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Alert alert = new Alert(AlertType.ERROR);
|
LOGGER.error("There was a problem with the like/dislike function!",e);
|
||||||
alert.setTitle("Error");
|
|
||||||
alert.setHeaderText("");
|
|
||||||
alert.setContentText("There should be an error message in future (dislike problem)");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
refreshTable();
|
refreshTable();
|
||||||
}
|
}
|
||||||
|
@ -575,7 +574,7 @@ public class MainWindowController {
|
||||||
|
|
||||||
LOGGER.info(filterData.size()); //Debug, delete?
|
LOGGER.info(filterData.size()); //Debug, delete?
|
||||||
for(int i = 0; i < filterData.size(); i++){
|
for(int i = 0; i < filterData.size(); i++){
|
||||||
// System.out.println(filterData.get(i).getTitel()+"; "+filterData.get(i).getRating());
|
// LOGGER.info(filterData.get(i).getTitle()+"; "+filterData.get(i).getRating()); // Debugging
|
||||||
root.getChildren().add(new TreeItem<tableData>(filterData.get(i))); //add filtered data to root node after search
|
root.getChildren().add(new TreeItem<tableData>(filterData.get(i))); //add filtered data to root node after search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -589,6 +588,7 @@ public class MainWindowController {
|
||||||
debugBtn.setVisible(false);
|
debugBtn.setVisible(false);
|
||||||
|
|
||||||
filmDirTextField.setText(getPath());
|
filmDirTextField.setText(getPath());
|
||||||
|
versionLbl.setText("Version: " + version + " (Build: " + buildNumber + ")");
|
||||||
fontsizeSlider.setValue(getSize());
|
fontsizeSlider.setValue(getSize());
|
||||||
colorPicker.setValue(Color.valueOf(getColor()));
|
colorPicker.setValue(Color.valueOf(getColor()));
|
||||||
|
|
||||||
|
@ -639,11 +639,8 @@ public class MainWindowController {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
if(output.contains("which: no vlc")||output == ""){
|
if(output.contains("which: no vlc")||output == ""){
|
||||||
Alert alert = new Alert(AlertType.INFORMATION);
|
JFXInfoDialog vlcInfoDialog = new JFXInfoDialog("Info", vlcNotInstalled, dialogBtnStyle, 350, 200, main.getPane());
|
||||||
alert.setHeaderText("");
|
vlcInfoDialog.show();
|
||||||
alert.setTitle("Info");
|
|
||||||
alert.setContentText(vlcNotInstalled);
|
|
||||||
alert.showAndWait();
|
|
||||||
}else{
|
}else{
|
||||||
try {
|
try {
|
||||||
Runtime.getRuntime().exec(new String[] { "vlc", getPath()+"/"+ datPath});
|
Runtime.getRuntime().exec(new String[] { "vlc", getPath()+"/"+ datPath});
|
||||||
|
@ -686,13 +683,11 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void infoBtnclicked(){
|
private void aboutBtnAction() {
|
||||||
Alert alert = new Alert(AlertType.INFORMATION);
|
String bodyText = "cemu_UI by @Seil0 \nVersion: " + version + " (Build: " + buildNumber + ") \""
|
||||||
alert.setTitle("Info");
|
+ versionName + "\" \n" + infoText;
|
||||||
alert.setHeaderText("Project HomeFlix");
|
JFXInfoDialog aboutDialog = new JFXInfoDialog("Project HomeFlix", bodyText, dialogBtnStyle, 350, 200, main.getPane());
|
||||||
alert.setContentText(infoText);
|
aboutDialog.show();
|
||||||
alert.initOwner(main.getPrimaryStage());
|
|
||||||
alert.showAndWait();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -905,10 +900,11 @@ public class MainWindowController {
|
||||||
filmDirTextField.setFocusColor(Color.valueOf(getColor()));
|
filmDirTextField.setFocusColor(Color.valueOf(getColor()));
|
||||||
|
|
||||||
if (icolor.compareTo(ccolor) == -1) {
|
if (icolor.compareTo(ccolor) == -1) {
|
||||||
|
dialogBtnStyle = btnStyleWhite;
|
||||||
settingsBtn.setStyle("-fx-text-fill: WHITE;");
|
settingsBtn.setStyle("-fx-text-fill: WHITE;");
|
||||||
streamingSettingsBtn.setStyle("-fx-text-fill: WHITE;");
|
streamingSettingsBtn.setStyle("-fx-text-fill: WHITE;");
|
||||||
switchBtn.setStyle("-fx-text-fill: WHITE;");
|
switchBtn.setStyle("-fx-text-fill: WHITE;");
|
||||||
infoBtn.setStyle("-fx-text-fill: WHITE;");
|
aboutBtn.setStyle("-fx-text-fill: WHITE;");
|
||||||
debugBtn.setStyle("-fx-text-fill: WHITE;");
|
debugBtn.setStyle("-fx-text-fill: WHITE;");
|
||||||
directoryBtn.setStyle(btnStyleWhite);
|
directoryBtn.setStyle(btnStyleWhite);
|
||||||
streamingDirectoryBtn.setStyle(btnStyleWhite);
|
streamingDirectoryBtn.setStyle(btnStyleWhite);
|
||||||
|
@ -922,10 +918,11 @@ public class MainWindowController {
|
||||||
forwardBtn.setGraphic(skip_next_white);
|
forwardBtn.setGraphic(skip_next_white);
|
||||||
menuHam.getStyleClass().add("jfx-hamburgerW");
|
menuHam.getStyleClass().add("jfx-hamburgerW");
|
||||||
} else {
|
} else {
|
||||||
|
dialogBtnStyle = btnStyleBlack;
|
||||||
settingsBtn.setStyle("-fx-text-fill: BLACK;");
|
settingsBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
streamingSettingsBtn.setStyle("-fx-text-fill: BLACK;");
|
streamingSettingsBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
switchBtn.setStyle("-fx-text-fill: BLACK;");
|
switchBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
infoBtn.setStyle("-fx-text-fill: BLACK;");
|
aboutBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
debugBtn.setStyle("-fx-text-fill: BLACK;");
|
debugBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
directoryBtn.setStyle(btnStyleBlack);
|
directoryBtn.setStyle(btnStyleBlack);
|
||||||
streamingDirectoryBtn.setStyle(btnStyleBlack);
|
streamingDirectoryBtn.setStyle(btnStyleBlack);
|
||||||
|
@ -994,7 +991,7 @@ public class MainWindowController {
|
||||||
languageChoisBox.getSelectionModel().select(0);
|
languageChoisBox.getSelectionModel().select(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
infoBtn.setText(getBundle().getString("info"));
|
aboutBtn.setText(getBundle().getString("info"));
|
||||||
settingsBtn.setText(getBundle().getString("settings"));
|
settingsBtn.setText(getBundle().getString("settings"));
|
||||||
streamingSettingsBtn.setText(getBundle().getString("streamingSettings"));
|
streamingSettingsBtn.setText(getBundle().getString("streamingSettings"));
|
||||||
filmDirTextField.setPromptText(getBundle().getString("filmDirTextField"));
|
filmDirTextField.setPromptText(getBundle().getString("filmDirTextField"));
|
||||||
|
@ -1010,7 +1007,6 @@ public class MainWindowController {
|
||||||
languageLbl.setText(getBundle().getString("languageLbl"));
|
languageLbl.setText(getBundle().getString("languageLbl"));
|
||||||
autoUpdateToggleBtn.setText(getBundle().getString("autoUpdate"));
|
autoUpdateToggleBtn.setText(getBundle().getString("autoUpdate"));
|
||||||
branchLbl.setText(getBundle().getString("branchLbl"));
|
branchLbl.setText(getBundle().getString("branchLbl"));
|
||||||
versionLbl.setText(getBundle().getString("version") + " " + version + " (Build: " + buildNumber + ")");
|
|
||||||
columnTitel.setText(getBundle().getString("columnName"));
|
columnTitel.setText(getBundle().getString("columnName"));
|
||||||
columnRating.setText(getBundle().getString("columnRating"));
|
columnRating.setText(getBundle().getString("columnRating"));
|
||||||
columnStreamUrl.setText(getBundle().getString("columnStreamUrl"));
|
columnStreamUrl.setText(getBundle().getString("columnStreamUrl"));
|
||||||
|
@ -1022,10 +1018,11 @@ public class MainWindowController {
|
||||||
errorMode = getBundle().getString("errorMode");
|
errorMode = getBundle().getString("errorMode");
|
||||||
errorLoad = getBundle().getString("errorLoad");
|
errorLoad = getBundle().getString("errorLoad");
|
||||||
errorSave = getBundle().getString("errorSave");
|
errorSave = getBundle().getString("errorSave");
|
||||||
infoText = getBundle().getString("version") + " " + version + " (Build: " + buildNumber + ") " + versionName + getBundle().getString("infoText");
|
infoText = getBundle().getString("infoText");
|
||||||
vlcNotInstalled = getBundle().getString("vlcNotInstalled");
|
vlcNotInstalled = getBundle().getString("vlcNotInstalled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO rework to material design
|
||||||
public void showErrorMsg(String msg, IOException exception) {
|
public void showErrorMsg(String msg, IOException exception) {
|
||||||
Alert alert = new Alert(AlertType.ERROR);
|
Alert alert = new Alert(AlertType.ERROR);
|
||||||
alert.setTitle("Error");
|
alert.setTitle("Error");
|
||||||
|
|
|
@ -400,12 +400,12 @@ public class DBController {
|
||||||
lastName = filmsStreamData.get(b);
|
lastName = filmsStreamData.get(b);
|
||||||
JsonObject object = Json.parse(new FileReader(filmsStreamData.get(b))).asObject();
|
JsonObject object = Json.parse(new FileReader(filmsStreamData.get(b))).asObject();
|
||||||
JsonArray items = object.get("entries").asArray();
|
JsonArray items = object.get("entries").asArray();
|
||||||
System.out.println(items.size() + ", " + i + "; " + b);
|
LOGGER.info(items.size() + ", " + i + "; " + b);
|
||||||
String streamURL = items.get(i).asObject().getString("streamUrl", "");
|
String streamURL = items.get(i).asObject().getString("streamUrl", "");
|
||||||
String titel = items.get(i).asObject().getString("titel", "");
|
String titel = items.get(i).asObject().getString("titel", "");
|
||||||
|
|
||||||
if (streamURL.equals(filmsStreamURL.get(b))) {
|
if (streamURL.equals(filmsStreamURL.get(b))) {
|
||||||
System.out.println("added \"" + titel + "\"");
|
LOGGER.info("added \"" + titel + "\"");
|
||||||
|
|
||||||
ps.setInt(1, items.get(i).asObject().getInt("year", 0));
|
ps.setInt(1, items.get(i).asObject().getInt("year", 0));
|
||||||
ps.setInt(2, items.get(i).asObject().getInt("season", 0));
|
ps.setInt(2, items.get(i).asObject().getInt("season", 0));
|
||||||
|
@ -464,65 +464,63 @@ public class DBController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get favorite status TODO this should get the correct mode!
|
// get favorite status
|
||||||
public void getFavStatus(String name) {
|
public void getFavStatus(String name) {
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
if (mainWindowController.getMode().equals("local")) {
|
||||||
ResultSet rs = stmt.executeQuery("SELECT titel, rating, favIcon FROM film_local WHERE titel = \"" + name + "\";"); // SQL Befehl
|
Statement stmt = connection.createStatement();
|
||||||
LOGGER.info("local:" + rs.getString("rating") + ", " + rs.getString("titel") + ", " + rs.getString("favIcon"));
|
ResultSet rs = stmt.executeQuery("SELECT titel, rating, favIcon FROM film_local WHERE titel = \"" + name + "\";"); // SQL Befehl
|
||||||
stmt.close();
|
LOGGER.info("local:" + rs.getString("rating") + ", " + rs.getString("titel") + ", " + rs.getString("favIcon"));
|
||||||
rs.close();
|
stmt.close();
|
||||||
} catch (SQLException e) {
|
rs.close();
|
||||||
try {
|
} else {
|
||||||
Statement stmtS = connection.createStatement();
|
Statement stmtS = connection.createStatement();
|
||||||
ResultSet rsS = stmtS.executeQuery("SELECT titel, rating, favIcon FROM film_streaming WHERE titel = \"" + name + "\";");
|
ResultSet rsS = stmtS.executeQuery("SELECT titel, rating, favIcon FROM film_streaming WHERE titel = \"" + name + "\";");
|
||||||
LOGGER.info("streaming:" + rsS.getString("rating") + ", " + rsS.getString("titel") + ", " + rsS.getString("favIcon"));
|
LOGGER.info("streaming:" + rsS.getString("rating") + ", " + rsS.getString("titel") + ", " + rsS.getString("favIcon"));
|
||||||
stmtS.close();
|
stmtS.close();
|
||||||
rsS.close();
|
rsS.close();
|
||||||
} catch (SQLException e1) {
|
|
||||||
LOGGER.error("Ups! an error occured!", e1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error("Ups! an error occured!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set rating=0 and favorite_border_black TODO this should get the correct mode!
|
// set rating=0 and favorite_border_black
|
||||||
public void dislike(String name, String streamUrl) {
|
public void dislike(String name, String streamUrl) {
|
||||||
LOGGER.info("defavorisieren ...");
|
LOGGER.info("defavorisieren ...");
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
if (mainWindowController.getMode().equals("local")) {
|
||||||
stmt.executeUpdate("UPDATE film_local SET rating=0,favIcon='favorite_border_black' WHERE titel=\"" + name + "\";");
|
Statement stmt = connection.createStatement();
|
||||||
connection.commit();
|
stmt.executeUpdate("UPDATE film_local SET rating=0,favIcon='favorite_border_black' WHERE titel=\"" + name + "\";");
|
||||||
stmt.close();
|
connection.commit();
|
||||||
} catch (SQLException e) {
|
stmt.close();
|
||||||
LOGGER.error("Ups! an error occured!", e);
|
} else {
|
||||||
}
|
Statement stmt = connection.createStatement();
|
||||||
try {
|
stmt.executeUpdate("UPDATE film_streaming SET rating=0,favIcon='favorite_border_black' WHERE streamUrl=\"" + streamUrl + "\";");
|
||||||
Statement stmt = connection.createStatement();
|
connection.commit();
|
||||||
stmt.executeUpdate("UPDATE film_streaming SET rating=0,favIcon='favorite_border_black' WHERE streamUrl=\"" + streamUrl + "\";");
|
stmt.close();
|
||||||
connection.commit();
|
}
|
||||||
stmt.close();
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Ups! an error occured!", e);
|
LOGGER.error("Ups! an error occured!", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set rating=1 and favorite_black TODO this should get the correct mode!
|
// set rating=1 and favorite_black
|
||||||
public void like(String name, String streamUrl) {
|
public void like(String name, String streamUrl) {
|
||||||
System.out.println("favorisieren ...");
|
LOGGER.info("favorisieren ...");
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
if (mainWindowController.getMode().equals("local")) {
|
||||||
stmt.executeUpdate("UPDATE film_local SET rating=1,favIcon='favorite_black' WHERE titel=\"" + name + "\";");
|
Statement stmt = connection.createStatement();
|
||||||
connection.commit();
|
stmt.executeUpdate("UPDATE film_local SET rating=1,favIcon='favorite_black' WHERE titel=\"" + name + "\";");
|
||||||
stmt.close();
|
connection.commit();
|
||||||
} catch (SQLException e) {
|
stmt.close();
|
||||||
LOGGER.error("Ups! an error occured!", e);
|
} else {
|
||||||
}
|
Statement stmt = connection.createStatement();
|
||||||
try {
|
stmt.executeUpdate("UPDATE film_streaming SET rating=1,favIcon='favorite_black' WHERE streamUrl=\"" + streamUrl + "\";");
|
||||||
Statement stmt = connection.createStatement();
|
connection.commit();
|
||||||
stmt.executeUpdate("UPDATE film_streaming SET rating=1,favIcon='favorite_black' WHERE streamUrl=\"" + streamUrl + "\";");
|
stmt.close();
|
||||||
connection.commit();
|
}
|
||||||
stmt.close();
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Ups! an error occured!", e);
|
LOGGER.error("Ups! an error occured!", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,9 @@ import java.util.Scanner;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import com.eclipsesource.json.Json;
|
import com.eclipsesource.json.Json;
|
||||||
import com.eclipsesource.json.JsonObject;
|
import com.eclipsesource.json.JsonObject;
|
||||||
|
|
||||||
|
@ -62,6 +65,7 @@ public class apiQuery{
|
||||||
private String apiKey = "";
|
private String apiKey = "";
|
||||||
ArrayList<Text> responseText = new ArrayList<Text>();
|
ArrayList<Text> responseText = new ArrayList<Text>();
|
||||||
ArrayList<Text> nameText = new ArrayList<Text>();
|
ArrayList<Text> nameText = new ArrayList<Text>();
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* apiQuery for Project HomeFlix, sends a query to the omdb api
|
* apiQuery for Project HomeFlix, sends a query to the omdb api
|
||||||
|
@ -89,7 +93,7 @@ public class apiQuery{
|
||||||
|
|
||||||
// in case of no or "" Film title
|
// in case of no or "" Film title
|
||||||
if (moviename == null || moviename.equals("")) {
|
if (moviename == null || moviename.equals("")) {
|
||||||
System.out.println("No movie found");
|
LOGGER.warn("No movie found");
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove unwanted blank
|
//remove unwanted blank
|
||||||
|
@ -106,7 +110,7 @@ public class apiQuery{
|
||||||
//read data from response Stream
|
//read data from response Stream
|
||||||
while ((retdata = br.readLine()) != null) {
|
while ((retdata = br.readLine()) != null) {
|
||||||
//cut the json response into separate strings
|
//cut the json response into separate strings
|
||||||
System.out.println(retdata);
|
LOGGER.info(retdata);
|
||||||
JsonObject object = Json.parse(retdata).asObject();
|
JsonObject object = Json.parse(retdata).asObject();
|
||||||
|
|
||||||
responseString[0] = object.getString("Title", "");
|
responseString[0] = object.getString("Title", "");
|
||||||
|
@ -141,7 +145,7 @@ public class apiQuery{
|
||||||
ImageIO.write(resizeImagePNG, "png", new File(posterCache+"\\"+titel+".png")); //change path where you want it saved
|
ImageIO.write(resizeImagePNG, "png", new File(posterCache+"\\"+titel+".png")); //change path where you want it saved
|
||||||
posterPath = posterCache+"\\"+titel+".png";
|
posterPath = posterCache+"\\"+titel+".png";
|
||||||
}
|
}
|
||||||
System.out.println("adding poster to cache: "+posterPath);
|
LOGGER.info("adding poster to cache: "+posterPath);
|
||||||
|
|
||||||
//adding strings to the cache
|
//adding strings to the cache
|
||||||
dbController.addCache( streamUrl, responseString[0], responseString[1],responseString[2], responseString[3], responseString[4], responseString[5],
|
dbController.addCache( streamUrl, responseString[0], responseString[1],responseString[2], responseString[3], responseString[4], responseString[5],
|
||||||
|
@ -203,7 +207,7 @@ public class apiQuery{
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mainWindowController.getTextFlow().getChildren().remove(0, mainWindowController.getTextFlow().getChildren().size());
|
mainWindowController.getTextFlow().getChildren().remove(0, mainWindowController.getTextFlow().getChildren().size());
|
||||||
mainWindowController.getTextFlow().getChildren().add(new Text(e.toString()));
|
mainWindowController.getTextFlow().getChildren().add(new Text(e.toString()));
|
||||||
System.out.println(e);
|
LOGGER.error(e);
|
||||||
} finally {
|
} finally {
|
||||||
//closes datainputStream, InputStream,Scanner if not already done
|
//closes datainputStream, InputStream,Scanner if not already done
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
</HBox>
|
</HBox>
|
||||||
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="660.0" prefWidth="150.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="32.0">
|
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="660.0" prefWidth="150.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="32.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXButton fx:id="infoBtn" onAction="#infoBtnclicked" prefHeight="32.0" prefWidth="150.0" textAlignment="CENTER">
|
<JFXButton fx:id="aboutBtn" onAction="#aboutBtnAction" prefHeight="32.0" prefWidth="150.0" textAlignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="15.0" />
|
<Font name="System Bold" size="15.0" />
|
||||||
</font>
|
</font>
|
||||||
|
|
|
@ -20,7 +20,6 @@ updateBtnUpdateAvailable = Update verf\u00FCgbar
|
||||||
updateBtnNoUpdateAvailable = Kein Update verf\u00FCgbar
|
updateBtnNoUpdateAvailable = Kein Update verf\u00FCgbar
|
||||||
autoUpdate = beim Start nach Updates suchen:
|
autoUpdate = beim Start nach Updates suchen:
|
||||||
branchLbl = Updatezweig
|
branchLbl = Updatezweig
|
||||||
version = Version:
|
|
||||||
|
|
||||||
#column translations
|
#column translations
|
||||||
columnName = Name
|
columnName = Name
|
||||||
|
@ -40,7 +39,7 @@ errorLoad = Beim laden der Einstellungen ist ein Fehler aufgetreten!
|
||||||
errorSave = Beim speichern der Einstellungen ist ein Fehler aufgetreten!
|
errorSave = Beim speichern der Einstellungen ist ein Fehler aufgetreten!
|
||||||
noFilmFound = Kein Film mit diesem Titel gefunden!
|
noFilmFound = Kein Film mit diesem Titel gefunden!
|
||||||
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt!
|
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt!
|
||||||
infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
|
infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016-2018 Kellerkinder www.kellerkinder.xyz
|
||||||
|
|
||||||
#textFlow translations
|
#textFlow translations
|
||||||
title = Titel
|
title = Titel
|
||||||
|
|
|
@ -20,7 +20,6 @@ updateBtnUpdateAvailable = update available
|
||||||
updateBtnNoUpdateAvailable = no update available
|
updateBtnNoUpdateAvailable = no update available
|
||||||
autoUpdate = check at startup for updates:
|
autoUpdate = check at startup for updates:
|
||||||
branchLbl = Branch
|
branchLbl = Branch
|
||||||
version = Version:
|
|
||||||
|
|
||||||
#column translations
|
#column translations
|
||||||
columnName = Name
|
columnName = Name
|
||||||
|
@ -40,7 +39,7 @@ errorLoad = An error occurred while loading the settings!
|
||||||
errorSave = An error occurred while saving the settings!
|
errorSave = An error occurred while saving the settings!
|
||||||
noFilmFound = No film with this title found!
|
noFilmFound = No film with this title found!
|
||||||
vlcNotInstalled = VLC Media Player is required to play a movie!
|
vlcNotInstalled = VLC Media Player is required to play a movie!
|
||||||
infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
|
infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016-2018 Kellerkinder www.kellerkinder.xyz
|
||||||
|
|
||||||
#textFlow translations
|
#textFlow translations
|
||||||
title = Title
|
title = Title
|
||||||
|
|
Loading…
Reference in New Issue