From d02e17092994e5cb686757ad3d1fe0110630ad9e Mon Sep 17 00:00:00 2001 From: WiredSpast Date: Sat, 12 Feb 2022 05:17:29 +0100 Subject: [PATCH] Renamed all Main instances to GEarth --- G-Earth/src/main/java/gearth/misc/AdminValidator.java | 8 +++----- G-Earth/src/main/java/gearth/misc/ConfirmationDialog.java | 6 +++--- .../protocol/connection/proxy/ProxyProviderFactory.java | 7 +++---- .../connection/proxy/flash/FlashProxyProvider.java | 6 +++--- .../connection/proxy/flash/NormalFlashProxyProvider.java | 6 +++--- .../connection/proxy/nitro/http/NitroHttpProxy.java | 6 +++--- 6 files changed, 18 insertions(+), 21 deletions(-) diff --git a/G-Earth/src/main/java/gearth/misc/AdminValidator.java b/G-Earth/src/main/java/gearth/misc/AdminValidator.java index f722610..338b89f 100644 --- a/G-Earth/src/main/java/gearth/misc/AdminValidator.java +++ b/G-Earth/src/main/java/gearth/misc/AdminValidator.java @@ -1,16 +1,14 @@ package gearth.misc; -import gearth.Main; +import gearth.GEarth; import javafx.application.Platform; 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 javafx.stage.StageStyle; import java.io.PrintStream; -import java.util.Objects; import java.util.prefs.Preferences; /** @@ -50,8 +48,8 @@ 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(Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", Main.theme)))); - stage.getScene().getStylesheets().add(Main.class.getResource(String.format("/gearth/themes/%s/styling.css", Main.theme)).toExternalForm()); + stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme)))); + stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm()); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alert.setResizable(false); alert.show(); diff --git a/G-Earth/src/main/java/gearth/misc/ConfirmationDialog.java b/G-Earth/src/main/java/gearth/misc/ConfirmationDialog.java index 9eda8e3..d607e04 100644 --- a/G-Earth/src/main/java/gearth/misc/ConfirmationDialog.java +++ b/G-Earth/src/main/java/gearth/misc/ConfirmationDialog.java @@ -1,6 +1,6 @@ package gearth.misc; -import gearth.Main; +import gearth.GEarth; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.control.Alert; @@ -27,8 +27,8 @@ public class ConfirmationDialog { // Need to force the alert to layout in order to grab the graphic, // as we are replacing the dialog pane with a custom pane Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); - stage.getIcons().add(new Image(Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", Main.theme)))); - stage.getScene().getStylesheets().add(Main.class.getResource(String.format("/gearth/themes/%s/styling.css", Main.theme)).toExternalForm()); + stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme)))); + stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm()); alert.getDialogPane().applyCss(); Node graphic = alert.getDialogPane().getGraphic(); // Create a new dialog pane that has a checkbox instead of the hide/show details button diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java index ca97554..da9f8b7 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java @@ -1,13 +1,12 @@ package gearth.protocol.connection.proxy; -import gearth.Main; +import gearth.GEarth; import gearth.misc.Cacher; import gearth.misc.OSValidator; import gearth.protocol.HConnection; import gearth.protocol.connection.HProxySetter; import gearth.protocol.connection.HStateSetter; import gearth.protocol.connection.proxy.flash.NormalFlashProxyProvider; -import gearth.protocol.connection.proxy.flash.FlashProxyProvider; import gearth.protocol.connection.proxy.flash.unix.LinuxRawIpFlashProxyProvider; import gearth.protocol.connection.proxy.flash.windows.WindowsRawIpFlashProxyProvider; import javafx.application.Platform; @@ -110,8 +109,8 @@ public class ProxyProviderFactory { "Due to current limitations you can only connect one session per hotel to G-Earth in Raw IP mode on Windows.\n\n" + "You can bypass this by using a SOCKS proxy [Extra -> Advanced -> SOCKS]", ButtonType.OK); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); - stage.getIcons().add(new Image(Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", Main.theme)))); - stage.getScene().getStylesheets().add(Main.class.getResource(String.format("/gearth/themes/%s/styling.css", Main.theme)).toExternalForm()); + stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme)))); + stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm()); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alert.setResizable(false); alert.show(); diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/flash/FlashProxyProvider.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/flash/FlashProxyProvider.java index bb1e9da..8740163 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/flash/FlashProxyProvider.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/flash/FlashProxyProvider.java @@ -1,6 +1,6 @@ package gearth.protocol.connection.proxy.flash; -import gearth.Main; +import gearth.GEarth; import gearth.protocol.HConnection; import gearth.protocol.connection.HProxy; import gearth.protocol.connection.HProxySetter; @@ -125,8 +125,8 @@ public abstract class FlashProxyProvider implements ProxyProvider { Platform.runLater(() -> { Alert alert = new Alert(Alert.AlertType.ERROR, "You entered invalid connection information, G-Earth could not connect", ButtonType.OK); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); - stage.getIcons().add(new Image(Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", Main.theme)))); - stage.getScene().getStylesheets().add(Main.class.getResource(String.format("/gearth/themes/%s/styling.css", Main.theme)).toExternalForm()); + stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme)))); + stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm()); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alert.setResizable(false); alert.show(); diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/flash/NormalFlashProxyProvider.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/flash/NormalFlashProxyProvider.java index f42e56d..4cf7b5f 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/flash/NormalFlashProxyProvider.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/flash/NormalFlashProxyProvider.java @@ -1,6 +1,6 @@ package gearth.protocol.connection.proxy.flash; -import gearth.Main; +import gearth.GEarth; import gearth.misc.Cacher; import gearth.protocol.HConnection; import gearth.protocol.connection.*; @@ -110,8 +110,8 @@ public class NormalFlashProxyProvider extends FlashProxyProvider { Alert a = new Alert(Alert.AlertType.ERROR, "The port is in use by " + processName, ButtonType.OK); Stage stage = (Stage) a.getDialogPane().getScene().getWindow(); - stage.getIcons().add(new Image(Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", Main.theme)))); - stage.getScene().getStylesheets().add(Main.class.getResource(String.format("/gearth/themes/%s/styling.css", Main.theme)).toExternalForm()); + stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme)))); + stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm()); a.showAndWait(); }); throw new IOException(e); diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/http/NitroHttpProxy.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/http/NitroHttpProxy.java index 5ef2218..ad9f575 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/http/NitroHttpProxy.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/http/NitroHttpProxy.java @@ -1,6 +1,6 @@ package gearth.protocol.connection.proxy.nitro.http; -import gearth.Main; +import gearth.GEarth; import gearth.misc.ConfirmationDialog; import gearth.protocol.connection.proxy.nitro.NitroConstants; import gearth.protocol.connection.proxy.nitro.os.NitroOsFunctions; @@ -57,8 +57,8 @@ public class NitroHttpProxy { ButtonType.YES, ButtonType.NO ); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); - stage.getIcons().add(new Image(Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", Main.theme)))); - stage.getScene().getStylesheets().add(Main.class.getResource(String.format("/gearth/themes/%s/styling.css", Main.theme)).toExternalForm()); + stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme)))); + stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm()); shouldInstall.set(alert.showAndWait().filter(t -> t == ButtonType.YES).isPresent()); waitForDialog.release();