Various fixes

This commit is contained in:
crschnick 2024-07-07 01:39:37 +00:00
parent 8e8b9c5330
commit 8090c09e0c
10 changed files with 24 additions and 22 deletions

View file

@ -57,10 +57,9 @@ public class BrowserStatusBarComp extends SimpleComp {
if (p == null || p.done()) { if (p == null || p.done()) {
return null; return null;
} else { } else {
var time = var expected = p.expectedTimeRemaining();
p.getTotal() > 50_000_000 && p.elapsedTime().compareTo(Duration.of(200, ChronoUnit.MILLIS)) > 0 var show = (p.getTotal() > 50_000_000 && p.elapsedTime().compareTo(Duration.of(200, ChronoUnit.MILLIS)) > 0) || expected.toMillis() > 5000;
? HumanReadableFormat.duration(p.expectedTimeRemaining()) var time = show ? HumanReadableFormat.duration(p.expectedTimeRemaining()) : "...";
: "...";
return time; return time;
} }
}); });

View file

@ -51,8 +51,6 @@ public class BrowserSessionTabsComp extends SimpleComp {
public Region createSimple() { public Region createSimple() {
var multi = new MultiContentComp(Map.<Comp<?>, ObservableValue<Boolean>>of( var multi = new MultiContentComp(Map.<Comp<?>, ObservableValue<Boolean>>of(
Comp.hspacer().styleClass("top-spacer"),
new SimpleBooleanProperty(true),
Comp.of(() -> createTabPane()), Comp.of(() -> createTabPane()),
Bindings.isNotEmpty(model.getSessionEntries()), Bindings.isNotEmpty(model.getSessionEntries()),
new BrowserWelcomeComp(model).apply(struc -> StackPane.setAlignment(struc.get(), Pos.CENTER_LEFT)), new BrowserWelcomeComp(model).apply(struc -> StackPane.setAlignment(struc.get(), Pos.CENTER_LEFT)),
@ -60,7 +58,9 @@ public class BrowserSessionTabsComp extends SimpleComp {
() -> { () -> {
return model.getSessionEntries().size() == 0; return model.getSessionEntries().size() == 0;
}, },
model.getSessionEntries()))); model.getSessionEntries()),
Comp.hspacer().styleClass("top-spacer"),
new SimpleBooleanProperty(true)));
multi.apply(struc -> ((StackPane) struc.get()).setAlignment(Pos.TOP_CENTER)); multi.apply(struc -> ((StackPane) struc.get()).setAlignment(Pos.TOP_CENTER));
return multi.createRegion(); return multi.createRegion();
} }

View file

@ -2,17 +2,14 @@ package io.xpipe.app.core;
import io.xpipe.app.comp.AppLayoutComp; import io.xpipe.app.comp.AppLayoutComp;
import io.xpipe.app.core.window.AppMainWindow; import io.xpipe.app.core.window.AppMainWindow;
import io.xpipe.app.core.window.AppWindowHelper;
import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.fxcomps.util.PlatformThread;
import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.issue.TrackEvent;
import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.update.XPipeDistributionType; import io.xpipe.app.update.XPipeDistributionType;
import io.xpipe.app.util.LicenseProvider; import io.xpipe.app.util.LicenseProvider;
import javafx.application.Application; import javafx.application.Application;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.stage.Stage; import javafx.stage.Stage;
import lombok.Getter; import lombok.Getter;
import lombok.SneakyThrows; import lombok.SneakyThrows;
@ -32,8 +29,6 @@ public class App extends Application {
TrackEvent.info("Application launched"); TrackEvent.info("Application launched");
APP = this; APP = this;
stage = primaryStage; stage = primaryStage;
stage.opacityProperty().bind(AppPrefs.get().windowOpacity());
AppWindowHelper.addIcons(stage);
} }
public void setupWindow() { public void setupWindow() {

View file

@ -59,11 +59,13 @@ public class AppTheme {
} }
stage.getScene().getRoot().getStyleClass().add(t.getCssId()); stage.getScene().getRoot().getStyleClass().add(t.getCssId());
stage.getScene().getStylesheets().removeAll(t.getAdditionalStylesheets());
stage.getScene().getStylesheets().addAll(t.getAdditionalStylesheets()); stage.getScene().getStylesheets().addAll(t.getAdditionalStylesheets());
stage.getScene().getRoot().pseudoClassStateChanged(LIGHT, !t.isDark()); stage.getScene().getRoot().pseudoClassStateChanged(LIGHT, !t.isDark());
stage.getScene().getRoot().pseudoClassStateChanged(DARK, t.isDark()); stage.getScene().getRoot().pseudoClassStateChanged(DARK, t.isDark());
}); });
AppPrefs.get().theme.addListener((observable, oldValue, newValue) -> {
stage.getScene().getStylesheets().removeAll(oldValue.getAdditionalStylesheets());
});
AppPrefs.get().performanceMode().subscribe(val -> { AppPrefs.get().performanceMode().subscribe(val -> {
stage.getScene().getRoot().pseudoClassStateChanged(PRETTY, !val); stage.getScene().getRoot().pseudoClassStateChanged(PRETTY, !val);

View file

@ -54,6 +54,8 @@ public class AppMainWindow {
scene.setFill(Color.TRANSPARENT); scene.setFill(Color.TRANSPARENT);
ModifiedStage.prepareStage(stage); ModifiedStage.prepareStage(stage);
stage.setScene(scene); stage.setScene(scene);
stage.opacityProperty().bind(AppPrefs.get().windowOpacity());
AppWindowHelper.addIcons(stage);
AppWindowHelper.setupStylesheets(stage.getScene()); AppWindowHelper.setupStylesheets(stage.getScene());
return INSTANCE; return INSTANCE;
} }

View file

@ -49,10 +49,10 @@ public enum PlatformState {
setCurrent(PlatformState.EXITED); setCurrent(PlatformState.EXITED);
} }
public static void initPlatformOrThrow() throws Exception { public static void initPlatformOrThrow() throws Throwable {
initPlatformIfNeeded(); initPlatformIfNeeded();
if (lastError != null) { if (lastError != null) {
throw lastError instanceof Exception e ? e : new Exception(lastError); throw getLastError();
} }
} }

View file

@ -18,7 +18,7 @@ import javafx.stage.Stage;
public class UnlockAlert { public class UnlockAlert {
public static void showIfNeeded() throws Exception { public static void showIfNeeded() throws Throwable {
if (AppPrefs.get().getLockCrypt().getValue() == null if (AppPrefs.get().getLockCrypt().getValue() == null
|| AppPrefs.get().getLockCrypt().getValue().isEmpty()) { || AppPrefs.get().getLockCrypt().getValue().isEmpty()) {
return; return;

View file

@ -90,10 +90,6 @@
-fx-opacity: 0.2; -fx-opacity: 0.2;
} }
.root:pretty .store-entry-comp .button-bar, .root:pretty .store-entry-comp .dropdown-comp {
-fx-effect: dropshadow(three-pass-box, -color-shadow-default, 2px, 0.25, 0, 1);
}
.store-entry-comp .button-bar .button { .store-entry-comp .button-bar .button {
-fx-padding: 6px; -fx-padding: 6px;
} }

View file

@ -1 +1,5 @@
.root { -color-bg-default-transparent: #1C1C1ED2; } .root { -color-bg-default-transparent: #1C1C1ED2; }
.root.cupertino .button {
-fx-effect: NONE;
}

View file

@ -1 +1,5 @@
.root { -color-bg-default-transparent: #FFFFFFCC; } .root { -color-bg-default-transparent: #FFFFFFCC; }
.root.cupertino .button {
-fx-effect: NONE;
}