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))) return new HorizontalComp(List.of(Comp.hspacer(8), custom, Comp.hspacer(10)))
.styleClass("top"); .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"); return content.styleClass("store-list-comp");
} }

View file

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

View file

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

View file

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