From 13c36ba741ed9a8acf36b1b84e2f1ca818c3625c Mon Sep 17 00:00:00 2001 From: hat3ph <88069788+hat3ph@users.noreply.github.com> Date: Wed, 6 Dec 2023 06:54:20 +0800 Subject: [PATCH] add animated gif support --- Main.qml | 32 ++++++++++++++++++++++++++++++-- README.md | 4 ++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Main.qml b/Main.qml index 0b14f23..9d32221 100644 --- a/Main.qml +++ b/Main.qml @@ -49,6 +49,14 @@ Rectangle { fillMode: Image.PreserveAspectCrop } + // Set Animated GIF Background Image + AnimatedImage { + id: animatedGIF1 + anchors.fill: parent + //source: "mepwyd8.gif" + fillMode: AnimatedImage.PreserveAspectCrop + } + // Set Background Video1 MediaPlayer { id: mediaplayer1 @@ -510,11 +518,31 @@ Rectangle { if ( time >= config.day_time_start && time <= config.day_time_end ) { playlist1.load(Qt.resolvedUrl(config.background_vid_day), 'm3u') playlist2.load(Qt.resolvedUrl(config.background_vid_day), 'm3u') - image1.source = config.background_img_day + //image1.source = config.background_img_day + if ( config.backgroud_img_day !== null ) { + //image1.source = config.background_img_day + var fileType = config.background_img_day.substring(config.background_img_day.lastIndexOf(".") + 1) + console.log(fileType) + if (fileType === "gif") { + animatedGIF1.source = config.background_img_day + } else { + image1.source = config.background_img_day + } + } } else { playlist1.load(Qt.resolvedUrl(config.background_vid_night), 'm3u') playlist2.load(Qt.resolvedUrl(config.background_vid_night), 'm3u') - image1.source = config.background_img_night + //image1.source = config.background_img_night + if ( config.backgroud_img_night !== null ) { + //image1.source = config.background_img_night + var fileType = config.background_img_night.substring(config.background_img_night.lastIndexOf(".") + 1) + console.log(fileType) + if (fileType === "gif") { + animatedGIF1.source = config.background_img_night + } else { + image1.source = config.background_img_night + } + } } for (var k = 0; k < Math.ceil(Math.random() * 10) ; k++) { diff --git a/README.md b/README.md index 432ab67..e29b672 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ SDDM theme with Apple TV Aerial videos -Videos are played randomly and diferent playlists are used based on time of day (only day and night diferenciation, night between 5pm - 5am) its possible to tweak to have more time diferentiation, the one used is provided with the videos. +Videos are played randomly and different playlists are used based on time of day (only day and night diferenciation, night between 5pm - 5am) its possible to tweak to have more time diferentiation, the one used is provided with the videos. ### Dependencies @@ -58,7 +58,7 @@ done < playlist_file You can change a few settings in this file - `day_time_start` and `day_time_end` - set your day start/end time -- `background_img_day` and `background_img_night` - default background day/night image +- `background_img_day` and `background_img_night` - default background day/night image, now support GIF animated image - `background_vid_day` and `background_vid_night` - video playlists - `displayFont` - font - `showLoginButton` - if set to false will hide the login button