Launcher: improved clipboard images look

This commit is contained in:
LemmyCook 2025-09-03 10:43:00 -04:00
parent 7b2d490ba7
commit 24620210fe
3 changed files with 12 additions and 14 deletions

View file

@ -295,30 +295,24 @@ NPanel {
color: Color.mSurfaceVariant color: Color.mSurfaceVariant
clip: true clip: true
// Image preview for clipboard images // Image preview for clipboard images
Image { NImageRounded {
id: imagePreview id: imagePreview
anchors.fill: parent anchors.fill: parent
anchors.margins: 2 * scaling
visible: modelData.isImage visible: modelData.isImage
imageRadius: Style.radiusM * scaling
// This property creates a dependency on the service's revision counter // This property creates a dependency on the service's revision counter
readonly property int _rev: ClipboardService.revision readonly property int _rev: ClipboardService.revision
// Fetches from the service's cache. // Fetches from the service's cache.
// The dependency on `_rev` ensures this binding is re-evaluated // The dependency on `_rev` ensures this binding is re-evaluated when the cache is updated.
// when the cache is updated by the service. imagePath: {
source: {
_rev _rev
return ClipboardService.getImageData(modelData.clipboardId) || "" return ClipboardService.getImageData(modelData.clipboardId) || ""
} }
fillMode: Image.PreserveAspectFit
smooth: true
mipmap: true
asynchronous: true
cache: true
// Loading indicator // Loading indicator
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
@ -379,8 +373,8 @@ NPanel {
anchors.margins: 2 * scaling anchors.margins: 2 * scaling
width: formatLabel.width + 6 * scaling width: formatLabel.width + 6 * scaling
height: formatLabel.height + 2 * scaling height: formatLabel.height + 2 * scaling
radius: 2 * scaling radius: Style.radiusM * scaling
color: Qt.rgba(0, 0, 0, 0.7) color: Color.mSurfaceVariant
NText { NText {
id: formatLabel id: formatLabel

View file

@ -22,7 +22,7 @@ Item {
Connections { Connections {
target: ClipboardService target: ClipboardService
function onListCompleted() { function onListCompleted() {
if (gotResults) { if (gotResults && (lastSearchText === searchText)) {
// Do not update results after the first fetch. // Do not update results after the first fetch.
// This will avoid the list resetting every 2seconds when the service updates. // This will avoid the list resetting every 2seconds when the service updates.
return return

View file

@ -16,6 +16,8 @@ Rectangle {
property real scaledRadius: imageRadius * Settings.data.general.radiusRatio property real scaledRadius: imageRadius * Settings.data.general.radiusRatio
signal statusChanged(int status)
color: Color.transparent color: Color.transparent
radius: scaledRadius radius: scaledRadius
anchors.margins: Style.marginXXS * scaling anchors.margins: Style.marginXXS * scaling
@ -34,6 +36,8 @@ Rectangle {
asynchronous: true asynchronous: true
antialiasing: true antialiasing: true
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
onStatusChanged: root.statusChanged(status)
} }
ShaderEffect { ShaderEffect {