mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-05-03 11:20:34 +00:00
Fixes
This commit is contained in:
@@ -2,7 +2,7 @@ package io.xpipe.app.browser.icon;
|
||||
|
||||
import io.xpipe.app.core.AppImages;
|
||||
import io.xpipe.app.core.AppResources;
|
||||
import io.xpipe.app.core.AppScale;
|
||||
import io.xpipe.app.core.AppDisplayScale;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
public class BrowserIconManager {
|
||||
@@ -18,7 +18,7 @@ public class BrowserIconManager {
|
||||
}
|
||||
|
||||
public static void loadIfNecessary(String s) {
|
||||
var res = AppScale.hasDefaultDisplayScale() ? "24" : "40";
|
||||
var res = AppDisplayScale.hasDefaultDisplayScale() ? "24" : "40";
|
||||
var key = "browser/" + FilenameUtils.getBaseName(s) + "-" + res + ".png";
|
||||
if (AppImages.hasImage(key)) {
|
||||
return;
|
||||
|
||||
@@ -2,16 +2,12 @@ package io.xpipe.app.comp.base;
|
||||
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.core.AppImages;
|
||||
import io.xpipe.app.core.AppScale;
|
||||
import io.xpipe.app.core.window.AppMainWindow;
|
||||
import io.xpipe.app.core.AppDisplayScale;
|
||||
import io.xpipe.app.platform.BindingsHelper;
|
||||
import io.xpipe.core.FilePath;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.ReadOnlyStringWrapper;
|
||||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.value.ObservableDoubleValue;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
import java.util.Optional;
|
||||
@@ -47,7 +43,7 @@ public class PrettyImageHelper {
|
||||
return rasterizedImageIfExists(img, height).orElse(null);
|
||||
}
|
||||
|
||||
var scale = AppScale.getEffectiveDisplayScale();
|
||||
var scale = AppDisplayScale.getEffectiveDisplayScale();
|
||||
var mult = Math.round(scale * height);
|
||||
var base = FilePath.of(img).getBaseName();
|
||||
var available = IntStream.of(availableSizes)
|
||||
|
||||
+7
-3
@@ -3,7 +3,9 @@ package io.xpipe.app.core;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import javafx.stage.Screen;
|
||||
|
||||
public class AppScale {
|
||||
public class AppDisplayScale {
|
||||
|
||||
private static Double screenOutputScale;
|
||||
|
||||
public static boolean hasDefaultDisplayScale() {
|
||||
return getEffectiveDisplayScale() == 1.0;
|
||||
@@ -19,7 +21,9 @@ public class AppScale {
|
||||
}
|
||||
}
|
||||
|
||||
var def = Screen.getPrimary().getOutputScaleX();
|
||||
return def;
|
||||
if (screenOutputScale == null) {
|
||||
screenOutputScale = Screen.getPrimary().getOutputScaleX();
|
||||
}
|
||||
return screenOutputScale;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.xpipe.app.core;
|
||||
|
||||
import io.xpipe.app.core.window.AppMainWindow;
|
||||
import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.issue.TrackEvent;
|
||||
|
||||
@@ -16,8 +15,6 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
@@ -43,7 +40,7 @@ public class AppImages {
|
||||
var exts = AppExtensionManager.getInstance().getContentModules();
|
||||
for (Module ext : exts) {
|
||||
AppResources.with(ext.getName(), "img/", basePath -> {
|
||||
var skipLarge = AppScale.hasDefaultDisplayScale();
|
||||
var skipLarge = AppDisplayScale.hasDefaultDisplayScale();
|
||||
Files.walkFileTree(basePath, new SimpleFileVisitor<>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
|
||||
@@ -62,7 +59,7 @@ public class AppImages {
|
||||
|
||||
private static void loadOsIcons() {
|
||||
AppResources.with(AppResources.MAIN_MODULE, "os", basePath -> {
|
||||
var skipLarge = AppScale.hasDefaultDisplayScale();
|
||||
var skipLarge = AppDisplayScale.hasDefaultDisplayScale();
|
||||
Files.walkFileTree(basePath, new SimpleFileVisitor<>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
|
||||
@@ -80,7 +77,7 @@ public class AppImages {
|
||||
|
||||
private static void loadWelcomeImages() {
|
||||
AppResources.with(AppResources.MAIN_MODULE, "welcome", basePath -> {
|
||||
var skipLarge = AppScale.hasDefaultDisplayScale();
|
||||
var skipLarge = AppDisplayScale.hasDefaultDisplayScale();
|
||||
Files.walkFileTree(basePath, new SimpleFileVisitor<>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
package io.xpipe.app.icon;
|
||||
|
||||
import io.xpipe.app.core.*;
|
||||
import io.xpipe.app.core.window.AppMainWindow;
|
||||
import io.xpipe.app.ext.ValidationException;
|
||||
import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.*;
|
||||
|
||||
public class SystemIconManager {
|
||||
@@ -76,7 +72,7 @@ public class SystemIconManager {
|
||||
}
|
||||
|
||||
var dir = SystemIconCache.getDirectory(icon.getSource());
|
||||
var res = AppScale.hasDefaultDisplayScale() ? List.of(16, 24, 40) : List.of(16, 24, 40, 80);
|
||||
var res = AppDisplayScale.hasDefaultDisplayScale() ? List.of(16, 24, 40) : List.of(16, 24, 40, 80);
|
||||
var files = new ArrayList<Path>();
|
||||
for (Integer re : res) {
|
||||
files.add(dir.resolve(icon.getId() + "-" + re + ".png"));
|
||||
|
||||
Reference in New Issue
Block a user