vlc | branch: master | Prince Gupta <guptaprince8...@gmail.com> | Tue Jan 12 
17:23:19 2021 +0530| [38af5d81cbe6988604d812372bf640853c2c9b8f] | committer: 
Pierre Lamot

qml: change color scheme of Player widget based on media cover

Signed-off-by: Pierre Lamot <pie...@videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=38af5d81cbe6988604d812372bf640853c2c9b8f
---

 modules/gui/qt/player/qml/Player.qml | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt/player/qml/Player.qml 
b/modules/gui/qt/player/qml/Player.qml
index eb1c179893..be4cde2d53 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -36,8 +36,11 @@ Widgets.NavigableFocusScope {
 
     property bool hasEmbededVideo: mainInterface.hasEmbededVideo
     readonly property int positionSliderY: controlBarView.y + 
VLCStyle.fontHeight_normal + VLCStyle.margin_small
-
-    property VLCColors colors: VLCStyle.nightColors
+    readonly property string coverSource: 
(mainPlaylistController.currentItem.artwork && 
mainPlaylistController.currentItem.artwork.toString())
+                                          ? 
mainPlaylistController.currentItem.artwork
+                                          : VLCStyle.noArtCover
+    readonly property VLCColors colors: (mainInterface.hasEmbededVideo || 
(coverLuminance.luminance < 140))
+                                        ? VLCStyle.nightColors : 
VLCStyle.dayColors
 
     function dismiss() {
         if (_menu)
@@ -76,6 +79,13 @@ Widgets.NavigableFocusScope {
         }
     }
 
+    ImageLuminanceExtractor {
+        id: coverLuminance
+
+        enabled: !rootPlayer.hasEmbededVideo
+        source: rootPlayer.coverSource
+    }
+
     Widgets.DrawerExt {
         id: csdGroup
 
@@ -334,9 +344,8 @@ Widgets.NavigableFocusScope {
 
                     Image {
                         id: cover
-                        source: (mainPlaylistController.currentItem.artwork && 
mainPlaylistController.currentItem.artwork.toString())
-                                ? mainPlaylistController.currentItem.artwork
-                                : VLCStyle.noArtCover
+
+                        source: rootPlayer.coverSource
                         fillMode: Image.PreserveAspectFit
 
                         //source aspect ratio

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to