From 24620210fe984456ad4622cabbc889f921181e7e Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Wed, 3 Sep 2025 10:43:00 -0400 Subject: [PATCH] Launcher: improved clipboard images look --- Modules/Launcher/Launcher.qml | 20 +++++++------------- Modules/Launcher/Plugins/ClipboardPlugin.qml | 2 +- Widgets/NImageRounded.qml | 4 ++++ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Modules/Launcher/Launcher.qml b/Modules/Launcher/Launcher.qml index 9317675..9f78a9d 100644 --- a/Modules/Launcher/Launcher.qml +++ b/Modules/Launcher/Launcher.qml @@ -295,30 +295,24 @@ NPanel { color: Color.mSurfaceVariant clip: true + // Image preview for clipboard images - Image { + NImageRounded { id: imagePreview anchors.fill: parent - anchors.margins: 2 * scaling visible: modelData.isImage + imageRadius: Style.radiusM * scaling // This property creates a dependency on the service's revision counter readonly property int _rev: ClipboardService.revision // Fetches from the service's cache. - // The dependency on `_rev` ensures this binding is re-evaluated - // when the cache is updated by the service. - source: { + // The dependency on `_rev` ensures this binding is re-evaluated when the cache is updated. + imagePath: { _rev return ClipboardService.getImageData(modelData.clipboardId) || "" } - fillMode: Image.PreserveAspectFit - smooth: true - mipmap: true - asynchronous: true - cache: true - // Loading indicator Rectangle { anchors.fill: parent @@ -379,8 +373,8 @@ NPanel { anchors.margins: 2 * scaling width: formatLabel.width + 6 * scaling height: formatLabel.height + 2 * scaling - radius: 2 * scaling - color: Qt.rgba(0, 0, 0, 0.7) + radius: Style.radiusM * scaling + color: Color.mSurfaceVariant NText { id: formatLabel diff --git a/Modules/Launcher/Plugins/ClipboardPlugin.qml b/Modules/Launcher/Plugins/ClipboardPlugin.qml index 26087e0..00cfb44 100644 --- a/Modules/Launcher/Plugins/ClipboardPlugin.qml +++ b/Modules/Launcher/Plugins/ClipboardPlugin.qml @@ -22,7 +22,7 @@ Item { Connections { target: ClipboardService function onListCompleted() { - if (gotResults) { + if (gotResults && (lastSearchText === searchText)) { // Do not update results after the first fetch. // This will avoid the list resetting every 2seconds when the service updates. return diff --git a/Widgets/NImageRounded.qml b/Widgets/NImageRounded.qml index 14ff263..76654fc 100644 --- a/Widgets/NImageRounded.qml +++ b/Widgets/NImageRounded.qml @@ -16,6 +16,8 @@ Rectangle { property real scaledRadius: imageRadius * Settings.data.general.radiusRatio + signal statusChanged(int status) + color: Color.transparent radius: scaledRadius anchors.margins: Style.marginXXS * scaling @@ -34,6 +36,8 @@ Rectangle { asynchronous: true antialiasing: true fillMode: Image.PreserveAspectCrop + + onStatusChanged: root.statusChanged(status) } ShaderEffect {