mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 07:30:24 +00:00
Various fixes
This commit is contained in:
parent
99717ecc22
commit
51bfd028eb
5 changed files with 43 additions and 21 deletions
|
@ -72,6 +72,7 @@ public class BrowserSessionComp extends SimpleComp {
|
|||
});
|
||||
var r = splitPane.createRegion();
|
||||
r.getStyleClass().add("browser");
|
||||
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,14 @@ import io.xpipe.app.fxcomps.SimpleCompStructure;
|
|||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class AppLayoutComp extends Comp<CompStructure<Pane>> {
|
||||
|
@ -21,19 +26,15 @@ public class AppLayoutComp extends Comp<CompStructure<Pane>> {
|
|||
|
||||
@Override
|
||||
public CompStructure<Pane> createBase() {
|
||||
var multi = new MultiContentComp(model.getEntries().stream()
|
||||
.collect(Collectors.toMap(
|
||||
entry -> entry.comp(),
|
||||
entry -> Bindings.createBooleanBinding(
|
||||
() -> {
|
||||
return model.getSelected().getValue().equals(entry);
|
||||
},
|
||||
model.getSelected())))
|
||||
);
|
||||
Map<Comp<?>, ObservableValue<Boolean>> map = model.getEntries().stream().collect(Collectors.toMap(entry -> entry.comp(), entry -> Bindings.createBooleanBinding(() -> {
|
||||
return model.getSelected().getValue().equals(entry);
|
||||
}, model.getSelected())));
|
||||
var multi = new MultiContentComp(map);
|
||||
|
||||
var pane = new BorderPane();
|
||||
var sidebar = new SideMenuBarComp(model.getSelected(), model.getEntries());
|
||||
pane.setCenter(multi.createRegion());
|
||||
StackPane multiR = (StackPane) multi.createRegion();
|
||||
pane.setCenter(multiR);
|
||||
pane.setRight(sidebar.createRegion());
|
||||
pane.getStyleClass().add("background");
|
||||
model.getSelected().addListener((c, o, n) -> {
|
||||
|
@ -43,6 +44,19 @@ public class AppLayoutComp extends Comp<CompStructure<Pane>> {
|
|||
}
|
||||
});
|
||||
AppFont.normal(pane);
|
||||
|
||||
onSceneAssign(struc -> {
|
||||
struc.get().getScene().addEventFilter(KeyEvent.ANY, event -> {
|
||||
for (Node r : multiR.getChildren()) {
|
||||
if (r.isManaged()) {
|
||||
r.fireEvent(event);
|
||||
event.consume();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return new SimpleCompStructure<>(pane);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import javafx.event.EventHandler;
|
|||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.Window;
|
||||
import javafx.stage.WindowEvent;
|
||||
import javafx.util.Duration;
|
||||
|
@ -38,19 +39,16 @@ public class AppTheme {
|
|||
private static final PseudoClass PERFORMANCE = PseudoClass.getPseudoClass("performance");
|
||||
private static boolean init;
|
||||
|
||||
public static void initThemeHandlers(Window stage) {
|
||||
public static void initThemeHandlers(Stage stage) {
|
||||
if (AppPrefs.get() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
initWindowsThemeHandler(stage);
|
||||
|
||||
// If we set the theme pseudo classes earlier when the window is not shown
|
||||
// they do not apply. Is this a bug in JavaFX?
|
||||
Platform.runLater(() -> {
|
||||
Runnable r = () -> {
|
||||
AppPrefs.get().theme.subscribe(t -> {
|
||||
Theme.ALL.forEach(
|
||||
theme -> stage.getScene().getRoot().getStyleClass().remove(theme.getCssId()));
|
||||
Theme.ALL.forEach(theme -> stage.getScene().getRoot().getStyleClass().remove(theme.getCssId()));
|
||||
if (t == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -64,7 +62,14 @@ public class AppTheme {
|
|||
stage.getScene().getRoot().pseudoClassStateChanged(PRETTY, !val);
|
||||
stage.getScene().getRoot().pseudoClassStateChanged(PERFORMANCE, val);
|
||||
});
|
||||
});
|
||||
};
|
||||
if (stage.getOwner() != null) {
|
||||
// If we set the theme pseudo classes earlier when the window is not shown
|
||||
// they do not apply. Is this a bug in JavaFX?
|
||||
Platform.runLater(r);
|
||||
} else {
|
||||
r.run();
|
||||
}
|
||||
}
|
||||
|
||||
private static void initWindowsThemeHandler(Window stage) {
|
||||
|
@ -82,11 +87,11 @@ public class AppTheme {
|
|||
try {
|
||||
var c = new WindowControl(stage);
|
||||
c.setWindowAttribute(20, AppPrefs.get().theme.getValue().isDark());
|
||||
stage.setWidth(stage.getWidth() - 1);
|
||||
stage.setWidth(stage.getWidth() + 1);
|
||||
Platform.runLater( () -> {
|
||||
stage.setWidth(stage.getWidth() + 1);
|
||||
stage.setWidth(stage.getWidth() - 1);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
ErrorEvent.fromThrowable(e).handle();
|
||||
}
|
||||
stage.removeEventFilter(WindowEvent.WINDOW_SHOWN, this);
|
||||
|
|
|
@ -55,6 +55,7 @@ public class AppShellCheck {
|
|||
- On Windows, an AntiVirus program might block required programs and commands
|
||||
- The system shell is restricted or blocked
|
||||
- Some elementary command-line tools are not available or not working correctly
|
||||
- Your PATH environment variable is corrupt / incomplete
|
||||
|
||||
%s
|
||||
"""
|
||||
|
|
|
@ -286,7 +286,8 @@ sshConfigStringContent=Konfiguration
|
|||
sshConfigStringContentDescription=SSH-Optionen für die Verbindung im OpenSSH-Config-Format
|
||||
vnc.displayName=VNC-Verbindung
|
||||
vnc.displayDescription=Eine VNC-Sitzung über einen SSH-Tunnel öffnen
|
||||
binding=Binden
|
||||
#custom
|
||||
binding=Bindings
|
||||
vncPortDescription=Der Port, an dem der VNC-Server lauscht
|
||||
vncUsername=Benutzername
|
||||
vncUsernameDescription=Der optionale VNC-Benutzername
|
||||
|
|
Loading…
Reference in a new issue