mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-10-02 18:17:27 +13:00
Set proper terminal default value
This commit is contained in:
parent
4b30bed0a8
commit
49de9b8a97
2 changed files with 17 additions and 29 deletions
|
@ -74,15 +74,6 @@ public class AppWindowHelper {
|
||||||
childStage.setY(stage.getY() + stage.getHeight() / 2 - childStage.getHeight() / 2);
|
childStage.setY(stage.getY() + stage.getHeight() / 2 - childStage.getHeight() / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showAlert(Alert a, Consumer<Optional<ButtonType>> bt) {
|
|
||||||
ThreadHelper.runAsync(() -> {
|
|
||||||
var r = showBlockingAlert(a);
|
|
||||||
if (bt != null) {
|
|
||||||
bt.accept(r);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showAlert(Consumer<Alert> c, Consumer<Optional<ButtonType>> bt) {
|
public static void showAlert(Consumer<Alert> c, Consumer<Optional<ButtonType>> bt) {
|
||||||
ThreadHelper.runAsync(() -> {
|
ThreadHelper.runAsync(() -> {
|
||||||
var r = showBlockingAlert(c);
|
var r = showBlockingAlert(c);
|
||||||
|
@ -108,11 +99,15 @@ public class AppWindowHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Optional<ButtonType> showBlockingAlert(Alert a) {
|
public static Optional<ButtonType> showBlockingAlert(Consumer<Alert> c) {
|
||||||
AtomicReference<Optional<ButtonType>> result = new AtomicReference<>();
|
AtomicReference<Optional<ButtonType>> result = new AtomicReference<>();
|
||||||
if (!Platform.isFxApplicationThread()) {
|
if (!Platform.isFxApplicationThread()) {
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
Alert a = AppWindowHelper.createEmptyAlert();
|
||||||
|
AppFont.normal(a.getDialogPane());
|
||||||
|
|
||||||
|
c.accept(a);
|
||||||
result.set(a.showAndWait());
|
result.set(a.showAndWait());
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
});
|
});
|
||||||
|
@ -121,6 +116,10 @@ public class AppWindowHelper {
|
||||||
} catch (InterruptedException ignored) {
|
} catch (InterruptedException ignored) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Alert a = createEmptyAlert();
|
||||||
|
AppFont.normal(a.getDialogPane());
|
||||||
|
c.accept(a);
|
||||||
|
|
||||||
Button button = (Button) a.getDialogPane().lookupButton(ButtonType.OK);
|
Button button = (Button) a.getDialogPane().lookupButton(ButtonType.OK);
|
||||||
if (button != null) {
|
if (button != null) {
|
||||||
button.getStyleClass().add("ok-button");
|
button.getStyleClass().add("ok-button");
|
||||||
|
@ -131,13 +130,6 @@ public class AppWindowHelper {
|
||||||
return result.get();
|
return result.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Optional<ButtonType> showBlockingAlert(Consumer<Alert> c) {
|
|
||||||
Alert a = AppWindowHelper.createEmptyAlert();
|
|
||||||
AppFont.normal(a.getDialogPane());
|
|
||||||
c.accept(a);
|
|
||||||
return showBlockingAlert(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Alert createEmptyAlert() {
|
public static Alert createEmptyAlert() {
|
||||||
Alert alert = new Alert(Alert.AlertType.NONE);
|
Alert alert = new Alert(Alert.AlertType.NONE);
|
||||||
setIcon(alert);
|
setIcon(alert);
|
||||||
|
|
|
@ -12,16 +12,6 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class MacOsPermissions {
|
public class MacOsPermissions {
|
||||||
|
|
||||||
private static Alert createAlert() {
|
|
||||||
var alert = AppWindowHelper.createEmptyAlert();
|
|
||||||
alert.setAlertType(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setTitle(I18n.get("permissionsAlertTitle"));
|
|
||||||
alert.setHeaderText(I18n.get("permissionsAlertTitleHeader"));
|
|
||||||
alert.getDialogPane().setContent(AppWindowHelper.alertContentText(I18n.get("permissionsAlertTitleContent")));
|
|
||||||
alert.getButtonTypes().clear();
|
|
||||||
return alert;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean waitForAccessibilityPermissions() throws Exception {
|
public static boolean waitForAccessibilityPermissions() throws Exception {
|
||||||
AtomicReference<Alert> alert = new AtomicReference<>();
|
AtomicReference<Alert> alert = new AtomicReference<>();
|
||||||
var state = new SimpleBooleanProperty(true);
|
var state = new SimpleBooleanProperty(true);
|
||||||
|
@ -42,8 +32,14 @@ public class MacOsPermissions {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
alert.set(createAlert());
|
AppWindowHelper.showAlert(a -> {
|
||||||
AppWindowHelper.showAlert(alert.get(), buttonType -> {
|
a.setAlertType(Alert.AlertType.INFORMATION);
|
||||||
|
a.setTitle(I18n.get("permissionsAlertTitle"));
|
||||||
|
a.setHeaderText(I18n.get("permissionsAlertTitleHeader"));
|
||||||
|
a.getDialogPane().setContent(AppWindowHelper.alertContentText(I18n.get("permissionsAlertTitleContent")));
|
||||||
|
a.getButtonTypes().clear();
|
||||||
|
alert.set(a);
|
||||||
|
}, buttonType -> {
|
||||||
alert.get().close();
|
alert.get().close();
|
||||||
if (buttonType.isEmpty() || !buttonType.get().getButtonData().isDefaultButton()) {
|
if (buttonType.isEmpty() || !buttonType.get().getButtonData().isDefaultButton()) {
|
||||||
state.set(false);
|
state.set(false);
|
||||||
|
|
Loading…
Reference in a new issue