Rework svg image handling
|
@ -81,7 +81,7 @@ public class BrowserWelcomeComp extends SimpleComp {
|
|||
var listBox = new ListBoxViewComp<>(list, list, e -> {
|
||||
var entry = DataStorage.get().getStoreEntryIfPresent(e.getUuid());
|
||||
var graphic = entry.get().getProvider().getDisplayIconFileName(entry.get().getStore());
|
||||
var view = PrettyImageHelper.ofFixed(graphic, 50, 40);
|
||||
var view = PrettyImageHelper.ofFixedSize(graphic, 50, 40);
|
||||
view.padding(new Insets(2, 8, 2, 8));
|
||||
var content =
|
||||
JfxHelper.createNamedEntry(DataStorage.get().getStoreDisplayName(entry.get()), e.getPath(), graphic);
|
||||
|
|
|
@ -51,7 +51,7 @@ public class OsLogoComp extends SimpleComp {
|
|||
var hide = BindingsHelper.map(img, s -> s != null);
|
||||
return new StackComp(List.of(
|
||||
new SystemStateComp(state).hide(hide),
|
||||
PrettyImageHelper.ofSvg(img, 24, 24).visible(hide)))
|
||||
PrettyImageHelper.ofRasterized(img, 24, 24).visible(hide)))
|
||||
.createRegion();
|
||||
}
|
||||
|
||||
|
@ -66,8 +66,9 @@ public class OsLogoComp extends SimpleComp {
|
|||
if (ICONS.isEmpty()) {
|
||||
AppResources.with(AppResources.XPIPE_MODULE, "img/os", file -> {
|
||||
try (var list = Files.list(file)) {
|
||||
list.filter(path -> !path.toString().endsWith(LINUX_DEFAULT)).map(path -> FileNames.getFileName(path.toString())).forEach(path -> {
|
||||
var base = FileNames.getBaseName(path).replace("-dark", "") + ".svg";
|
||||
list.filter(path -> path.toString().endsWith(".svg") && !path.toString().endsWith(LINUX_DEFAULT))
|
||||
.map(path -> FileNames.getFileName(path.toString())).forEach(path -> {
|
||||
var base = FileNames.getBaseName(path).replace("-dark", "") + "-24.png";
|
||||
ICONS.put(FileNames.getBaseName(base).split("-")[0], "os/" + base);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class DenseStoreEntryComp extends StoreEntryComp {
|
|||
}, grid.widthProperty()));
|
||||
|
||||
if (showIcon) {
|
||||
var storeIcon = createIcon(30, 25);
|
||||
var storeIcon = createIcon(30, 24);
|
||||
grid.getColumnConstraints().add(new ColumnConstraints(46));
|
||||
grid.add(storeIcon, 0, 0);
|
||||
GridPane.setHalignment(storeIcon, HPos.CENTER);
|
||||
|
|
|
@ -160,7 +160,7 @@ public abstract class StoreEntryComp extends SimpleComp {
|
|||
: wrapper.getEntry()
|
||||
.getProvider()
|
||||
.getDisplayIconFileName(wrapper.getEntry().getStore());
|
||||
var imageComp = PrettyImageHelper.ofFixed(img, w, h);
|
||||
var imageComp = PrettyImageHelper.ofFixedSize(img, w, h);
|
||||
var storeIcon = imageComp.createRegion();
|
||||
if (wrapper.getValidity().getValue().isUsable()) {
|
||||
new FancyTooltipAugment<>(new SimpleStringProperty(
|
||||
|
|
|
@ -4,6 +4,7 @@ import io.xpipe.app.core.AppImages;
|
|||
import io.xpipe.app.fxcomps.SimpleComp;
|
||||
import io.xpipe.app.fxcomps.util.PlatformThread;
|
||||
import io.xpipe.app.fxcomps.util.SimpleChangeListener;
|
||||
import io.xpipe.app.issue.TrackEvent;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.core.store.FileNames;
|
||||
import javafx.beans.binding.Bindings;
|
||||
|
@ -78,6 +79,7 @@ public class PrettyImageComp extends SimpleComp {
|
|||
} else if (AppImages.hasNormalImage(image.getValue().replace("-dark", ""))) {
|
||||
return AppImages.image(image.getValue().replace("-dark", ""));
|
||||
} else {
|
||||
TrackEvent.withWarn("Image file not found").tag("file",image.getValue()).handle();
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -23,10 +23,10 @@ public class PrettyImageHelper {
|
|||
}
|
||||
|
||||
public static Comp<?> ofFixedSquare(String img, int size) {
|
||||
return ofFixed(img, size, size);
|
||||
return ofFixedSize(img, size, size);
|
||||
}
|
||||
|
||||
public static Comp<?> ofFixed(String img, int w, int h) {
|
||||
public static Comp<?> ofFixedSize(String img, int w, int h) {
|
||||
if (img == null) {
|
||||
return new PrettyImageComp(new SimpleStringProperty(null), w, h);
|
||||
}
|
||||
|
@ -39,13 +39,16 @@ public class PrettyImageHelper {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static Comp<?> ofSvg(ObservableValue<String> img, int w, int h) {
|
||||
return new PrettySvgComp(img, w, h);
|
||||
}
|
||||
|
||||
public static Comp<?> ofRasterized(ObservableValue<String> img, int w, int h) {
|
||||
return new PrettyImageComp(img, w, h);
|
||||
}
|
||||
|
||||
public static Comp<?> ofFixedSmallSquare(String img) {
|
||||
return ofFixed(img, 16, 16);
|
||||
return ofFixedSize(img, 16, 16);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
BIN
app/src/main/resources/io/xpipe/app/resources/img/os/alma-24.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 872 B |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
After Width: | Height: | Size: 708 B |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/resources/io/xpipe/app/resources/img/os/arch-24.png
Normal file
After Width: | Height: | Size: 750 B |
Before Width: | Height: | Size: 780 B After Width: | Height: | Size: 780 B |
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1,014 B |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 623 B |
After Width: | Height: | Size: 575 B |
After Width: | Height: | Size: 915 B |
After Width: | Height: | Size: 958 B |
After Width: | Height: | Size: 925 B |
Before Width: | Height: | Size: 911 B After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 749 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1 KiB |
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/resources/io/xpipe/app/resources/img/os/kali-24.png
Normal file
After Width: | Height: | Size: 730 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 941 B |
After Width: | Height: | Size: 466 B |
After Width: | Height: | Size: 434 B |
After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 210 B |
BIN
app/src/main/resources/io/xpipe/app/resources/img/os/mint-24.png
Normal file
After Width: | Height: | Size: 801 B |
Before Width: | Height: | Size: 985 B After Width: | Height: | Size: 985 B |
After Width: | Height: | Size: 715 B |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 817 B After Width: | Height: | Size: 817 B |
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
BIN
app/src/main/resources/io/xpipe/app/resources/img/os/pop-24.png
Normal file
After Width: | Height: | Size: 686 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 594 B |
Before Width: | Height: | Size: 696 B After Width: | Height: | Size: 696 B |
After Width: | Height: | Size: 683 B |
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 360 B |
BIN
app/src/main/resources/io/xpipe/app/resources/img/os/suse-24.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1,023 B |
Before Width: | Height: | Size: 963 B After Width: | Height: | Size: 963 B |
After Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 218 B |
After Width: | Height: | Size: 662 B |
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 287 B |
Before Width: | Height: | Size: 4 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.6 KiB |