alert fixes

This commit is contained in:
sirjonasxx 2022-02-16 01:46:44 +01:00
parent 7993790b90
commit c294b92d77
4 changed files with 18 additions and 7 deletions

View File

@ -13,6 +13,7 @@ import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType; import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
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;
@ -106,9 +107,10 @@ public class ProxyProviderFactory {
} }
Platform.runLater(() -> { Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.ERROR, "G-Earth is already connected to this hotel. " + Alert alert = new Alert(Alert.AlertType.ERROR, "", ButtonType.OK);
alert.getDialogPane().getChildren().add(new Label("G-Earth is already connected to this hotel.\n" +
"Due to current limitations you can only connect one session per hotel to G-Earth in Raw IP mode on Windows.\n\n" + "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); "You can bypass this by using a SOCKS proxy [Extra -> Advanced -> SOCKS]"));
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.setResizable(false); alert.setResizable(false);
try { try {

View File

@ -15,6 +15,7 @@ import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType; import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
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;
@ -124,7 +125,8 @@ public abstract class FlashProxyProvider implements ProxyProvider {
protected void showInvalidConnectionError() { protected void showInvalidConnectionError() {
Platform.runLater(() -> { Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.ERROR, "You entered invalid connection information, G-Earth could not connect", ButtonType.OK); Alert alert = new Alert(Alert.AlertType.ERROR, "", ButtonType.OK);
alert.getDialogPane().getChildren().add(new Label("You entered invalid connection information, G-Earth could not connect"));
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.setResizable(false); alert.setResizable(false);
try { try {

View File

@ -9,6 +9,7 @@ import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType; import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.stage.Stage; import javafx.stage.Stage;
import org.littleshoot.proxy.HttpProxyServer; import org.littleshoot.proxy.HttpProxyServer;
@ -53,12 +54,14 @@ public class NitroHttpProxy {
Platform.runLater(() -> { Platform.runLater(() -> {
Alert alert = ConfirmationDialog.createAlertWithOptOut(Alert.AlertType.WARNING, ADMIN_WARNING_KEY, Alert alert = ConfirmationDialog.createAlertWithOptOut(Alert.AlertType.WARNING, ADMIN_WARNING_KEY,
"Root certificate installation", null, "Root certificate installation", null,
"G-Earth detected that you do not have the root certificate authority installed. " + "", "Remember my choice",
"This is required for Nitro to work, do you want to continue? " +
"G-Earth will ask you for Administrator permission if you do so.", "Remember my choice",
ButtonType.YES, ButtonType.NO ButtonType.YES, ButtonType.NO
); );
alert.getDialogPane().setContent(new Label("G-Earth detected that you do not have the root certificate authority installed.\n" +
"This is required for Nitro to work, do you want to continue?\n" +
"G-Earth will ask you for Administrator permission if you do so."));
try { try {
shouldInstall.set(TitleBarController.create(alert).showAlertAndWait() shouldInstall.set(TitleBarController.create(alert).showAlertAndWait()
.filter(t -> t == ButtonType.YES).isPresent()); .filter(t -> t == ButtonType.YES).isPresent());

View File

@ -6,6 +6,7 @@ import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType; import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
@ -68,10 +69,13 @@ public class Authenticator {
Platform.runLater(() -> { Platform.runLater(() -> {
Alert alert = ConfirmationDialog.createAlertWithOptOut(Alert.AlertType.WARNING, connectExtensionKey Alert alert = ConfirmationDialog.createAlertWithOptOut(Alert.AlertType.WARNING, connectExtensionKey
,"Confirmation Dialog", null, ,"Confirmation Dialog", null,
"Extension \""+extension.getTitle()+"\" tries to connect but isn't known to G-Earth, accept this connection?", "Remember my choice", "", "Remember my choice",
ButtonType.YES, ButtonType.NO ButtonType.YES, ButtonType.NO
); );
alert.getDialogPane().setContent(new Label("Extension \""+extension.getTitle()+"\" tries to connect but isn't known to G-Earth,\n" +
"accept this connection?"));
try { try {
if (!(TitleBarController.create(alert).showAlertAndWait() if (!(TitleBarController.create(alert).showAlertAndWait()
.filter(t -> t == ButtonType.YES).isPresent())) { .filter(t -> t == ButtonType.YES).isPresent())) {