diff --git a/G-Earth/src/main/java/gearth/GEarth.java b/G-Earth/src/main/java/gearth/GEarth.java index 22f3941..8b9537a 100644 --- a/G-Earth/src/main/java/gearth/GEarth.java +++ b/G-Earth/src/main/java/gearth/GEarth.java @@ -19,13 +19,12 @@ import javafx.stage.StageStyle; public class GEarth extends Application { - public static Application main; + public static GEarth main; public static String version = "1.5.1"; public static String gitApi = "https://api.github.com/repos/sirjonasxx/G-Earth/releases/latest"; public static Theme theme; private Stage stage; - private TitleBarController titleBar; private GEarthController controller; static { @@ -49,7 +48,7 @@ public class GEarth extends Application { stage.initStyle(StageStyle.TRANSPARENT); primaryStage.setScene(new Scene(root)); - titleBar = TitleBarController.create(primaryStage, new TitleBarConfig() { + TitleBarController.create(primaryStage, new TitleBarConfig() { @Override public boolean displayThemePicker() { return true; diff --git a/G-Earth/src/main/java/gearth/misc/AdminValidator.java b/G-Earth/src/main/java/gearth/misc/AdminValidator.java index a19e6d7..9f9eb74 100644 --- a/G-Earth/src/main/java/gearth/misc/AdminValidator.java +++ b/G-Earth/src/main/java/gearth/misc/AdminValidator.java @@ -1,13 +1,18 @@ package gearth.misc; import gearth.GEarth; +import gearth.ui.titlebar.DefaultTitleBarConfig; +import gearth.ui.titlebar.TitleBarController; import javafx.application.Platform; +import javafx.beans.InvalidationListener; +import javafx.beans.Observable; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; import javafx.scene.image.Image; import javafx.scene.layout.Region; import javafx.stage.Stage; +import java.io.IOException; import java.io.PrintStream; import java.util.prefs.Preferences; @@ -48,11 +53,33 @@ public class AdminValidator { Platform.runLater(() -> { Alert alert = new Alert(Alert.AlertType.WARNING, "G-Earth needs admin privileges in order to work on Flash, please restart G-Earth with admin permissions unless you're using Unity", ButtonType.OK); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); - stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/ui/themes/%s/logoSmall.png", GEarth.theme)))); - stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/ui/themes/%s/styling.css", GEarth.theme)).toExternalForm()); - alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); - alert.setResizable(false); - alert.show(); + stage.getIcons().add(new Image(GEarth.class.getResourceAsStream("/gearth/ui/themes/G-Earth/logoSmall.png"))); + stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/ui/themes/%s/styling.css", GEarth.theme.internalName())).toExternalForm()); +// try { +// TitleBarController.create(stage, new DefaultTitleBarConfig(stage)); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// alert.getDialogPane().setMaxHeight(-1); +// alert.getDialogPane().setMinHeight(200); +// alert.getDialogPane() +// +// +// boolean[] once = new boolean[]{false}; +// stage.heightProperty().addListener(observable -> { +// if (!once[0]) { +// once[0] = true; +// stage.setMinHeight(alert.getDialogPane().getHeight() + 25); +// stage.setHeight(alert.getDialogPane().getHeight() + 25); +// stage.setMaxHeight(alert.getDialogPane().getHeight() + 25); +// } +// +// }); + +// stage.setHeight(stage.getHeight() + 25); +// stage.setResizable(false); +// stage.sizeToScene();x + stage.show(); }); } diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/GExtensionStoreLauncher.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/GExtensionStoreLauncher.java index 42eda93..ed136f8 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/GExtensionStoreLauncher.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/GExtensionStoreLauncher.java @@ -26,8 +26,8 @@ public class GExtensionStoreLauncher extends InternalExtensionFormLauncher { FXMLLoader loader = new FXMLLoader(UiLogger.class.getResource("UiLogger.fxml")); Parent root = loader.load(); - stage.setTitle(String.format("%s | Packet Logger", GEarth.theme)); + stage.setTitle("G-Earth | Packet Logger"); stage.initModality(Modality.NONE); - stage.getIcons().add(new Image(getClass().getResourceAsStream(String.format("/gearth/ui/themes/%s/logoSmall.png", GEarth.theme)))); + stage.getIcons().add(new Image(getClass().getResourceAsStream("/gearth/ui/themes/G-Earth/logoSmall.png"))); Scene scene = new Scene(root); - scene.getStylesheets().add(String.format("/gearth/ui/themes/%s/styling.css", GEarth.theme)); + scene.getStylesheets().add("/gearth/ui/themes/G-Earth/styling.css"); scene.getStylesheets().add("/gearth/services/internal_extensions/uilogger/logger.css"); UiLoggerController controller = loader.getController(); diff --git a/G-Earth/src/main/java/gearth/ui/subforms/extensions/logger/ExtensionLogger.java b/G-Earth/src/main/java/gearth/ui/subforms/extensions/logger/ExtensionLogger.java index f2b5f90..e548b17 100644 --- a/G-Earth/src/main/java/gearth/ui/subforms/extensions/logger/ExtensionLogger.java +++ b/G-Earth/src/main/java/gearth/ui/subforms/extensions/logger/ExtensionLogger.java @@ -49,7 +49,7 @@ public class ExtensionLogger { controller.setStage(stage); stage.setScene(scene); - TitleBarController titleBar = TitleBarController.create(stage, new DefaultTitleBarConfig(stage) { + TitleBarController.create(stage, new DefaultTitleBarConfig(stage) { @Override public void onCloseClicked() { stage.hide(); diff --git a/G-Earth/src/main/java/gearth/ui/titlebar/DefaultTitleBarConfig.java b/G-Earth/src/main/java/gearth/ui/titlebar/DefaultTitleBarConfig.java index 2fed191..60703c0 100644 --- a/G-Earth/src/main/java/gearth/ui/titlebar/DefaultTitleBarConfig.java +++ b/G-Earth/src/main/java/gearth/ui/titlebar/DefaultTitleBarConfig.java @@ -27,7 +27,7 @@ public class DefaultTitleBarConfig implements TitleBarConfig { @Override public void onCloseClicked() { - + stage.close(); } @Override diff --git a/G-Earth/src/main/resources/gearth/ui/themes/G-Earth/styling.css b/G-Earth/src/main/resources/gearth/ui/themes/G-Earth/styling.css index 03e337a..247d66b 100644 --- a/G-Earth/src/main/resources/gearth/ui/themes/G-Earth/styling.css +++ b/G-Earth/src/main/resources/gearth/ui/themes/G-Earth/styling.css @@ -57,7 +57,7 @@ .info > .label, .warning > .label, .danger > .label { - -fx-text-fill: white; + -fx-text-fill: black; } .action-btn { @@ -689,7 +689,7 @@ VBox > .split-menu-button.last > .arrow-button { } .titled-pane.primary { - -fx-text-fill: white; + -fx-text-fill: black; } .titled-pane.primary > .title { diff --git a/G-Earth/src/main/resources/gearth/ui/themes/Tanji/styling.css b/G-Earth/src/main/resources/gearth/ui/themes/Tanji/styling.css index 9ae3974..96db9ba 100644 --- a/G-Earth/src/main/resources/gearth/ui/themes/Tanji/styling.css +++ b/G-Earth/src/main/resources/gearth/ui/themes/Tanji/styling.css @@ -59,7 +59,7 @@ .info > .label, .warning > .label, .danger > .label { - -fx-text-fill: white; + -fx-text-fill: black; } .action-btn { @@ -691,7 +691,7 @@ VBox > .split-menu-button.last > .arrow-button { } .titled-pane.primary { - -fx-text-fill: white; + -fx-text-fill: black; } .titled-pane.primary > .title {