[vlc-devel] [PATCH 5/6] qml: make artwork info control theme aware

Fatih Uzunoglu fuzun54 at outlook.com
Fri Nov 20 19:32:34 CET 2020


set '_colors' property when forcing colors
---
 modules/gui/qt/player/qml/ControlButtons.qml  | 11 ++++++++---
 .../gui/qt/player/qml/PlayerButtonsLayout.qml | 19 +++++++++++++------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index f9b41cacdd..b5a34d3761 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -780,7 +780,9 @@ Item{
 
         Widgets.FocusBackground {
             id: artworkInfoItem
+
             property bool paintOnly: false
+            property VLCColors _colors: VLCStyle.colors
 
             implicitWidth: playingItemInfoRow.implicitWidth
             implicitHeight: playingItemInfoRow.implicitHeight
@@ -814,7 +816,7 @@ Item{
                     Rectangle {
                         id: coverRect
                         anchors.fill: cover
-                        color: VLCStyle.colors.bg
+                        color: _colors.bg
                     }
 
                     DropShadow {
@@ -851,11 +853,11 @@ Item{
                          
                         contentItem: Text {
                                   text: i18n.qtr("%1\n%2").arg(titleLabel.text).arg(artistLabel.text)
-                                  color: VLCStyle.colors.tooltipTextColor
+                                  color: _colors.tooltipTextColor
                         }
 
                         background: Rectangle {
-                            color: VLCStyle.colors.tooltipColor
+                            color: _colors.tooltipColor
                         }
                     }
 
@@ -864,6 +866,7 @@ Item{
                         width: implicitWidth < VLCStyle.artworkInfoTextWidth ? implicitWidth : VLCStyle.artworkInfoTextWidth
                         text: mainPlaylistController.currentItem.title
                         visible: text !== ""
+                        color: _colors.text
                     }
 
                     Widgets.MenuCaption {
@@ -871,12 +874,14 @@ Item{
                         width: implicitWidth < VLCStyle.artworkInfoTextWidth ? implicitWidth : VLCStyle.artworkInfoTextWidth
                         text: mainPlaylistController.currentItem.artist
                         visible: text !== ""
+                        color: _colors.menuCaption
                     }
 
                     Widgets.MenuCaption {
                         id: progressIndicator
                         text: player.time.toString() + " / " + player.length.toString()
                         visible: text !== ""
+                        color: _colors.menuCaption
                     }
                 }
             }
diff --git a/modules/gui/qt/player/qml/PlayerButtonsLayout.qml b/modules/gui/qt/player/qml/PlayerButtonsLayout.qml
index 6d5d3ea077..a42267bb8f 100644
--- a/modules/gui/qt/player/qml/PlayerButtonsLayout.qml
+++ b/modules/gui/qt/player/qml/PlayerButtonsLayout.qml
@@ -51,6 +51,8 @@ RowLayout{
 
     spacing: VLCStyle.margin_normal
 
+    VLCColors {id: vlcNightColors; state: "night"}
+
     Repeater{
         id: buttonsRepeater
 
@@ -76,12 +78,17 @@ RowLayout{
 
                 //force buttons color
                 if (playerButtonsLayout.forceColors) {
-                    if ( buttonloader.item.color )
-                        buttonloader.item.color = VLCStyle.colors.playerFg
-                    if ( buttonloader.item.bgColor )
-                        buttonloader.item.bgColor = VLCStyle.colors.setColorAlpha(VLCStyle.colors.playerBg, 0.8)
-                    if ( buttonloader.item.borderColor )
-                        buttonloader.item.borderColor = VLCStyle.colors.playerBorder
+                    if ( buttonloader.item._colors ) {
+                        buttonloader.item._colors = vlcNightColors
+                    }
+                    else {
+                        if ( buttonloader.item.color )
+                            buttonloader.item.color = VLCStyle.colors.playerFg
+                        if ( buttonloader.item.bgColor )
+                            buttonloader.item.bgColor = VLCStyle.colors.setColorAlpha(VLCStyle.colors.playerBg, 0.8)
+                        if ( buttonloader.item.borderColor )
+                            buttonloader.item.borderColor = VLCStyle.colors.playerBorder
+                    }
                 }
 
                 if (index > 0)
-- 
2.27.0



More information about the vlc-devel mailing list