From 7fd2e89c7793cd47ae982bfb23bd8957d17ea5be Mon Sep 17 00:00:00 2001 From: crschnick Date: Thu, 30 Mar 2023 10:06:25 +0000 Subject: [PATCH] Small fixes [release] --- .../io/xpipe/app/issue/ErrorHandlerComp.java | 39 ++++++++++++------- .../resources/lang/translations_en.properties | 1 + .../java/io/xpipe/core/process/OsType.java | 4 +- dist/changelogs/0.5.26.md | 4 ++ version | 2 +- 5 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 dist/changelogs/0.5.26.md diff --git a/app/src/main/java/io/xpipe/app/issue/ErrorHandlerComp.java b/app/src/main/java/io/xpipe/app/issue/ErrorHandlerComp.java index 7e00e0d4..3918d886 100644 --- a/app/src/main/java/io/xpipe/app/issue/ErrorHandlerComp.java +++ b/app/src/main/java/io/xpipe/app/issue/ErrorHandlerComp.java @@ -5,10 +5,13 @@ import io.xpipe.app.comp.base.TitledPaneComp; import io.xpipe.app.core.AppFont; import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.AppWindowHelper; +import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.SimpleComp; import io.xpipe.app.fxcomps.augment.GrowAugment; import io.xpipe.app.util.JfxHelper; import javafx.application.Platform; +import javafx.beans.property.Property; +import javafx.beans.property.SimpleObjectProperty; import javafx.geometry.Orientation; import javafx.scene.control.Label; import javafx.scene.control.Separator; @@ -32,6 +35,7 @@ public class ErrorHandlerComp extends SimpleComp { private static final AtomicBoolean showing = new AtomicBoolean(false); private final ErrorEvent event; private final Stage stage; + private final Property takenAction = new SimpleObjectProperty<>(); public ErrorHandlerComp(ErrorEvent event, Stage stage) { this.event = event; @@ -46,16 +50,28 @@ public class ErrorHandlerComp extends SimpleComp { } } + private static Comp setUpComp(ErrorEvent event, Stage w, CountDownLatch finishLatch) { + var c = new ErrorHandlerComp(event, w); + w.setOnHidden(e -> { + if (c.takenAction.getValue() == null) { + ErrorAction.ignore().handle(event); + c.takenAction.setValue(ErrorAction.ignore()); + } + + showing.set(false); + finishLatch.countDown(); + }); + return c; + } + public static void showAndWaitWithPlatformThread(ErrorEvent event) { var finishLatch = new CountDownLatch(1); if (!showing.get()) { showing.set(true); var window = AppWindowHelper.sideWindow( - AppI18n.get("errorHandler"), w -> new ErrorHandlerComp(event, w), true, null); - window.setOnHidden(e -> { - showing.set(false); - finishLatch.countDown(); - }); + AppI18n.get("errorHandler"), w -> { + return setUpComp(event, w, finishLatch); + }, true, null); // An exception is thrown when show and wait is called // within an animation or layout processing task, so use show @@ -74,12 +90,9 @@ public class ErrorHandlerComp extends SimpleComp { if (!showing.get()) { showing.set(true); var window = AppWindowHelper.sideWindow( - AppI18n.get("errorHandler"), w -> new ErrorHandlerComp(event, w), true, null); - window.setOnHidden(e -> { - showing.set(false); - finishLatch.countDown(); - }); - + AppI18n.get("errorHandler"), w -> { + return setUpComp(event, w, finishLatch); + }, true, null); // An exception is thrown when show and wait is called // within an animation or layout processing task, so use show try { @@ -105,6 +118,7 @@ public class ErrorHandlerComp extends SimpleComp { private Region createActionComp(ErrorAction a) { var r = JfxHelper.createNamedEntry(a.getName(), a.getDescription()); var b = new ButtonComp(null, r, () -> { + takenAction.setValue(a); if (a.handle(event)) { stage.close(); } @@ -165,9 +179,6 @@ public class ErrorHandlerComp extends SimpleComp { layout.setCenter(content); layout.setBottom(details); layout.getStyleClass().add("error-handler-comp"); - layout.maxHeightProperty().addListener((c, o, n) -> { - int a = 0; - }); return layout; } diff --git a/app/src/main/resources/io/xpipe/app/resources/lang/translations_en.properties b/app/src/main/resources/io/xpipe/app/resources/lang/translations_en.properties index aab630a2..69de7e6d 100644 --- a/app/src/main/resources/io/xpipe/app/resources/lang/translations_en.properties +++ b/app/src/main/resources/io/xpipe/app/resources/lang/translations_en.properties @@ -18,6 +18,7 @@ hostFeatureUnsupported=Host does not support the feature $FEATURE$ missingStore=$NAME$ does not exist connectionName=Connection name connectionNameDescription=Give this connection a custom name +openFileTitle=Open file unknown=Unknown scanAlertTitle=Connection detection scanAlertHeader=Select types of connections you want to automatically detect on the host system: diff --git a/core/src/main/java/io/xpipe/core/process/OsType.java b/core/src/main/java/io/xpipe/core/process/OsType.java index aa7ff088..2391430b 100644 --- a/core/src/main/java/io/xpipe/core/process/OsType.java +++ b/core/src/main/java/io/xpipe/core/process/OsType.java @@ -60,8 +60,8 @@ public interface OsType { @Override public String determineOperatingSystemName(ShellControl pc) throws Exception { var properties = getProperties(pc); - return properties.get("OS Name") + " " - + properties.get("OS Version").split(" ")[0]; + return properties.getOrDefault("OS Name", "Windows") + " " + + properties.getOrDefault("OS Version", "?").split(" ")[0]; } } diff --git a/dist/changelogs/0.5.26.md b/dist/changelogs/0.5.26.md new file mode 100644 index 00000000..dcc76c8e --- /dev/null +++ b/dist/changelogs/0.5.26.md @@ -0,0 +1,4 @@ +- Fix occasional error in Windows OS type detection +- Disable SSH scan dialog for now as it results in only partially complete connection information +- Fix some localization strings +- Fix various small bugs \ No newline at end of file diff --git a/version b/version index 42db9a22..28b9abf8 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.5.25 \ No newline at end of file +0.5.26 \ No newline at end of file