feat: initial video wallpaper implementation

This commit is contained in:
2026-10-25 02:10:50 +02:00
parent 200a6a5d54
commit 0d0faecb1c
14 changed files with 1280 additions and 88 deletions
+26 -1
View File
@@ -18,6 +18,8 @@ Searcher {
property string actualCurrent: WallpaperPath.currentWallpaperPath
property alias crops: adapter.monitorCrops
readonly property string current: showPreview ? previewPath : actualCurrent
readonly property string currentThumbnail: thumbnailFor(current)
readonly property bool currentIsVideo: isVideoPath(current)
property alias monitorCrops: monitorCrops
property bool pendingPreviewClear
property bool previewColorLock
@@ -32,6 +34,29 @@ Searcher {
return category;
}
readonly property var videoExts: ["mp4", "mkv", "webm", "avi", "mov", "wmv", "flv", "m4v", "mpg", "mpeg", "3gp", "ogv", "ts", "vob"]
function isVideoPath(path: string): bool {
if (!path)
return false;
const dot = path.lastIndexOf(".");
if (dot < 0)
return false;
return videoExts.includes(path.slice(dot + 1).toLowerCase());
}
function thumbnailFor(path: string): string {
if (!isVideoPath(path))
return path;
for (const entry of root.list) {
if (entry.path === path && entry.thumbnailPath)
return entry.thumbnailPath;
}
return path;
}
function getCrop(screen: string): var {
return root.crops[screen];
}
@@ -125,7 +150,7 @@ Searcher {
FileSystemModel {
id: wallpapers
filter: FileSystemModel.Images
filter: FileSystemModel.Media
path: Config.general.wallpaperPath
recursive: true
}