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) {
var entry = DataStorage.get().getStoreEntryIfPresent(e.getUuid());
var graphic =
entry.get().getProvider().getDisplayIconFileName(entry.get().getStore());
var graphic = entry.get().getEffectiveIconFile();
var view = PrettyImageHelper.ofFixedSize(graphic, 30, 24);
return new ButtonComp(
new SimpleStringProperty(DataStorage.get().getStoreEntryDisplayName(entry.get())),

View file

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

View file

@ -140,7 +140,7 @@ public class StoreEntryWrapper {
color.setValue(entry.getColor());
notes.setValue(new StoreNotes(entry.getNotes(), entry.getNotes()));
customIcon.setValue(entry.getIcon());
iconFile.setValue(getEffectiveIconFile());
iconFile.setValue(entry.getEffectiveIconFile());
busy.setValue(entry.getBusyCounter().get() != 0);
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) {
var leaf = p.getLeafDataStoreCallSite();
if (leaf != null) {

View file

@ -41,8 +41,7 @@ public class StoreQuickAccessButtonComp extends Comp<CompStructure<Button>> {
private MenuItem recurse(ContextMenu contextMenu, StoreSection section) {
var c = section.getShownChildren();
var w = section.getWrapper();
var graphic =
w.getEntry().getProvider().getDisplayIconFileName(w.getEntry().getStore());
var graphic = w.getEntry().getEffectiveIconFile();
if (c.getList().isEmpty()) {
var item = ContextMenuHelper.item(
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) {
var root = new ButtonComp(section.getWrapper().nameProperty(), () -> {})
.apply(struc -> {
var provider = section.getWrapper().getEntry().getProvider();
struc.get()
.setGraphic(PrettyImageHelper.ofFixedSizeSquare(
provider != null
? provider.getDisplayIconFileName(section.getWrapper()
.getEntry()
.getStore())
: null,
.setGraphic(PrettyImageHelper.ofFixedSize(
section.getWrapper().getIconFile(),
16,
16)
.createRegion());
})

View file

@ -1,5 +1,7 @@
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.store.*;
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.fxcomps.Comp;
import io.xpipe.app.fxcomps.SimpleComp;
import io.xpipe.app.resources.SystemIcons;
import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.storage.DataStoreEntry;
import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.util.DataStoreCategoryChoiceComp;
import io.xpipe.core.store.DataStore;
import io.xpipe.core.store.ShellStore;
import javafx.beans.binding.Bindings;
import javafx.beans.property.Property;
import javafx.beans.property.SimpleBooleanProperty;
@ -26,9 +26,6 @@ import javafx.scene.control.MenuButton;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import atlantafx.base.controls.Popover;
import atlantafx.base.theme.Styles;
import lombok.RequiredArgsConstructor;
import org.kordamp.ikonli.javafx.FontIcon;
@ -204,20 +201,7 @@ public class DataStoreChoiceComp<T extends DataStore> extends SimpleComp {
Comp<?> graphic = PrettyImageHelper.ofFixedSize(
Bindings.createStringBinding(
() -> {
if (selected.getValue() == null) {
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";
return selected.getValue().get().getEffectiveIconFile();
},
selected),
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()
.setGraphic(PrettyImageHelper.ofFixedSizeSquare(
t.get().getProvider().getDisplayIconFileName(t.getStore()), 16)
t.get().getEffectiveIconFile(), 16)
.createRegion()));
var delete = new IconButtonComp("mdal-delete_outline", () -> {
selectedList.remove(t);

View file

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