mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-06 05:28:29 -04:00
@@ -41,13 +41,18 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reloadPreview() {
|
function reloadPreview() {
|
||||||
cachedImageData = "";
|
|
||||||
cachedMimeType = "";
|
|
||||||
if (!canLoadImage || !entry?.id) {
|
if (!canLoadImage || !entry?.id) {
|
||||||
_requestedEntryId = null;
|
_requestedEntryId = null;
|
||||||
|
cachedImageData = "";
|
||||||
|
cachedMimeType = "";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Entry objects are rebuilt per search; same id means same content
|
||||||
|
if (entry.id === _requestedEntryId)
|
||||||
|
return;
|
||||||
|
|
||||||
|
cachedImageData = "";
|
||||||
|
cachedMimeType = "";
|
||||||
const entryId = entry.id;
|
const entryId = entry.id;
|
||||||
_requestedEntryId = entryId;
|
_requestedEntryId = entryId;
|
||||||
DMSService.sendRequest("clipboard.getEntry", {
|
DMSService.sendRequest("clipboard.getEntry", {
|
||||||
@@ -78,6 +83,8 @@ Rectangle {
|
|||||||
asynchronous: true
|
asynchronous: true
|
||||||
cache: false
|
cache: false
|
||||||
smooth: true
|
smooth: true
|
||||||
|
sourceSize.width: 128
|
||||||
|
sourceSize.height: 128
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
visible: status === Image.Ready
|
visible: status === Image.Ready
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ Item {
|
|||||||
if (query !== effectiveQuery)
|
if (query !== effectiveQuery)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
searchDebounce.restart();
|
root.requestSearch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,10 +380,29 @@ Item {
|
|||||||
property bool _pluginPhaseForceFirst: false
|
property bool _pluginPhaseForceFirst: false
|
||||||
property var _phase1Items: []
|
property var _phase1Items: []
|
||||||
|
|
||||||
|
property bool _searchPending: false
|
||||||
|
|
||||||
|
// Leading-edge debounce: search immediately when idle, coalesce bursts
|
||||||
|
function requestSearch() {
|
||||||
|
if (searchDebounce.running) {
|
||||||
|
_searchPending = true;
|
||||||
|
searchDebounce.restart();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_searchPending = false;
|
||||||
|
performSearch();
|
||||||
|
searchDebounce.restart();
|
||||||
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: searchDebounce
|
id: searchDebounce
|
||||||
interval: 60
|
interval: 60
|
||||||
onTriggered: root.performSearch()
|
onTriggered: {
|
||||||
|
if (!root._searchPending)
|
||||||
|
return;
|
||||||
|
root._searchPending = false;
|
||||||
|
root.performSearch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
@@ -409,7 +428,7 @@ Item {
|
|||||||
_phase1Items = [];
|
_phase1Items = [];
|
||||||
pluginPhaseTimer.stop();
|
pluginPhaseTimer.stop();
|
||||||
searchQuery = query;
|
searchQuery = query;
|
||||||
searchDebounce.restart();
|
requestSearch();
|
||||||
|
|
||||||
if (searchMode !== "plugins" && query.startsWith("/")) {
|
if (searchMode !== "plugins" && query.startsWith("/")) {
|
||||||
var prefix = Utils.parseFileSearchPrefix(query);
|
var prefix = Utils.parseFileSearchPrefix(query);
|
||||||
@@ -1871,7 +1890,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function executeSelected() {
|
function executeSelected() {
|
||||||
if (searchDebounce.running) {
|
if (_searchPending) {
|
||||||
|
_searchPending = false;
|
||||||
searchDebounce.stop();
|
searchDebounce.stop();
|
||||||
performSearch();
|
performSearch();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
readonly property bool hasClipboardPreview: item?.type === "clipboard" && item?.data?.isImage === true && (item?.data?.mimeType ?? "").startsWith("image/")
|
readonly property bool hasClipboardPreview: item?.type === "clipboard" && item?.data?.isImage === true && (item?.data?.mimeType ?? "").startsWith("image/")
|
||||||
readonly property bool hasMediaPreview: previewSource.length > 0 || hasClipboardPreview
|
readonly property bool hasMediaPreview: previewSource.length > 0 || hasClipboardPreview
|
||||||
readonly property bool previewAnimated: previewSource.toLowerCase().indexOf(".gif") >= 0
|
|
||||||
|
|
||||||
readonly property string typeLabel: {
|
readonly property string typeLabel: {
|
||||||
if (!item)
|
if (!item)
|
||||||
@@ -284,16 +283,10 @@ Rectangle {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: root.previewSource
|
source: root.previewSource
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
sourceSize.width: 128
|
||||||
|
sourceSize.height: 128
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
visible: !root.hasClipboardPreview && !root.previewAnimated
|
visible: !root.hasClipboardPreview
|
||||||
}
|
|
||||||
|
|
||||||
AnimatedImage {
|
|
||||||
anchors.fill: parent
|
|
||||||
source: root.previewSource
|
|
||||||
fillMode: Image.PreserveAspectCrop
|
|
||||||
playing: visible
|
|
||||||
visible: !root.hasClipboardPreview && root.previewAnimated
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipboardLauncherPreview {
|
ClipboardLauncherPreview {
|
||||||
|
|||||||
@@ -165,6 +165,9 @@ Rectangle {
|
|||||||
anchors.margins: root.hasScreencopy ? 4 : 0
|
anchors.margins: root.hasScreencopy ? 4 : 0
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
source: root.item?.data?.attribution || ""
|
source: root.item?.data?.attribution || ""
|
||||||
|
asynchronous: true
|
||||||
|
sourceSize.width: 80
|
||||||
|
sourceSize.height: 80
|
||||||
mipmap: true
|
mipmap: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
imagePath: root.imagePath
|
imagePath: root.imagePath
|
||||||
maxCacheSize: root.iconSize * 2
|
maxCacheSize: root.iconSize * 2
|
||||||
|
animate: false
|
||||||
visible: root.isImage && status === Image.Ready
|
visible: root.isImage && status === Image.Ready
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user