This commit is contained in:
sirjonasxx 2022-02-13 05:34:37 +01:00
parent 767fb1ab9b
commit f4ee6f00c8
8 changed files with 45 additions and 19 deletions

View File

@ -19,13 +19,12 @@ import javafx.stage.StageStyle;
public class GEarth extends Application { public class GEarth extends Application {
public static Application main; public static GEarth main;
public static String version = "1.5.1"; public static String version = "1.5.1";
public static String gitApi = "https://api.github.com/repos/sirjonasxx/G-Earth/releases/latest"; public static String gitApi = "https://api.github.com/repos/sirjonasxx/G-Earth/releases/latest";
public static Theme theme; public static Theme theme;
private Stage stage; private Stage stage;
private TitleBarController titleBar;
private GEarthController controller; private GEarthController controller;
static { static {
@ -49,7 +48,7 @@ public class GEarth extends Application {
stage.initStyle(StageStyle.TRANSPARENT); stage.initStyle(StageStyle.TRANSPARENT);
primaryStage.setScene(new Scene(root)); primaryStage.setScene(new Scene(root));
titleBar = TitleBarController.create(primaryStage, new TitleBarConfig() { TitleBarController.create(primaryStage, new TitleBarConfig() {
@Override @Override
public boolean displayThemePicker() { public boolean displayThemePicker() {
return true; return true;

View File

@ -1,13 +1,18 @@
package gearth.misc; package gearth.misc;
import gearth.GEarth; import gearth.GEarth;
import gearth.ui.titlebar.DefaultTitleBarConfig;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType; import javafx.scene.control.ButtonType;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.layout.Region; import javafx.scene.layout.Region;
import javafx.stage.Stage; import javafx.stage.Stage;
import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
@ -48,11 +53,33 @@ public class AdminValidator {
Platform.runLater(() -> { 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); 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 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.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)).toExternalForm()); stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/ui/themes/%s/styling.css", GEarth.theme.internalName())).toExternalForm());
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); // try {
alert.setResizable(false); // TitleBarController.create(stage, new DefaultTitleBarConfig(stage));
alert.show(); // } 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();
}); });
} }

View File

@ -26,8 +26,8 @@ public class GExtensionStoreLauncher extends InternalExtensionFormLauncher<GExte
stage.setHeight(530); stage.setHeight(530);
stage.setScene(new Scene(root)); stage.setScene(new Scene(root));
stage.getScene().getStylesheets().add(GEarthController.class.getResource(String.format("/gearth/ui/themes/%s/styling.css", GEarth.theme)).toExternalForm()); stage.getScene().getStylesheets().add(GEarthController.class.getResource("/gearth/ui/themes/G-Earth/styling.css").toExternalForm());
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/ui/themes/%s/logoSmall.png", GEarth.theme)))); stage.getIcons().add(new Image(GEarth.class.getResourceAsStream("/gearth/ui/themes/G-Earth/logoSmall.png")));
GExtensionStore gExtensionStore = new GExtensionStore(); GExtensionStore gExtensionStore = new GExtensionStore();

View File

@ -17,12 +17,12 @@ public class UiLoggerLauncher extends InternalExtensionFormLauncher<UiLogger> {
FXMLLoader loader = new FXMLLoader(UiLogger.class.getResource("UiLogger.fxml")); FXMLLoader loader = new FXMLLoader(UiLogger.class.getResource("UiLogger.fxml"));
Parent root = loader.load(); Parent root = loader.load();
stage.setTitle(String.format("%s | Packet Logger", GEarth.theme)); stage.setTitle("G-Earth | Packet Logger");
stage.initModality(Modality.NONE); 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 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"); scene.getStylesheets().add("/gearth/services/internal_extensions/uilogger/logger.css");
UiLoggerController controller = loader.getController(); UiLoggerController controller = loader.getController();

View File

@ -49,7 +49,7 @@ public class ExtensionLogger {
controller.setStage(stage); controller.setStage(stage);
stage.setScene(scene); stage.setScene(scene);
TitleBarController titleBar = TitleBarController.create(stage, new DefaultTitleBarConfig(stage) { TitleBarController.create(stage, new DefaultTitleBarConfig(stage) {
@Override @Override
public void onCloseClicked() { public void onCloseClicked() {
stage.hide(); stage.hide();

View File

@ -27,7 +27,7 @@ public class DefaultTitleBarConfig implements TitleBarConfig {
@Override @Override
public void onCloseClicked() { public void onCloseClicked() {
stage.close();
} }
@Override @Override

View File

@ -57,7 +57,7 @@
.info > .label, .info > .label,
.warning > .label, .warning > .label,
.danger > .label { .danger > .label {
-fx-text-fill: white; -fx-text-fill: black;
} }
.action-btn { .action-btn {
@ -689,7 +689,7 @@ VBox > .split-menu-button.last > .arrow-button {
} }
.titled-pane.primary { .titled-pane.primary {
-fx-text-fill: white; -fx-text-fill: black;
} }
.titled-pane.primary > .title { .titled-pane.primary > .title {

View File

@ -59,7 +59,7 @@
.info > .label, .info > .label,
.warning > .label, .warning > .label,
.danger > .label { .danger > .label {
-fx-text-fill: white; -fx-text-fill: black;
} }
.action-btn { .action-btn {
@ -691,7 +691,7 @@ VBox > .split-menu-button.last > .arrow-button {
} }
.titled-pane.primary { .titled-pane.primary {
-fx-text-fill: white; -fx-text-fill: black;
} }
.titled-pane.primary > .title { .titled-pane.primary > .title {