From 15cb286dcfe62fda55bbf899e30271175a117e67 Mon Sep 17 00:00:00 2001 From: crschnick Date: Fri, 27 Sep 2024 12:34:20 +0000 Subject: [PATCH] Icon fixes --- .../xpipe/app/browser/BrowserWelcomeComp.java | 3 +-- .../session/BrowserSessionTabsComp.java | 3 +-- .../app/comp/store/StoreEntryWrapper.java | 16 +------------- .../store/StoreQuickAccessButtonComp.java | 3 +-- .../app/comp/store/StoreSectionMiniComp.java | 10 +++------ .../app/fxcomps/impl/DataStoreChoiceComp.java | 22 +++---------------- .../fxcomps/impl/DataStoreListChoiceComp.java | 2 +- .../app/resources/style/store-entry-comp.css | 2 +- 8 files changed, 12 insertions(+), 49 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserWelcomeComp.java b/app/src/main/java/io/xpipe/app/browser/BrowserWelcomeComp.java index 25fd58d4c..87a1b186f 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserWelcomeComp.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserWelcomeComp.java @@ -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())), diff --git a/app/src/main/java/io/xpipe/app/browser/session/BrowserSessionTabsComp.java b/app/src/main/java/io/xpipe/app/browser/session/BrowserSessionTabsComp.java index f188f869e..be4a9660c 100644 --- a/app/src/main/java/io/xpipe/app/browser/session/BrowserSessionTabsComp.java +++ b/app/src/main/java/io/xpipe/app/browser/session/BrowserSessionTabsComp.java @@ -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() diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java b/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java index a94f1fd9e..42835225b 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java @@ -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) { diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreQuickAccessButtonComp.java b/app/src/main/java/io/xpipe/app/comp/store/StoreQuickAccessButtonComp.java index 47a513865..d53029e53 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreQuickAccessButtonComp.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreQuickAccessButtonComp.java @@ -41,8 +41,7 @@ public class StoreQuickAccessButtonComp extends Comp> { 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()); diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreSectionMiniComp.java b/app/src/main/java/io/xpipe/app/comp/store/StoreSectionMiniComp.java index 24fa46adf..01f986d0c 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreSectionMiniComp.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreSectionMiniComp.java @@ -53,14 +53,10 @@ public class StoreSectionMiniComp extends Comp> { 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()); }) diff --git a/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreChoiceComp.java b/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreChoiceComp.java index a23691f9f..733b4944e 100644 --- a/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreChoiceComp.java +++ b/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreChoiceComp.java @@ -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 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, diff --git a/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreListChoiceComp.java b/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreListChoiceComp.java index 2e901e5e8..12341a04f 100644 --- a/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreListChoiceComp.java +++ b/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreListChoiceComp.java @@ -46,7 +46,7 @@ public class DataStoreListChoiceComp 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); diff --git a/app/src/main/resources/io/xpipe/app/resources/style/store-entry-comp.css b/app/src/main/resources/io/xpipe/app/resources/style/store-entry-comp.css index 9b6a58bf5..196adcb76 100644 --- a/app/src/main/resources/io/xpipe/app/resources/style/store-entry-comp.css +++ b/app/src/main/resources/io/xpipe/app/resources/style/store-entry-comp.css @@ -53,7 +53,7 @@ } .store-entry-grid.dense { - -fx-padding: 1px 6px 1px 6px; + -fx-padding: 0px 6px 0px 6px; } /* Entry */