[vlc-devel] [PATCH 04/55] qml: use global VLCColors instance when forcing night theme

Fatih Uzunoglu fuzun54 at outlook.com
Thu Jan 7 21:36:17 UTC 2021


instead of creating separate local VLCColors instances, use the one added to the VLCStyle file instead when forcing night theme for items.
---
 modules/gui/qt/player/qml/ButtonsLayout.qml   | 43 ++++++++-----------
 modules/gui/qt/player/qml/ControlBar.qml      |  2 +-
 modules/gui/qt/player/qml/ControlButtons.qml  | 15 ++++---
 modules/gui/qt/player/qml/Player.qml          |  2 +-
 .../gui/qt/player/qml/PlayerButtonsLayout.qml | 20 +--------
 modules/gui/qt/playlist/qml/PLItem.qml        | 16 +++----
 .../gui/qt/playlist/qml/PlaylistListView.qml  | 43 +++++++++----------
 .../gui/qt/playlist/qml/PlaylistToolbar.qml   | 18 ++++----
 modules/gui/qt/widgets/qml/DNDLabel.qml       | 18 ++++----
 modules/gui/qt/widgets/qml/OverlayMenu.qml    | 17 +++-----
 modules/gui/qt/widgets/qml/SortControl.qml    | 20 ++++-----
 11 files changed, 90 insertions(+), 124 deletions(-)

diff --git a/modules/gui/qt/player/qml/ButtonsLayout.qml b/modules/gui/qt/player/qml/ButtonsLayout.qml
index d4a44b19de..a7b5f0fd9b 100644
--- a/modules/gui/qt/player/qml/ButtonsLayout.qml
+++ b/modules/gui/qt/player/qml/ButtonsLayout.qml
@@ -29,16 +29,12 @@ Widgets.NavigableFocusScope {
     id: buttonsLayout
 
     property alias model: buttonsRepeater.model
-    property var defaultSize: VLCStyle.icon_normal
-    property bool forceColors: false
 
     property real _minimumWidth: 0 // minimumWidth without spacing (minimumWidth of all controls inside)
     property real minimumWidth: _minimumWidth + ((buttonsRepeater.count - 1) * buttonrow.spacing) // minimumWidth with spacing
     property real extraWidth: undefined
     property int expandableCount: 0 // widget count that can expand when extra width is available
 
-    property alias spacing: buttonrow.spacing
-
     implicitWidth: buttonrow.implicitWidth
     implicitHeight: buttonrow.implicitHeight
 
@@ -56,12 +52,7 @@ Widgets.NavigableFocusScope {
 
         anchors.fill: parent
 
-        spacing: VLCStyle.margin_normal
-
-        VLCColors {
-            id: vlcNightColors
-            state: "night"
-        }
+        spacing: playerButtonsLayout.spacing
 
         Repeater {
             id: buttonsRepeater
@@ -93,25 +84,25 @@ Widgets.NavigableFocusScope {
                     buttonloader.item.focus = true
 
                     if (buttonloader.item instanceof Widgets.IconToolButton)
-                        buttonloader.item.size = Qt.binding(function() { return buttonsLayout.defaultSize; })
-
-                    //force buttons color
-                    if (buttonsLayout.forceColors) {
-                        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
-                        }
+                        buttonloader.item.size = Qt.binding(function() { return defaultSize; })
+
+                    // force colors:
+                    if (!!colors) {
+                        if (!!buttonloader.item.colors)
+                            buttonloader.item.colors = Qt.binding(function() { return colors; })
+                        else
+                            // legacy color forcing for IconToolButton etc. :
+                            if (!!buttonloader.item.color)
+                                buttonloader.item.color = Qt.binding(function() { return colors.playerFg; })
+                            if (!!buttonloader.item.bgColor)
+                                buttonloader.item.bgColor = Qt.binding(function() {
+                                    return VLCStyle.colors.setColorAlpha(colors.playerBg, 0.8); })
+                            if (!!buttonloader.item.borderColor)
+                                buttonloader.item.borderColor = Qt.binding(function() { return colors.playerBorder; })
                     }
 
                     if (index > 0)
-                        buttonloader.item.KeyNavigation.left = buttonrow.children[index].item
+                        buttonloader.item.KeyNavigation.left = buttonrow.children[index-1].item
 
                     if (buttonloader.item.navigationRight !== undefined)
                         buttonloader.item.navigationRight = buttonsLayout.navigationRight
diff --git a/modules/gui/qt/player/qml/ControlBar.qml b/modules/gui/qt/player/qml/ControlBar.qml
index df1bda49d5..6b4b9c4565 100644
--- a/modules/gui/qt/player/qml/ControlBar.qml
+++ b/modules/gui/qt/player/qml/ControlBar.qml
@@ -109,7 +109,7 @@ Widgets.NavigableFocusScope {
 
                 navigationUpItem: trackPositionSlider.enabled ? trackPositionSlider : root.navigationUpItem
 
-                forceColors: true
+                colors: VLCStyle.nightColors
             }
         }
     }
diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index 8a5023dbb5..25c3615ba9 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -777,7 +777,8 @@ Item{
             id: artworkInfoItem
 
             property bool paintOnly: false
-            property VLCColors _colors: VLCStyle.colors
+
+            property VLCColors colors: VLCStyle.colors
 
             readonly property real minimumWidth: cover.width
             property real extraWidth: 0
@@ -817,7 +818,7 @@ Item{
                     Rectangle {
                         id: coverRect
                         anchors.fill: cover
-                        color: _colors.bg
+                        color: colors.bg
                     }
 
                     DropShadow {
@@ -864,11 +865,11 @@ Item{
                          
                         contentItem: Text {
                                   text: i18n.qtr("%1\n%2").arg(titleLabel.text).arg(artistLabel.text)
-                                  color: _colors.tooltipTextColor
+                                  color: colors.tooltipTextColor
                         }
 
                         background: Rectangle {
-                            color: _colors.tooltipColor
+                            color: colors.tooltipColor
                         }
                     }
 
@@ -887,7 +888,7 @@ Item{
                                 mainPlaylistController.currentItem.title
                         }
                         visible: text !== ""
-                        color: _colors.text
+                        color: colors.text
                     }
 
                     Widgets.MenuCaption {
@@ -903,7 +904,7 @@ Item{
                                 mainPlaylistController.currentItem.artist
                         }
                         visible: text !== ""
-                        color: _colors.menuCaption
+                        color: colors.menuCaption
                     }
 
                     Widgets.MenuCaption {
@@ -919,7 +920,7 @@ Item{
                                 player.time.toString() + " / " + player.length.toString()
                         }
                         visible: text !== ""
-                        color: _colors.menuCaption
+                        color: colors.menuCaption
                     }
                 }
             }
diff --git a/modules/gui/qt/player/qml/Player.qml b/modules/gui/qt/player/qml/Player.qml
index 912b7ab775..03f2d0a607 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -180,7 +180,7 @@ Widgets.NavigableFocusScope {
                 focus: true
                 anchors.fill: parent
 
-                forceDark: true
+                colors: VLCStyle.nightColors
                 navigationParent: rootPlayer
                 navigationUpItem: csdGroup
                 navigationDownItem: controlBarView
diff --git a/modules/gui/qt/player/qml/PlayerButtonsLayout.qml b/modules/gui/qt/player/qml/PlayerButtonsLayout.qml
index 872583609a..a4c0dc56b0 100644
--- a/modules/gui/qt/player/qml/PlayerButtonsLayout.qml
+++ b/modules/gui/qt/player/qml/PlayerButtonsLayout.qml
@@ -36,7 +36,7 @@ Widgets.NavigableFocusScope {
     property real marginTop: 0
     property real marginBottom: 0
 
-    property bool forceColors: false
+    property var colors: undefined
 
     property var defaultSize: VLCStyle.icon_normal // default size for IconToolButton based controls
 
@@ -84,19 +84,13 @@ Widgets.NavigableFocusScope {
             bottomMargin: marginBottom
             rightMargin: layoutSpacing
         }
-
-        forceColors: playerButtonsLayout.forceColors
         
-        defaultSize: playerButtonsLayout.defaultSize
-
         visible: extraWidth < 0 ? false : true // extraWidth < 0 means there is not even available space for minimumSize
 
         navigationParent: playerButtonsLayout
         navigationRightItem: buttonrow_center
 
         focus: true
-
-        spacing: playerButtonsLayout.spacing
     }
 
     ButtonsLayout {
@@ -111,15 +105,9 @@ Widgets.NavigableFocusScope {
             bottomMargin: playerButtonsLayout.marginBottom
         }
 
-        forceColors: playerButtonsLayout.forceColors
-
-        defaultSize: playerButtonsLayout.defaultSize
-
         navigationParent: playerButtonsLayout
         navigationLeftItem: buttonrow_left
         navigationRightItem: buttonrow_right
-
-        spacing: playerButtonsLayout.spacing
     }
 
     ButtonsLayout {
@@ -139,15 +127,9 @@ Widgets.NavigableFocusScope {
             leftMargin: layoutSpacing
         }
 
-        forceColors: playerButtonsLayout.forceColors
-
-        defaultSize: playerButtonsLayout.defaultSize
-
         visible: extraWidth < 0 ? false : true // extraWidth < 0 means there is not even available space for minimumSize
 
         navigationParent: playerButtonsLayout
         navigationLeftItem: buttonrow_center
-
-        spacing: playerButtonsLayout.spacing
     }
 }
diff --git a/modules/gui/qt/playlist/qml/PLItem.qml b/modules/gui/qt/playlist/qml/PLItem.qml
index d26deb0902..729ab57c35 100644
--- a/modules/gui/qt/playlist/qml/PLItem.qml
+++ b/modules/gui/qt/playlist/qml/PLItem.qml
@@ -44,7 +44,7 @@ Rectangle {
     property int leftPadding: 0
     property int rightPadding: 0
 
-    property VLCColors _colors: VLCStyle.colors
+    property VLCColors colors: VLCStyle.colors
 
     // Should the cover be displayed
     //property alias showCover: cover.visible
@@ -112,7 +112,7 @@ Rectangle {
         anchors.top: parent.top
         antialiasing: true
         visible: false
-        color: _colors.accent
+        color: colors.accent
     }
 
     // bottom drop indicator bar
@@ -129,7 +129,7 @@ Rectangle {
         antialiasing: true
 
         sourceComponent: Rectangle {
-            color: _colors.accent
+            color: colors.accent
         }
     }
 
@@ -205,7 +205,7 @@ Rectangle {
                     source: artwork
                     radius: 8
                     samples: 17
-                    color: _colors.glowColorBanner
+                    color: colors.glowColorBanner
                     visible: artwork.visible
                     spread: 0.1
                 }
@@ -226,7 +226,7 @@ Rectangle {
                     height: VLCStyle.icon_normal
                     horizontalAlignment: Text.AlignHCenter
                     verticalAlignment: Text.AlignVCenter
-                    color: _colors.accent
+                    color: colors.accent
                     text: player.playingState === PlayerController.PLAYING_STATE_PLAYING ? VLCIcons.volume_high :
                                                     player.playingState === PlayerController.PLAYING_STATE_PAUSED ? VLCIcons.pause : ""
                 }
@@ -244,7 +244,7 @@ Rectangle {
 
                     font.weight: model.isCurrent ? Font.Bold : Font.Normal
                     text: model.title
-                    color: _colors.text
+                    color: colors.text
                 }
 
                 Widgets.ListSubtitleLabel {
@@ -254,7 +254,7 @@ Rectangle {
 
                     font.weight: model.isCurrent ? Font.DemiBold : Font.Normal
                     text: (model.artist ? model.artist : i18n.qtr("Unknown Artist"))
-                    color: _colors.text
+                    color: colors.text
                 }
             }
 
@@ -265,7 +265,7 @@ Rectangle {
                 text: model.duration
                 horizontalAlignment: Text.AlignHCenter
                 verticalAlignment: Text.AlignVCenter
-                color: _colors.text
+                color: colors.text
 
                 TextMetrics {
                     id: durationMetric
diff --git a/modules/gui/qt/playlist/qml/PlaylistListView.qml b/modules/gui/qt/playlist/qml/PlaylistListView.qml
index 5e902d4876..1def0d4c61 100644
--- a/modules/gui/qt/playlist/qml/PlaylistListView.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistListView.qml
@@ -38,8 +38,7 @@ Widgets.NavigableFocusScope {
     property int rightPadding: 0
     property alias backgroundColor: parentRect.color
 
-    property bool forceDark: false
-    property VLCColors _colors: forceDark ? vlcNightColors : VLCStyle.colors
+    property VLCColors colors: VLCStyle.colors
 
     signal setItemDropIndicatorVisible(int index, bool isVisible, bool top)
 
@@ -62,8 +61,6 @@ Widgets.NavigableFocusScope {
         drop.accept(Qt.IgnoreAction)
     }
 
-    VLCColors {id: vlcNightColors; state: "night"}
-
     function sortPL(key) {
         if (mainPlaylistController.sortKey !== key) {
             mainPlaylistController.setSortOrder(PlaylistControllerModel.SORT_ORDER_ASC)
@@ -87,7 +84,7 @@ Widgets.NavigableFocusScope {
     Rectangle {
         id: parentRect
         anchors.fill: parent
-        color: _colors.banner
+        color: colors.banner
 
         onActiveFocusChanged: {
             if (activeFocus)
@@ -98,7 +95,7 @@ Widgets.NavigableFocusScope {
         Widgets.DNDLabel {
             id: dragItem
 
-            _colors: root._colors
+            colors: root.colors
             color: parent.color
 
             property int _scrollingDirection: 0
@@ -176,7 +173,7 @@ Widgets.NavigableFocusScope {
 
                 Widgets.SubtitleLabel {
                     text: i18n.qtr("Playqueue")
-                    color: _colors.text
+                    color: colors.text
                 }
 
                 Widgets.CaptionLabel {
@@ -201,7 +198,7 @@ Widgets.NavigableFocusScope {
                     anchors.topMargin: VLCStyle.margin_small
                     visible: plmodel.count !== 0
                     text: i18n.qtr("%1 elements, %2").arg(root.plmodel.count).arg(getHoursMinutesText(plmodel.duration))
-                    color: _colors.caption
+                    color: colors.caption
                 }
             }
 
@@ -218,7 +215,7 @@ Widgets.NavigableFocusScope {
                     horizontalAlignment: Text.AlignHCenter
                     verticalAlignment: Text.AlignVCenter
                     text: VLCIcons.album_cover
-                    color: _colors.caption
+                    color: colors.caption
                 }
 
                 Widgets.CaptionLabel {
@@ -226,7 +223,7 @@ Widgets.NavigableFocusScope {
                     Layout.leftMargin: VLCStyle.margin_large
                     verticalAlignment: Text.AlignVCenter
                     text: i18n.qtr("Title")
-                    color: _colors.caption
+                    color: colors.caption
                 }
 
                 Widgets.IconLabel {
@@ -234,7 +231,7 @@ Widgets.NavigableFocusScope {
                     Layout.preferredWidth: durationMetric.width
 
                     text: VLCIcons.time
-                    color: _colors.caption
+                    color: colors.caption
                     horizontalAlignment: Text.AlignHCenter
                     verticalAlignment: Text.AlignVCenter
 
@@ -350,8 +347,8 @@ Widgets.NavigableFocusScope {
                         height: 1
                         z: (model.selected || plitem.hovered || plitem.activeFocus) ? 2 : 1
                         sourceComponent: Rectangle {
-                            color: _colors.playlistSeparator
-                            opacity: _colors.isThemeDark ? 0.05 : 1.0
+                            color: colors.playlistSeparator
+                            opacity: colors.isThemeDark ? 0.05 : 1.0
                         }
                     }
 
@@ -393,8 +390,8 @@ Widgets.NavigableFocusScope {
                                 contextMenu.popup(index, globalMousePos)
                         }
                         onItemDoubleClicked: mainPlaylistController.goTo(index, true)
-                        color: _colors.getPLItemColor(model.selected, plitem.hovered, plitem.activeFocus)
-                        _colors: root._colors
+                        color: colors.getPLItemColor(model.selected, plitem.hovered, plitem.activeFocus)
+                        colors: root.colors
 
                         onDragStarting: {
                             if (!root.plmodel.isSelected(index)) {
@@ -443,8 +440,8 @@ Widgets.NavigableFocusScope {
                         width: parent.width
                         height: 1
                         z: 2
-                        color: _colors.playlistSeparator
-                        opacity: _colors.isThemeDark ? 0.05 : 1.0
+                        color: colors.playlistSeparator
+                        opacity: colors.isThemeDark ? 0.05 : 1.0
                     }
                 }
 
@@ -581,7 +578,7 @@ Widgets.NavigableFocusScope {
                         horizontalAlignment: Text.AlignHCenter
                         verticalAlignment: Text.AlignVCenter
                         text: VLCIcons.playlist
-                        color: view.activeFocus ? _colors.accent : _colors.text
+                        color: view.activeFocus ? colors.accent : colors.text
                         opacity: 0.3
                     }
 
@@ -593,7 +590,7 @@ Widgets.NavigableFocusScope {
                         horizontalAlignment: Text.AlignHCenter
                         verticalAlignment: Text.AlignVCenter
                         font.pixelSize: VLCStyle.fontSize_xxlarge
-                        color: view.activeFocus ? _colors.accent : _colors.text
+                        color: view.activeFocus ? colors.accent : colors.text
                         opacity: 0.4
                     }
 
@@ -604,7 +601,7 @@ Widgets.NavigableFocusScope {
                         horizontalAlignment: Text.AlignHCenter
                         verticalAlignment: Text.AlignVCenter
                         font.pixelSize: VLCStyle.fontSize_large
-                        color: view.activeFocus ? _colors.accent : _colors.text
+                        color: view.activeFocus ? colors.accent : colors.text
                         opacity: 0.4
                     }
                 }
@@ -627,7 +624,7 @@ Widgets.NavigableFocusScope {
                     glowRadius: 2
                     cornerRadius: 10
                     spread: 0.1
-                    color: _colors.glowColorBanner
+                    color: colors.glowColorBanner
                 }
 
                 Label {
@@ -643,7 +640,7 @@ Widgets.NavigableFocusScope {
                             ? i18n.qtr("Move tracks (%1)").arg(plmodel.selectedCount)
                         : ""
                     font.pixelSize: VLCStyle.fontSize_large
-                    color: _colors.text
+                    color: colors.text
                     elide: Text.ElideRight
                 }
             }
@@ -656,7 +653,7 @@ Widgets.NavigableFocusScope {
                 navigationParent: root
                 navigationUpItem: view
 
-                _colors: root._colors
+                colors: root.colors
             }
         }
     }
diff --git a/modules/gui/qt/playlist/qml/PlaylistToolbar.qml b/modules/gui/qt/playlist/qml/PlaylistToolbar.qml
index b74f98384a..44be0441d7 100644
--- a/modules/gui/qt/playlist/qml/PlaylistToolbar.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistToolbar.qml
@@ -32,11 +32,11 @@ Widgets.NavigableFocusScope {
     property int rightPadding: 0
     height: VLCStyle.heightBar_normal
 
-    property VLCColors _colors: VLCStyle.colors
+    property VLCColors colors: VLCStyle.colors
 
     Rectangle {
         anchors.fill: parent
-        color: _colors.banner
+        color: colors.banner
 
         RowLayout {
             anchors {
@@ -59,8 +59,8 @@ Widgets.NavigableFocusScope {
                 onClicked: mainPlaylistController.toggleRepeatMode()
                 focusPolicy: Qt.NoFocus
 
-                color: _colors.buttonText
-                colorDisabled: _colors.textInactive
+                color: colors.buttonText
+                colorDisabled: colors.textInactive
             }
 
             Widgets.IconToolButton {
@@ -73,8 +73,8 @@ Widgets.NavigableFocusScope {
                 onClicked: mainPlaylistController.shuffle()
                 focusPolicy: Qt.NoFocus
 
-                color: _colors.buttonText
-                colorDisabled: _colors.textInactive
+                color: colors.buttonText
+                colorDisabled: colors.textInactive
             }
 
             Widgets.SortControl {
@@ -105,7 +105,7 @@ Widgets.NavigableFocusScope {
                     root.sortPL(modelData.criteria)
                 }
 
-                _colors: playlistToolbar._colors
+                colors: playlistToolbar.colors
 
                 sortOrder: mainPlaylistController.sortOrder
                 sortKey: mainPlaylistController.sortKey
@@ -121,8 +121,8 @@ Widgets.NavigableFocusScope {
                 onClicked: mainPlaylistController.clear()
                 focusPolicy: Qt.NoFocus
 
-                color: _colors.buttonText
-                colorDisabled: _colors.textInactive
+                color: colors.buttonText
+                colorDisabled: colors.textInactive
             }
         }
     }
diff --git a/modules/gui/qt/widgets/qml/DNDLabel.qml b/modules/gui/qt/widgets/qml/DNDLabel.qml
index dfc0e0b8c7..1a02e049b3 100644
--- a/modules/gui/qt/widgets/qml/DNDLabel.qml
+++ b/modules/gui/qt/widgets/qml/DNDLabel.qml
@@ -29,7 +29,7 @@ Playlist.PlaylistDroppable {
     property alias text: label.text
     property alias model: plitem.model
     property alias color: bg.color
-    property VLCColors _colors: VLCStyle.colors
+    property VLCColors colors: VLCStyle.colors
 
     z: 1
     width:  plitem.visible ? plitem.width : label.width
@@ -41,8 +41,8 @@ Playlist.PlaylistDroppable {
         id: bg
 
         anchors.fill: parent
-        color: _colors.button
-        border.color : _colors.buttonBorder
+        color: colors.button
+        border.color : colors.buttonBorder
         radius: 6
     }
 
@@ -65,7 +65,7 @@ Playlist.PlaylistDroppable {
     RectangularGlow {
         anchors.fill: parent
         glowRadius: VLCStyle.dp(8, VLCStyle.scale)
-        color: _colors.glowColor
+        color: colors.glowColor
         spread: 0.2
     }
 
@@ -74,7 +74,7 @@ Playlist.PlaylistDroppable {
         width: implicitWidth + VLCStyle.dp(10, VLCStyle.scale)
         height: implicitHeight + VLCStyle.dp(10, VLCStyle.scale)
         font.pixelSize: VLCStyle.fontSize_normal
-        color: _colors.text
+        color: colors.text
         text: i18n.qtr("%1 tracks selected").arg(count)
         visible: count > 1 || !model
         verticalAlignment: Text.AlignVCenter
@@ -116,7 +116,7 @@ Playlist.PlaylistDroppable {
                     height: VLCStyle.icon_normal
                     horizontalAlignment: Text.AlignHCenter
                     verticalAlignment: Text.AlignVCenter
-                    color: _colors.accent
+                    color: colors.accent
                     text: player.playingState === PlayerController.PLAYING_STATE_PLAYING ? VLCIcons.volume_high :
                                                     player.playingState === PlayerController.PLAYING_STATE_PAUSED ? VLCIcons.pause :
                                                         player.playingState === PlayerController.PLAYING_STATE_STOPPED ? VLCIcons.stop : ""
@@ -130,7 +130,7 @@ Playlist.PlaylistDroppable {
 
                     font.weight: model && model.isCurrent ? Font.DemiBold : Font.Normal
                     text: model ? model.title : ""
-                    color: _colors.text
+                    color: colors.text
                 }
 
                 Widgets.ListSubtitleLabel {
@@ -139,7 +139,7 @@ Playlist.PlaylistDroppable {
 
                     font.weight: (model && model.isCurrent) ? Font.DemiBold : Font.Normal
                     text: ((model && model.artist) ? model.artist : i18n.qtr("Unknown Artist"))
-                    color: _colors.text
+                    color: colors.text
                 }
             }
 
@@ -148,7 +148,7 @@ Playlist.PlaylistDroppable {
                 Layout.rightMargin: VLCStyle.margin_xsmall
 
                 text: model ? model.duration : ""
-                color: _colors.text
+                color: colors.text
             }
         }
     }
diff --git a/modules/gui/qt/widgets/qml/OverlayMenu.qml b/modules/gui/qt/widgets/qml/OverlayMenu.qml
index 3d32b8bfff..6929a4b0a8 100644
--- a/modules/gui/qt/widgets/qml/OverlayMenu.qml
+++ b/modules/gui/qt/widgets/qml/OverlayMenu.qml
@@ -25,11 +25,6 @@ import "qrc:///style/"
 Item {
     id: root
 
-    VLCColors {
-        id: vlcNightColors
-        state: "night"
-    }
-
     property real widthRatio: (3 / 4)
     property bool isRight: true // when set, menu is placed on the right side
 
@@ -123,7 +118,7 @@ Item {
             readonly property point overlayPos: backgroundItem.mapFromItem(root, parentItem.x, parentItem.y)
             sourceRect: Qt.rect(overlayPos.x, overlayPos.y, width, height)
 
-            tint: VLCStyle.colors.blendColors(vlcNightColors.black, vlcNightColors.banner, 0.85)
+            tint: VLCStyle.colors.blendColors(VLCStyle.nightColors.black, VLCStyle.nightColors.banner, 0.85)
         }
 
         KeyNavigableListView {
@@ -176,7 +171,7 @@ Item {
                 font.pixelSize: VLCStyle.fontSize_xlarge
                 text: listView.currentModel.title
 
-                color: vlcNightColors.text
+                color: VLCStyle.nightColors.text
 
                 leftPadding: root.leftPadding
                 rightPadding: root.rightPadding
@@ -247,7 +242,7 @@ Item {
                                 IconLabel {
                                     horizontalAlignment: Text.AlignHCenter
                                     text: modelData.fontIcon
-                                    color: vlcNightColors.text
+                                    color: VLCStyle.nightColors.text
                                 }
                             }
 
@@ -256,7 +251,7 @@ Item {
                                 ListLabel {
                                     horizontalAlignment: Text.AlignHCenter
                                     text: "✓"
-                                    color: vlcNightColors.text
+                                    color: VLCStyle.nightColors.text
                                 }
                             }
 
@@ -279,7 +274,7 @@ Item {
 
                         font.weight: Font.Normal
                         text: modelData.text
-                        color: vlcNightColors.text
+                        color: VLCStyle.nightColors.text
                     }
 
                     ListLabel {
@@ -293,7 +288,7 @@ Item {
                             else if (!!modelData.marking)
                                 modelData.marking
                         }
-                        color: vlcNightColors.text
+                        color: VLCStyle.nightColors.text
                     }
                 }
 
diff --git a/modules/gui/qt/widgets/qml/SortControl.qml b/modules/gui/qt/widgets/qml/SortControl.qml
index 7eeb9dc63e..f384548900 100644
--- a/modules/gui/qt/widgets/qml/SortControl.qml
+++ b/modules/gui/qt/widgets/qml/SortControl.qml
@@ -44,7 +44,7 @@ Widgets.NavigableFocusScope {
     property alias currentIndex: list.currentIndex
     property alias focusPolicy: button.focusPolicy
 
-    property VLCColors _colors: VLCStyle.colors
+    property VLCColors colors: VLCStyle.colors
 
     // properties that should be handled by parent
     // if they are not updated, SortControl will behave as before
@@ -82,8 +82,8 @@ Widgets.NavigableFocusScope {
 
         focus: true
 
-        color: _colors.buttonText
-        colorDisabled: _colors.textInactive
+        color: colors.buttonText
+        colorDisabled: colors.textInactive
 
         onClicked: {
             if (popup.opened)
@@ -130,7 +130,7 @@ Widgets.NavigableFocusScope {
             ScrollIndicator.vertical: ScrollIndicator { }
 
             highlight: Rectangle {
-                color: _colors.accent
+                color: colors.accent
                 opacity: 0.8
             }
 
@@ -148,7 +148,7 @@ Widgets.NavigableFocusScope {
 
                     Rectangle {
                         anchors.fill: parent
-                        color: _colors.accent
+                        color: colors.accent
                         visible: mouseArea.containsMouse
                         opacity: 0.8
                     }
@@ -165,7 +165,7 @@ Widgets.NavigableFocusScope {
 
                             text: root.criteriaRole ? (Array.isArray(root.model) ? (modelData[root.criteriaRole] === sortKey ? "✓" : "")
                                                                                  : (model[root.criteriaRole] === sortKey ? "✓" : "")) : ""
-                            color: _colors.buttonText
+                            color: colors.buttonText
 
                             TextMetrics {
                                 id: tickMetric
@@ -182,7 +182,7 @@ Widgets.NavigableFocusScope {
                             id: itemText
                             text: root.textRole ? (Array.isArray(root.model) ? modelData[root.textRole] : model[root.textRole]) : modelData
 
-                            color: _colors.buttonText
+                            color: colors.buttonText
                         }
 
                         MenuCaption {
@@ -191,7 +191,7 @@ Widgets.NavigableFocusScope {
 
                             text: (isActiveText.text === "" ? "" : (sortOrder === PlaylistControllerModel.SORT_ORDER_ASC ? "↓" : "↑"))
 
-                            color: _colors.buttonText
+                            color: colors.buttonText
                         }
                     }
 
@@ -234,7 +234,7 @@ Widgets.NavigableFocusScope {
 
         background: Rectangle {
             border.width: VLCStyle.dp(1)
-            border.color: _colors.accent
+            border.color: colors.accent
 
             Widgets.FrostedGlassEffect {
                 id: glassEffect
@@ -246,7 +246,7 @@ Widgets.NavigableFocusScope {
                 property point popupGlobalPos
                 sourceRect: Qt.rect(popupGlobalPos.x, popupGlobalPos.y, glassEffect.width, glassEffect.height)
 
-                tint: _colors.bg
+                tint: colors.bg
                 tintStrength: 0.3
             }
         }
-- 
2.27.0



More information about the vlc-devel mailing list