Small fixes [release]

This commit is contained in:
crschnick 2023-03-30 10:06:25 +00:00
parent 56234f2abf
commit 7fd2e89c77
5 changed files with 33 additions and 17 deletions

View file

@ -5,10 +5,13 @@ import io.xpipe.app.comp.base.TitledPaneComp;
import io.xpipe.app.core.AppFont; import io.xpipe.app.core.AppFont;
import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.AppI18n;
import io.xpipe.app.core.AppWindowHelper; import io.xpipe.app.core.AppWindowHelper;
import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.fxcomps.SimpleComp; import io.xpipe.app.fxcomps.SimpleComp;
import io.xpipe.app.fxcomps.augment.GrowAugment; import io.xpipe.app.fxcomps.augment.GrowAugment;
import io.xpipe.app.util.JfxHelper; import io.xpipe.app.util.JfxHelper;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.property.Property;
import javafx.beans.property.SimpleObjectProperty;
import javafx.geometry.Orientation; import javafx.geometry.Orientation;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.Separator; import javafx.scene.control.Separator;
@ -32,6 +35,7 @@ public class ErrorHandlerComp extends SimpleComp {
private static final AtomicBoolean showing = new AtomicBoolean(false); private static final AtomicBoolean showing = new AtomicBoolean(false);
private final ErrorEvent event; private final ErrorEvent event;
private final Stage stage; private final Stage stage;
private final Property<ErrorAction> takenAction = new SimpleObjectProperty<>();
public ErrorHandlerComp(ErrorEvent event, Stage stage) { public ErrorHandlerComp(ErrorEvent event, Stage stage) {
this.event = event; 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) { public static void showAndWaitWithPlatformThread(ErrorEvent event) {
var finishLatch = new CountDownLatch(1); var finishLatch = new CountDownLatch(1);
if (!showing.get()) { if (!showing.get()) {
showing.set(true); showing.set(true);
var window = AppWindowHelper.sideWindow( var window = AppWindowHelper.sideWindow(
AppI18n.get("errorHandler"), w -> new ErrorHandlerComp(event, w), true, null); AppI18n.get("errorHandler"), w -> {
window.setOnHidden(e -> { return setUpComp(event, w, finishLatch);
showing.set(false); }, true, null);
finishLatch.countDown();
});
// An exception is thrown when show and wait is called // An exception is thrown when show and wait is called
// within an animation or layout processing task, so use show // within an animation or layout processing task, so use show
@ -74,12 +90,9 @@ public class ErrorHandlerComp extends SimpleComp {
if (!showing.get()) { if (!showing.get()) {
showing.set(true); showing.set(true);
var window = AppWindowHelper.sideWindow( var window = AppWindowHelper.sideWindow(
AppI18n.get("errorHandler"), w -> new ErrorHandlerComp(event, w), true, null); AppI18n.get("errorHandler"), w -> {
window.setOnHidden(e -> { return setUpComp(event, w, finishLatch);
showing.set(false); }, true, null);
finishLatch.countDown();
});
// An exception is thrown when show and wait is called // An exception is thrown when show and wait is called
// within an animation or layout processing task, so use show // within an animation or layout processing task, so use show
try { try {
@ -105,6 +118,7 @@ public class ErrorHandlerComp extends SimpleComp {
private Region createActionComp(ErrorAction a) { private Region createActionComp(ErrorAction a) {
var r = JfxHelper.createNamedEntry(a.getName(), a.getDescription()); var r = JfxHelper.createNamedEntry(a.getName(), a.getDescription());
var b = new ButtonComp(null, r, () -> { var b = new ButtonComp(null, r, () -> {
takenAction.setValue(a);
if (a.handle(event)) { if (a.handle(event)) {
stage.close(); stage.close();
} }
@ -165,9 +179,6 @@ public class ErrorHandlerComp extends SimpleComp {
layout.setCenter(content); layout.setCenter(content);
layout.setBottom(details); layout.setBottom(details);
layout.getStyleClass().add("error-handler-comp"); layout.getStyleClass().add("error-handler-comp");
layout.maxHeightProperty().addListener((c, o, n) -> {
int a = 0;
});
return layout; return layout;
} }

View file

@ -18,6 +18,7 @@ hostFeatureUnsupported=Host does not support the feature $FEATURE$
missingStore=$NAME$ does not exist missingStore=$NAME$ does not exist
connectionName=Connection name connectionName=Connection name
connectionNameDescription=Give this connection a custom name connectionNameDescription=Give this connection a custom name
openFileTitle=Open file
unknown=Unknown unknown=Unknown
scanAlertTitle=Connection detection scanAlertTitle=Connection detection
scanAlertHeader=Select types of connections you want to automatically detect on the host system: scanAlertHeader=Select types of connections you want to automatically detect on the host system:

View file

@ -60,8 +60,8 @@ public interface OsType {
@Override @Override
public String determineOperatingSystemName(ShellControl pc) throws Exception { public String determineOperatingSystemName(ShellControl pc) throws Exception {
var properties = getProperties(pc); var properties = getProperties(pc);
return properties.get("OS Name") + " " return properties.getOrDefault("OS Name", "Windows") + " "
+ properties.get("OS Version").split(" ")[0]; + properties.getOrDefault("OS Version", "?").split(" ")[0];
} }
} }

4
dist/changelogs/0.5.26.md vendored Normal file
View file

@ -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

View file

@ -1 +1 @@
0.5.25 0.5.26