Material styled dialogs

* added material styled dialogs
This commit is contained in:
Jannik
2017-08-01 20:11:17 +02:00
parent a30def1fd0
commit e394b1a573
12 changed files with 78 additions and 26 deletions
+1
View File
@@ -22,5 +22,6 @@
<classpathentry kind="lib" path="src/libraries/junrar-0.7.jar"/> <classpathentry kind="lib" path="src/libraries/junrar-0.7.jar"/>
<classpathentry kind="lib" path="src/libraries/commons-logging-api-1.1.jar"/> <classpathentry kind="lib" path="src/libraries/commons-logging-api-1.1.jar"/>
<classpathentry kind="lib" path="src/libraries/commons-vfs2-2.1.1744488.2.jar"/> <classpathentry kind="lib" path="src/libraries/commons-vfs2-2.1.1744488.2.jar"/>
<classpathentry kind="lib" path="/home/jannik/Downloads/flow-8.0.1.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4 -2
View File
@@ -37,6 +37,8 @@ public class Main extends Application {
Stage primaryStage; Stage primaryStage;
public MainWindowController mainWindowController; //TODO find a better way public MainWindowController mainWindowController; //TODO find a better way
CloudController cloudController; CloudController cloudController;
AnchorPane pane;
private Scene scene;
private String dirWin = System.getProperty("user.home") + "/Documents/cemu_UI"; //Windows: C:/Users/"User"/Documents/HomeFlix private String dirWin = System.getProperty("user.home") + "/Documents/cemu_UI"; //Windows: C:/Users/"User"/Documents/HomeFlix
private String dirLinux = System.getProperty("user.home") + "/cemu_UI"; //Linux: /home/"User"/HomeFlix private String dirLinux = System.getProperty("user.home") + "/cemu_UI"; //Linux: /home/"User"/HomeFlix
private String gamesDBdownloadURL = "https://github.com/Seil0/cemu_UI/raw/master/downloadContent/games.db"; private String gamesDBdownloadURL = "https://github.com/Seil0/cemu_UI/raw/master/downloadContent/games.db";
@@ -58,7 +60,7 @@ public class Main extends Application {
private void mainWindow(){ private void mainWindow(){
try { try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml")); FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml"));
AnchorPane pane = loader.load(); pane = loader.load();
primaryStage.setResizable(false); primaryStage.setResizable(false);
primaryStage.setTitle("cemu_UI"); primaryStage.setTitle("cemu_UI");
// primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/resources/Homeflix_Icon_64x64.png"))); //adds application icon // primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/resources/Homeflix_Icon_64x64.png"))); //adds application icon
@@ -129,7 +131,7 @@ public class Main extends Application {
mainWindowController.initActions(); mainWindowController.initActions();
mainWindowController.initUI(); mainWindowController.initUI();
Scene scene = new Scene(pane); //create new scene, append pane to scene scene = new Scene(pane); //create new scene, append pane to scene
scene.getStylesheets().add(Main.class.getResource("MainWindows.css").toExternalForm()); scene.getStylesheets().add(Main.class.getResource("MainWindows.css").toExternalForm());
primaryStage.setScene(scene); //append scene to stage primaryStage.setScene(scene); //append scene to stage
primaryStage.show(); //show stage primaryStage.show(); //show stage
+71 -22
View File
@@ -46,6 +46,8 @@ import com.github.junrar.impl.FileVolumeManager;
import com.github.junrar.rarfile.FileHeader; import com.github.junrar.rarfile.FileHeader;
import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXColorPicker; import com.jfoenix.controls.JFXColorPicker;
import com.jfoenix.controls.JFXDialog;
import com.jfoenix.controls.JFXDialogLayout;
import com.jfoenix.controls.JFXHamburger; import com.jfoenix.controls.JFXHamburger;
import com.jfoenix.controls.JFXTextField; import com.jfoenix.controls.JFXTextField;
import com.jfoenix.controls.JFXToggleButton; import com.jfoenix.controls.JFXToggleButton;
@@ -82,6 +84,7 @@ import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import javafx.scene.paint.Paint; import javafx.scene.paint.Paint;
@@ -212,6 +215,7 @@ public class MainWindowController {
private String selectedGameTitleID; private String selectedGameTitleID;
private String selectedGameTitle; private String selectedGameTitle;
private String color; private String color;
private String dialogBtnStyle;
private String version = "0.1.6"; private String version = "0.1.6";
private String buildNumber = "027"; private String buildNumber = "027";
private String versionName = "Throwback Galaxy"; private String versionName = "Throwback Galaxy";
@@ -573,12 +577,28 @@ public class MainWindowController {
@FXML @FXML
void aboutBtnAction(){ void aboutBtnAction(){
Alert alert = new Alert(AlertType.INFORMATION); JFXDialogLayout content= new JFXDialogLayout();
alert.setTitle("about"); content.setHeading(new Text("cemu_UI"));
alert.setHeaderText("cemu_UI"); content.setBody(new Text("cemu_UI by @Seil0 \nVersion: "+version+" ("+buildNumber+") \""+versionName+"\" \nThis Application is made with free Software\nwww.kellerkinder.xyz"));
alert.setContentText("cemu_UI by @Seil0 \nVersion: "+version+" ("+buildNumber+") \""+versionName+"\" \nwww.kellerkinder.xyz"); content.setPrefSize(350, 170);
alert.initOwner(main.primaryStage); StackPane stackPane = new StackPane();
alert.showAndWait(); 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);
main.pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (main.pane.getHeight()-content.getPrefHeight())/2);
AnchorPane.setLeftAnchor(stackPane, (main.pane.getWidth()-content.getPrefWidth())/2);
dialog.show();
} }
@FXML @FXML
@@ -778,24 +798,49 @@ public class MainWindowController {
if(cloudSync) { if(cloudSync) {
cloudSync = false; cloudSync = false;
} else { } else {
Alert cloudWarningAlert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
cloudWarningAlert.setTitle("cemu_UI");
cloudWarningAlert.setHeaderText("activate cloud savegame sync (beta)");
cloudWarningAlert.setContentText("You just activate the cloud savegame sync function of cemu_UI which is currently in beta. Are you sure you want to do this?");
cloudWarningAlert.initOwner(main.primaryStage);
Optional<ButtonType> coverResult = cloudWarningAlert.showAndWait();
if (coverResult.get() == ButtonType.OK){
cloudSync = true;
//TODO rework for other cloud services
cloudService = "GoogleDrive";
main.cloudController.initializeConnection(getCloudService(), getCemuPath());
main.cloudController.sync(getCloudService(), getCemuPath());
} else {
cloudSyncToggleBtn.setSelected(false);
}
JFXDialogLayout content= new JFXDialogLayout();
content.setHeading(new Text("activate cloud savegame sync (beta)"));
content.setBody(new Text("You just activate the cloud savegame sync function of cemu_UI, \nwhich is currently in beta. Are you sure you want to do this?"));
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton okayBtn = new JFXButton("Okay");
okayBtn.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event){
cloudSync = true;
//TODO rework for other cloud services
cloudService = "GoogleDrive";
main.cloudController.initializeConnection(getCloudService(), getCemuPath());
main.cloudController.sync(getCloudService(), getCemuPath());
saveSettings();
dialog.close();
}
});
JFXButton cancelBtn = new JFXButton("Cancel");
cancelBtn.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event){
cloudSyncToggleBtn.setSelected(false);
dialog.close();
}
});
Label placeholder = new Label();
placeholder.setPrefSize(15, 10);
okayBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
okayBtn.setPrefHeight(32);
cancelBtn.setPrefHeight(32);
okayBtn.setStyle(dialogBtnStyle);
cancelBtn.setStyle(dialogBtnStyle);
content.setActions(cancelBtn, placeholder, okayBtn);
content.setPrefSize(419, 140);
main.pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (main.pane.getHeight()-content.getPrefHeight())/2);
AnchorPane.setLeftAnchor(stackPane, (main.pane.getWidth()-content.getPrefWidth())/2);
dialog.show();
} }
saveSettings();
} }
@FXML @FXML
@@ -1125,6 +1170,8 @@ public class MainWindowController {
romTextField.setFocusColor(Color.valueOf(getColor())); romTextField.setFocusColor(Color.valueOf(getColor()));
if(icolor.compareTo(ccolor) == -1){ if(icolor.compareTo(ccolor) == -1){
dialogBtnStyle = btnStyleWhite;
aboutBtn.setStyle("-fx-text-fill: WHITE;"); aboutBtn.setStyle("-fx-text-fill: WHITE;");
settingsBtn.setStyle("-fx-text-fill: WHITE;"); settingsBtn.setStyle("-fx-text-fill: WHITE;");
addBtn.setStyle("-fx-text-fill: WHITE;"); addBtn.setStyle("-fx-text-fill: WHITE;");
@@ -1144,6 +1191,8 @@ public class MainWindowController {
menuHam.getStyleClass().add("jfx-hamburgerW"); menuHam.getStyleClass().add("jfx-hamburgerW");
}else{ }else{
dialogBtnStyle = btnStyleBlack;
aboutBtn.setStyle("-fx-text-fill: BLACK;"); aboutBtn.setStyle("-fx-text-fill: BLACK;");
settingsBtn.setStyle("-fx-text-fill: BLACK;"); settingsBtn.setStyle("-fx-text-fill: BLACK;");
addBtn.setStyle("-fx-text-fill: BLACK;"); addBtn.setStyle("-fx-text-fill: BLACK;");