plugins: stipe dupe plugin previews & add fallback support

This commit is contained in:
purian23
2026-10-06 17:57:16 -04:00
parent 089dc98166
commit 54eb0ccaed
3 changed files with 23 additions and 2 deletions
+11 -2
View File
@@ -13,7 +13,8 @@ DCard {
property bool installed: false
property bool selected: false
property string fallbackIcon: "extension"
property string previewSource: PluginService.previewUrl(plugin)
property string previewSource: PluginService.thumbUrl(plugin)
property string previewFallback: PluginService.previewUrl(plugin)
property var badges: PluginService.badgeModel(plugin)
property bool allowUninstall: false
property var palette: null
@@ -50,12 +51,20 @@ DCard {
CachingImage {
id: cardPreview
property bool useFallback: false
anchors.fill: parent
imagePath: root.previewSource
imagePath: useFallback ? root.previewFallback : root.previewSource
maxCacheSize: 640
fillMode: Image.PreserveAspectCrop
animate: false
visible: status === Image.Ready
onStatusChanged: {
if (status !== Image.Error || useFallback || !root.previewFallback || root.previewFallback === root.previewSource)
return;
useFallback = true;
}
}
DIcon {
@@ -372,6 +372,7 @@ RegistryBrowserWindow {
busy: !!root.pendingThemes[cardCell.modelData.id]
fallbackIcon: "palette"
previewSource: root.themePreviewUrl(cardCell.modelData)
previewFallback: ""
badges: root.themeBadges(cardCell.modelData)
palette: root.themePalette(cardCell.modelData)
allowUninstall: true
+11
View File
@@ -1294,6 +1294,17 @@ Singleton {
return plugin.screenshot || "";
}
// 16:10 screenshot-only render; the full preview card bakes in title text the card already shows
function thumbUrl(plugin) {
if (!plugin)
return "";
if (plugin.thumbUrl)
return plugin.thumbUrl;
if (plugin.id)
return previewApiBase + plugin.id + "/thumb";
return "";
}
function heroUrl(plugin) {
if (!plugin)
return "";