Icon fixes

This commit is contained in:
crschnick 2024-09-27 12:34:20 +00:00
parent 3f9d1aa063
commit 15cb286dcf
8 changed files with 12 additions and 49 deletions

View file

@ -145,8 +145,7 @@ public class BrowserWelcomeComp extends SimpleComp {
private Comp<?> entryButton(BrowserSavedState.Entry e, BooleanProperty disable) { private Comp<?> entryButton(BrowserSavedState.Entry e, BooleanProperty disable) {
var entry = DataStorage.get().getStoreEntryIfPresent(e.getUuid()); var entry = DataStorage.get().getStoreEntryIfPresent(e.getUuid());
var graphic = var graphic = entry.get().getEffectiveIconFile();
entry.get().getProvider().getDisplayIconFileName(entry.get().getStore());
var view = PrettyImageHelper.ofFixedSize(graphic, 30, 24); var view = PrettyImageHelper.ofFixedSize(graphic, 30, 24);
return new ButtonComp( return new ButtonComp(
new SimpleStringProperty(DataStorage.get().getStoreEntryDisplayName(entry.get())), new SimpleStringProperty(DataStorage.get().getStoreEntryDisplayName(entry.get())),

View file

@ -333,8 +333,7 @@ public class BrowserSessionTabsComp extends SimpleComp {
var image = model.getEntry() var image = model.getEntry()
.get() .get()
.getProvider() .getEffectiveIconFile();
.getDisplayIconFileName(model.getEntry().getStore());
var logo = PrettyImageHelper.ofFixedSizeSquare(image, 16).createRegion(); var logo = PrettyImageHelper.ofFixedSizeSquare(image, 16).createRegion();
tab.graphicProperty() tab.graphicProperty()

View file

@ -140,7 +140,7 @@ public class StoreEntryWrapper {
color.setValue(entry.getColor()); color.setValue(entry.getColor());
notes.setValue(new StoreNotes(entry.getNotes(), entry.getNotes())); notes.setValue(new StoreNotes(entry.getNotes(), entry.getNotes()));
customIcon.setValue(entry.getIcon()); customIcon.setValue(entry.getIcon());
iconFile.setValue(getEffectiveIconFile()); iconFile.setValue(entry.getEffectiveIconFile());
busy.setValue(entry.getBusyCounter().get() != 0); busy.setValue(entry.getBusyCounter().get() != 0);
deletable.setValue(entry.getConfiguration().isDeletable() deletable.setValue(entry.getConfiguration().isDeletable()
@ -194,20 +194,6 @@ public class StoreEntryWrapper {
} }
} }
private String getEffectiveIconFile() {
if (disabledProperty().get()) {
return "disabled_icon.png";
}
if (getCustomIcon().getValue() == null) {
return getEntry()
.getProvider()
.getDisplayIconFileName(getEntry().getStore());
}
return "app:system/" + getCustomIcon().getValue() + ".svg";
}
private boolean showActionProvider(ActionProvider p) { private boolean showActionProvider(ActionProvider p) {
var leaf = p.getLeafDataStoreCallSite(); var leaf = p.getLeafDataStoreCallSite();
if (leaf != null) { if (leaf != null) {

View file

@ -41,8 +41,7 @@ public class StoreQuickAccessButtonComp extends Comp<CompStructure<Button>> {
private MenuItem recurse(ContextMenu contextMenu, StoreSection section) { private MenuItem recurse(ContextMenu contextMenu, StoreSection section) {
var c = section.getShownChildren(); var c = section.getShownChildren();
var w = section.getWrapper(); var w = section.getWrapper();
var graphic = var graphic = w.getEntry().getEffectiveIconFile();
w.getEntry().getProvider().getDisplayIconFileName(w.getEntry().getStore());
if (c.getList().isEmpty()) { if (c.getList().isEmpty()) {
var item = ContextMenuHelper.item( var item = ContextMenuHelper.item(
new LabelGraphic.ImageGraphic(graphic, 16), w.getName().getValue()); new LabelGraphic.ImageGraphic(graphic, 16), w.getName().getValue());

View file

@ -53,14 +53,10 @@ public class StoreSectionMiniComp extends Comp<CompStructure<VBox>> {
if (section.getWrapper() != null) { if (section.getWrapper() != null) {
var root = new ButtonComp(section.getWrapper().nameProperty(), () -> {}) var root = new ButtonComp(section.getWrapper().nameProperty(), () -> {})
.apply(struc -> { .apply(struc -> {
var provider = section.getWrapper().getEntry().getProvider();
struc.get() struc.get()
.setGraphic(PrettyImageHelper.ofFixedSizeSquare( .setGraphic(PrettyImageHelper.ofFixedSize(
provider != null section.getWrapper().getIconFile(),
? provider.getDisplayIconFileName(section.getWrapper() 16,
.getEntry()
.getStore())
: null,
16) 16)
.createRegion()); .createRegion());
}) })

View file

@ -1,5 +1,7 @@
package io.xpipe.app.fxcomps.impl; package io.xpipe.app.fxcomps.impl;
import atlantafx.base.controls.Popover;
import atlantafx.base.theme.Styles;
import io.xpipe.app.comp.base.ButtonComp; import io.xpipe.app.comp.base.ButtonComp;
import io.xpipe.app.comp.store.*; import io.xpipe.app.comp.store.*;
import io.xpipe.app.core.AppFont; import io.xpipe.app.core.AppFont;
@ -7,14 +9,12 @@ import io.xpipe.app.core.AppI18n;
import io.xpipe.app.ext.LocalStore; import io.xpipe.app.ext.LocalStore;
import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.fxcomps.SimpleComp; import io.xpipe.app.fxcomps.SimpleComp;
import io.xpipe.app.resources.SystemIcons;
import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.storage.DataStoreEntry;
import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.util.DataStoreCategoryChoiceComp; import io.xpipe.app.util.DataStoreCategoryChoiceComp;
import io.xpipe.core.store.DataStore; import io.xpipe.core.store.DataStore;
import io.xpipe.core.store.ShellStore; import io.xpipe.core.store.ShellStore;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.beans.property.Property; import javafx.beans.property.Property;
import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleBooleanProperty;
@ -26,9 +26,6 @@ import javafx.scene.control.MenuButton;
import javafx.scene.layout.Region; import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import atlantafx.base.controls.Popover;
import atlantafx.base.theme.Styles;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.kordamp.ikonli.javafx.FontIcon; import org.kordamp.ikonli.javafx.FontIcon;
@ -204,20 +201,7 @@ public class DataStoreChoiceComp<T extends DataStore> extends SimpleComp {
Comp<?> graphic = PrettyImageHelper.ofFixedSize( Comp<?> graphic = PrettyImageHelper.ofFixedSize(
Bindings.createStringBinding( Bindings.createStringBinding(
() -> { () -> {
if (selected.getValue() == null) { return selected.getValue().get().getEffectiveIconFile();
return null;
}
if (selected.getValue().get().getIcon() == null) {
return selected.getValue()
.get()
.getProvider()
.getDisplayIconFileName(
selected.getValue().getStore());
}
return "app:system/"
+ selected.getValue().get().getIcon() + ".svg";
}, },
selected), selected),
16, 16,

View file

@ -46,7 +46,7 @@ public class DataStoreListChoiceComp<T extends DataStore> extends SimpleComp {
var label = new LabelComp(t.get().getName()).apply(struc -> struc.get() var label = new LabelComp(t.get().getName()).apply(struc -> struc.get()
.setGraphic(PrettyImageHelper.ofFixedSizeSquare( .setGraphic(PrettyImageHelper.ofFixedSizeSquare(
t.get().getProvider().getDisplayIconFileName(t.getStore()), 16) t.get().getEffectiveIconFile(), 16)
.createRegion())); .createRegion()));
var delete = new IconButtonComp("mdal-delete_outline", () -> { var delete = new IconButtonComp("mdal-delete_outline", () -> {
selectedList.remove(t); selectedList.remove(t);

View file

@ -53,7 +53,7 @@
} }
.store-entry-grid.dense { .store-entry-grid.dense {
-fx-padding: 1px 6px 1px 6px; -fx-padding: 0px 6px 0px 6px;
} }
/* Entry */ /* Entry */