Rework ui size

This commit is contained in:
crschnick 2024-07-15 20:58:04 +00:00
parent 43524d8101
commit e1f84d4a6b
6 changed files with 29 additions and 15 deletions

View file

@ -1,10 +1,8 @@
package io.xpipe.app.comp.store; package io.xpipe.app.comp.store;
import io.xpipe.app.core.AppFont;
import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.fxcomps.augment.GrowAugment; import io.xpipe.app.fxcomps.augment.GrowAugment;
import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.fxcomps.util.PlatformThread;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.geometry.HPos; import javafx.geometry.HPos;
@ -26,7 +24,6 @@ public class DenseStoreEntryComp extends StoreEntryComp {
var information = new Label(); var information = new Label();
information.setGraphicTextGap(7); information.setGraphicTextGap(7);
information.getStyleClass().add("information"); information.getStyleClass().add("information");
AppFont.header(information);
var state = getWrapper().getEntry().getProvider() != null var state = getWrapper().getEntry().getProvider() != null
? getWrapper().getEntry().getProvider().stateDisplay(getWrapper()) ? getWrapper().getEntry().getProvider().stateDisplay(getWrapper())
@ -76,8 +73,8 @@ public class DenseStoreEntryComp extends StoreEntryComp {
var notes = new StoreNotesComp(getWrapper()).createRegion(); var notes = new StoreNotesComp(getWrapper()).createRegion();
if (showIcon) { if (showIcon) {
var storeIcon = createIcon(30, 24); var storeIcon = createIcon(28, 24);
grid.getColumnConstraints().add(new ColumnConstraints(46)); grid.getColumnConstraints().add(new ColumnConstraints(38));
grid.add(storeIcon, 0, 0); grid.add(storeIcon, 0, 0);
GridPane.setHalignment(storeIcon, HPos.CENTER); GridPane.setHalignment(storeIcon, HPos.CENTER);
} }

View file

@ -5,6 +5,7 @@ import io.xpipe.app.fxcomps.Comp;
import javafx.geometry.HPos; import javafx.geometry.HPos;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.geometry.Pos; import javafx.geometry.Pos;
import javafx.geometry.VPos;
import javafx.scene.layout.*; import javafx.scene.layout.*;
public class StandardStoreEntryComp extends StoreEntryComp { public class StandardStoreEntryComp extends StoreEntryComp {
@ -23,17 +24,18 @@ public class StandardStoreEntryComp extends StoreEntryComp {
var notes = new StoreNotesComp(getWrapper()).createRegion(); var notes = new StoreNotesComp(getWrapper()).createRegion();
var grid = new GridPane(); var grid = new GridPane();
grid.setHgap(7); grid.setHgap(6);
grid.setVgap(0); grid.setVgap(0);
var storeIcon = createIcon(50, 40); var storeIcon = createIcon(46, 40);
grid.add(storeIcon, 0, 0, 1, 2); grid.add(storeIcon, 0, 0, 1, 2);
grid.getColumnConstraints().add(new ColumnConstraints(66)); grid.getColumnConstraints().add(new ColumnConstraints(56));
var nameAndNotes = new HBox(name, notes); var nameAndNotes = new HBox(name, notes);
nameAndNotes.setSpacing(1); nameAndNotes.setSpacing(1);
nameAndNotes.setAlignment(Pos.CENTER_LEFT); nameAndNotes.setAlignment(Pos.CENTER_LEFT);
grid.add(nameAndNotes, 1, 0); grid.add(nameAndNotes, 1, 0);
GridPane.setValignment(nameAndNotes, VPos.CENTER);
grid.add(createSummary(), 1, 1); grid.add(createSummary(), 1, 1);
var nameCC = new ColumnConstraints(); var nameCC = new ColumnConstraints();
nameCC.setMinWidth(100); nameCC.setMinWidth(100);

View file

@ -139,6 +139,7 @@ public abstract class StoreEntryComp extends SimpleComp {
getWrapper().getEntry().getValidity().isUsable() getWrapper().getEntry().getValidity().isUsable()
? getWrapper().getBusy().or(getWrapper().getEntry().getProvider().busy(getWrapper())) ? getWrapper().getBusy().or(getWrapper().getEntry().getProvider().busy(getWrapper()))
: getWrapper().getBusy()); : getWrapper().getBusy());
AppFont.normal(button);
return loading.createRegion(); return loading.createRegion();
} }
@ -155,7 +156,6 @@ public abstract class StoreEntryComp extends SimpleComp {
getWrapper().getEntry().getProvider().informationString(section)) getWrapper().getEntry().getProvider().informationString(section))
: new SimpleStringProperty()); : new SimpleStringProperty());
information.getStyleClass().add("information"); information.getStyleClass().add("information");
AppFont.header(information);
var state = getWrapper().getEntry().getProvider() != null var state = getWrapper().getEntry().getProvider() != null
? getWrapper().getEntry().getProvider().stateDisplay(getWrapper()) ? getWrapper().getEntry().getProvider().stateDisplay(getWrapper())
@ -194,9 +194,7 @@ public abstract class StoreEntryComp extends SimpleComp {
protected Comp<?> createName() { protected Comp<?> createName() {
LabelComp name = new LabelComp(getWrapper().nameProperty()); LabelComp name = new LabelComp(getWrapper().nameProperty());
name.apply(struc -> struc.get().setTextOverrun(OverrunStyle.CENTER_ELLIPSIS)) name.apply(struc -> struc.get().setTextOverrun(OverrunStyle.CENTER_ELLIPSIS));
.apply(struc -> struc.get().setPadding(new Insets(5, 5, 5, 0)));
name.apply(s -> AppFont.header(s.get()));
name.styleClass("name"); name.styleClass("name");
return name; return name;
} }
@ -243,8 +241,8 @@ public abstract class StoreEntryComp extends SimpleComp {
buttons.subscribe(update); buttons.subscribe(update);
update.run(); update.run();
ig.setAlignment(Pos.CENTER_RIGHT); ig.setAlignment(Pos.CENTER_RIGHT);
ig.setPadding(new Insets(5));
ig.getStyleClass().add("button-bar"); ig.getStyleClass().add("button-bar");
AppFont.medium(ig);
return ig; return ig;
} }

View file

@ -37,6 +37,14 @@
-fx-opacity: 0.5; -fx-opacity: 0.5;
} }
.store-entry-grid .name {
-fx-padding: 2 0 0 0;
}
.store-entry-grid.dense .name {
-fx-padding: 0 0 0 0;
}
.store-entry-grid .icon { .store-entry-grid .icon {
-fx-background-color: -color-bg-overlay; -fx-background-color: -color-bg-overlay;
-fx-background-radius: 5px; -fx-background-radius: 5px;
@ -90,6 +98,14 @@
-fx-opacity: 0.2; -fx-opacity: 0.2;
} }
.store-entry-comp .button-bar {
-fx-padding: 5;
}
.store-entry-grid.dense .button-bar {
-fx-padding: 3;
}
.store-entry-comp .button-bar .button { .store-entry-comp .button-bar .button {
-fx-padding: 6px; -fx-padding: 6px;
} }

View file

@ -63,7 +63,7 @@
} }
.toggle-switch:has-graphic { .toggle-switch:has-graphic {
-fx-font-size: 0.8em; -fx-font-size: 0.75em;
} }
.store-layout .split-pane-divider { .store-layout .split-pane-divider {

View file

@ -1,6 +1,7 @@
package io.xpipe.ext.base.service; package io.xpipe.ext.base.service;
import io.xpipe.app.comp.base.SystemStateComp; import io.xpipe.app.comp.base.SystemStateComp;
import io.xpipe.app.comp.store.DenseStoreEntryComp;
import io.xpipe.app.comp.store.StoreEntryComp; import io.xpipe.app.comp.store.StoreEntryComp;
import io.xpipe.app.comp.store.StoreEntryWrapper; import io.xpipe.app.comp.store.StoreEntryWrapper;
import io.xpipe.app.comp.store.StoreSection; import io.xpipe.app.comp.store.StoreSection;
@ -80,7 +81,7 @@ public abstract class AbstractServiceStoreProvider implements SingletonSessionSt
return true; return true;
}, },
sec.getWrapper().getCache())); sec.getWrapper().getCache()));
return StoreEntryComp.create(sec, toggle, preferLarge); return new DenseStoreEntryComp(sec, true, toggle);
} }
@Override @Override