Skip to content

Commit

Permalink
Fixed the missing darkmode ,and the about menu bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Eng-Ziad7 committed Aug 20, 2024
1 parent db97f2f commit 92a495c
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 15 deletions.
4 changes: 3 additions & 1 deletion GUI/src/main/java/ui/ConfirmationDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ enum State {
private final State state;
private final String lf = System.lineSeparator();
private static Button btnNo;
private static Button btnOk;
private static Button btnYes;
private double width = 200;
private double height = 150;
Expand Down Expand Up @@ -113,7 +114,7 @@ private void createControls() {
answer.setAnswer(false);
stage.close();
});
Button btnOk = newButton("OK", e -> stage.close());
btnOk = newButton("OK", e -> stage.close());
TextField tfFilename = new TextField(filename);
tfFilename.setMinWidth(width * .4);
tfFilename.setMaxWidth(width * .8);
Expand Down Expand Up @@ -155,6 +156,7 @@ private void showScene() {
Theme.applyTheme("Dark", scene);
Theme.changeButtonStyle(true, btnYes);
Theme.changeButtonStyle(true, btnNo);
Theme.changeButtonStyle(true , btnOk);
} else {
Theme.applyTheme("Light", scene);
}
Expand Down
23 changes: 20 additions & 3 deletions GUI/src/main/java/ui/ManageFolders.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import javafx.collections.ObservableList;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.layout.HBox;
Expand All @@ -16,13 +17,24 @@

public class ManageFolders {
private Stage stage;

public static Scene scene;
private final double width = 400;
private final double height = 550;
private final Folders folders;
private VBox vBox;
private ListView<String> lvFolders;
private javafx.scene.control.Button btnRemove;
private javafx.scene.control.Button btnClose;

public static Button getBtnRemove() {
return btnRemove;
}

public static Button getBtnClose() {
return btnClose;
}

private static javafx.scene.control.Button btnRemove;
private static javafx.scene.control.Button btnClose;

public ManageFolders() {
this.folders = AppSettings.GET.folders();
Expand Down Expand Up @@ -87,7 +99,12 @@ private void setControls() {

public void showScene() {
stage = new Stage();
Scene scene = Constants.getScene(vBox);
scene = Constants.getScene(vBox);
if (AppSettings.GET.mainTheme().equals("Dark")) {
Constants.addCSS(scene, Constants.DARK_THEME_CSS);
Theme.changeButtonStyle(true, ManageFolders.getBtnClose());
Theme.changeButtonStyle(true, ManageFolders.getBtnRemove());
}
stage.setScene(scene);
stage.setWidth(width);
stage.setHeight(height);
Expand Down
2 changes: 1 addition & 1 deletion GUI/src/main/java/ui/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private void setupThemeChoice() {
themeChoiceBox = new ChoiceBox<>();
themeChoiceBox.getItems().addAll("Dark Theme", "Light Theme");
themeChoiceBox.setValue(AppSettings.GET.mainTheme().equals("Dark") ? "Dark Theme" : "Light Theme");
themeChoiceBox.setOnAction(e -> Theme.applyTheme(themeChoiceBox.getValue().equals("Dark Theme") ? "Dark" : "Light", settingsScene, Drifty_GUI.getScene(), About.getScene(), UIController.getInfoScene(), ConfirmationDialog.getScene()));
themeChoiceBox.setOnAction(e -> Theme.applyTheme(themeChoiceBox.getValue().equals("Dark Theme") ? "Dark" : "Light", settingsScene, Drifty_GUI.getScene(), About.getScene(), UIController.getInfoScene(), ConfirmationDialog.getScene(), ManageFolders.scene));
}

private void createAutoPasteCheck() {
Expand Down
2 changes: 2 additions & 0 deletions GUI/src/main/java/ui/Theme.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ private static void updateButtonStyles(boolean isDark, String theme) {
changeButtonStyle(isDark, Settings.getSelectDirectoryButton());
changeButtonStyle(isDark, ConfirmationDialog.getBtnYes());
changeButtonStyle(isDark, ConfirmationDialog.getBtnNo());
changeButtonStyle(isDark, ManageFolders.getBtnClose());
changeButtonStyle(isDark, ManageFolders.getBtnRemove());
setupButtonGraphics(theme);
}

Expand Down
37 changes: 27 additions & 10 deletions GUI/src/main/java/ui/UIController.java
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ private ContextMenu getListMenu() {
M.msgFilenameInfo("");
M.msgDirInfo("");
});
miInfo.setOnAction(e -> help());
miInfo.setOnAction(e -> Helpshow());
return new ContextMenu(miDel, miClear, separator, miInfo);
}

Expand Down Expand Up @@ -781,6 +781,7 @@ private void commitJobListToListView() {
});
}

Stage Helpstage;
private void help() {
Color textColor = AppSettings.GET.mainTheme().equals("Dark") ? Color.WHITE : Color.BLACK;
Color headingsColor = AppSettings.GET.mainTheme().equals("Dark") ? Color.LIGHTGREEN : Color.DARKBLUE;
Expand Down Expand Up @@ -810,12 +811,17 @@ private void help() {
INFO_TF.getChildren().add(text("Another thing you can do is grab a YouTube playlist and Drifty will extract all of the videos from the playlist and build a batch from the list (or add to your existing batch).\n\n", false, textColor, n));
INFO_TF.setStyle("-fx-background-color: transparent");


Helpstage = Constants.getStage("Help", false);

double width = 500;
double height = 700;
Button btnOK = new Button("OK");
Stage stage = Constants.getStage("Help", false);
stage.setWidth(width);
stage.setHeight(height + 100);



Helpstage.setWidth(width);
Helpstage.setHeight(height + 100);
VBox vox = new VBox(20, INFO_TF);
vox.setPrefWidth(width - 35);
vox.setPrefHeight(height - 75);
Expand All @@ -834,16 +840,27 @@ private void help() {
}

infoScene.setFill(Color.TRANSPARENT);
stage.setScene(infoScene);
stage.setAlwaysOnTop(true);
stage.setTitle("Help");
stage.setOnCloseRequest(e -> stage.close());
Helpstage.setScene(infoScene);
Helpstage.setAlwaysOnTop(true);
Helpstage.setTitle("Help");
Helpstage.setOnCloseRequest(e -> Helpstage.close());
VBox.setVgrow(vox, Priority.ALWAYS);
VBox.setVgrow(INFO_TF, Priority.ALWAYS);
btnOK.setOnAction(e -> stage.close());
btnOK.setOnAction(e -> Helpstage.close());
scrollPane.setVvalue(0.0);
stage.showAndWait();
Helpstage.showAndWait();
}
public void Helpshow(){
if (Helpstage != null && Helpstage.isShowing()) {
Helpstage.toFront();
} else {
help();
}
}
private void initializeHelpComponents(){

}


private Text text(String string, boolean bold, Color color, double size) {
// This is used by the help() method for custom text formatting
Expand Down

0 comments on commit 92a495c

Please sign in to comment.