This commit is contained in:
crschnick 2024-04-23 15:53:52 +00:00
parent 125d1ddbaf
commit 24600a98be
5 changed files with 21 additions and 14 deletions

View file

@ -25,7 +25,7 @@ public class StoreEntryListComp extends SimpleComp {
return new HorizontalComp(List.of(Comp.hspacer(8), custom, Comp.hspacer(10)))
.styleClass("top");
})
.apply(struc -> ((Region) struc.get().getContent()).setPadding(new Insets(10, 0, 10, 0)));
.apply(struc -> ((Region) struc.get().getContent()).setPadding(new Insets(8, 0, 8, 0)));
return content.styleClass("store-list-comp");
}

View file

@ -80,12 +80,12 @@ public class StoreQuickAccessButtonComp extends Comp<CompStructure<Button>> {
public CompStructure<Button> createBase() {
var button = new IconButtonComp("mdi2c-chevron-double-right");
button.apply(struc -> {
var cm = createMenu();
if (cm == null) {
return;
}
struc.get().setOnAction(event -> {
var cm = createMenu();
if (cm == null) {
return;
}
ContextMenuHelper.toggleShow(cm, struc.get(), Side.RIGHT);
event.consume();
});

View file

@ -28,6 +28,7 @@ import lombok.Value;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.stream.Stream;
public class AppPrefs {
@ -137,21 +138,22 @@ public class AppPrefs {
private AppPrefsStorageHandler vaultStorageHandler;
private AppPrefs() {
this.categories = List.of(
this.categories = Stream.of(
new AboutCategory(),
new SystemCategory(),
new AppearanceCategory(),
new SyncCategory(),
new VaultCategory(),
new PasswordManagerCategory(),
new SecurityCategory(),
new TerminalCategory(),
new EditorCategory(),
new RdpCategory(),
new SshCategory(),
new LocalShellCategory(),
new SecurityCategory(),
new TroubleshootCategory(),
new DeveloperCategory());
new DeveloperCategory())
.filter(appPrefsCategory -> appPrefsCategory.show()).toList();
var selected = AppCache.get("selectedPrefsCategory", Integer.class, () -> 0);
if (selected == null) {
selected = 0;

View file

@ -4,6 +4,10 @@ import io.xpipe.app.fxcomps.Comp;
public abstract class AppPrefsCategory {
protected boolean show() {
return true;
}
protected abstract String getId();
protected abstract Comp<?> create();

View file

@ -4,10 +4,13 @@ import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.util.OptionsBuilder;
import io.xpipe.core.process.OsType;
import javafx.beans.property.SimpleBooleanProperty;
public class SshCategory extends AppPrefsCategory {
@Override
protected boolean show() {
return OsType.getLocal().equals(OsType.WINDOWS);
}
@Override
protected String getId() {
return "ssh";
@ -21,9 +24,7 @@ public class SshCategory extends AppPrefsCategory {
.sub(new OptionsBuilder()
.nameAndDescription("useBundledTools")
.addToggle(prefs.useBundledTools)
.hide(new SimpleBooleanProperty(!OsType.getLocal().equals(OsType.WINDOWS)))
.addComp(prefs.getCustomComp("x11WslInstance"))
.hide(new SimpleBooleanProperty(!OsType.getLocal().equals(OsType.WINDOWS))))
.addComp(prefs.getCustomComp("x11WslInstance")))
.buildComp();
}
}