From cf4c4b7d6987eb4d29299a443cd86f590b70934e Mon Sep 17 00:00:00 2001 From: purian23 Date: Sun, 1 Mar 2026 00:45:38 -0500 Subject: [PATCH] clipboard: Fix thumbnail load & modal bottom margin --- .../Modals/Clipboard/ClipboardContent.qml | 20 +++---------------- .../Modals/Clipboard/ClipboardThumbnail.qml | 10 +++++----- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/quickshell/Modals/Clipboard/ClipboardContent.qml b/quickshell/Modals/Clipboard/ClipboardContent.qml index 12eadc0a..58f07be2 100644 --- a/quickshell/Modals/Clipboard/ClipboardContent.qml +++ b/quickshell/Modals/Clipboard/ClipboardContent.qml @@ -86,7 +86,7 @@ Item { anchors.bottom: parent.bottom anchors.leftMargin: Theme.spacingM anchors.rightMargin: Theme.spacingM - anchors.bottomMargin: modal.showKeyboardHints ? (ClipboardConstants.keyboardHintsHeight + Theme.spacingM * 2) : 0 + anchors.bottomMargin: (modal.showKeyboardHints ? (ClipboardConstants.keyboardHintsHeight + Theme.spacingM * 2) : 0) + Theme.spacingXS clip: true DankListView { @@ -112,14 +112,7 @@ Item { if (index < 0 || index >= count) { return; } - const itemHeight = ClipboardConstants.itemHeight + spacing; - const itemY = index * itemHeight; - const itemBottom = itemY + itemHeight; - if (itemY < contentY) { - contentY = itemY; - } else if (itemBottom > contentY + height) { - contentY = itemBottom - height; - } + positionViewAtIndex(index, ListView.Contain); } onCurrentIndexChanged: { @@ -178,14 +171,7 @@ Item { if (index < 0 || index >= count) { return; } - const itemHeight = ClipboardConstants.itemHeight + spacing; - const itemY = index * itemHeight; - const itemBottom = itemY + itemHeight; - if (itemY < contentY) { - contentY = itemY; - } else if (itemBottom > contentY + height) { - contentY = itemBottom - height; - } + positionViewAtIndex(index, ListView.Contain); } onCurrentIndexChanged: { diff --git a/quickshell/Modals/Clipboard/ClipboardThumbnail.qml b/quickshell/Modals/Clipboard/ClipboardThumbnail.qml index 771d8541..26a92109 100644 --- a/quickshell/Modals/Clipboard/ClipboardThumbnail.qml +++ b/quickshell/Modals/Clipboard/ClipboardThumbnail.qml @@ -31,13 +31,13 @@ Item { sourceSize.height: 128 function tryLoadImage() { - if (loadQueued || entryType !== "image" || cachedImageData) { + if (thumbnailImage.loadQueued || entryType !== "image" || thumbnailImage.cachedImageData) { return; } - loadQueued = true; + thumbnailImage.loadQueued = true; if (modal.activeImageLoads < modal.maxConcurrentLoads) { modal.activeImageLoads++; - loadImage(); + thumbnailImage.loadImage(); } else { retryTimer.restart(); } @@ -47,7 +47,7 @@ Item { DMSService.sendRequest("clipboard.getEntry", { "id": entry.id }, function (response) { - loadQueued = false; + thumbnailImage.loadQueued = false; if (modal.activeImageLoads > 0) { modal.activeImageLoads--; } @@ -57,7 +57,7 @@ Item { } const data = response.result?.data; if (data) { - cachedImageData = data; + thumbnailImage.cachedImageData = data; } }); }