[vlc-commits] qml: use system palette exposed from C++

Pierre Lamot git at videolan.org
Thu Feb 20 13:56:53 CET 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Tue Feb 18 15:22:54 2020 +0100| [489b38e60c3cc0617fbe27a970f99e74bcd3c331] | committer: Jean-Baptiste Kempf

qml: use system palette exposed from C++

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 .../qt/medialibrary/qml/MusicTrackListDisplay.qml  |  2 +-
 .../gui/qt/medialibrary/qml/VideoListDisplay.qml   |  2 +-
 modules/gui/qt/player/qml/MiniPlayer.qml           |  2 +-
 modules/gui/qt/style/VLCColors.qml                 | 67 ++++++++++------------
 modules/gui/qt/widgets/qml/GridItem.qml            |  7 ++-
 modules/gui/qt/widgets/qml/IconToolButton.qml      |  2 +-
 .../gui/qt/widgets/qml/KeyNavigableListView.qml    |  2 +-
 modules/gui/qt/widgets/qml/ListItem.qml            |  4 +-
 modules/gui/qt/widgets/qml/MenuItemExt.qml         |  6 +-
 9 files changed, 43 insertions(+), 51 deletions(-)

diff --git a/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml b/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
index 1c28ef9e87..be67b9c069 100644
--- a/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
@@ -71,7 +71,7 @@ Widgets.KeyNavigableTableView {
             text: !rowModel ? "" : (rowModel[model.criteria] || "")
             elide: Text.ElideRight
             font.pixelSize: VLCStyle.fontSize_normal
-            color: (model.isPrimary)? VLCStyle.colors.text : VLCStyle.colors.textInactive
+            color: (model.isPrimary)? VLCStyle.colors.text : VLCStyle.colors.textDisabled
 
             anchors {
                 fill: parent
diff --git a/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml b/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
index 5a72730d59..aabfc6b579 100644
--- a/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
@@ -118,7 +118,7 @@ Widgets.KeyNavigableTableView {
                     text: !rowModel ? "" : rowModel[model.criteria] || ""
                     elide: Text.ElideRight
                     font.pixelSize: VLCStyle.fontSize_normal
-                    color: (model.isPrimary)? VLCStyle.colors.text : VLCStyle.colors.textInactive
+                    color: (model.isPrimary)? VLCStyle.colors.text : VLCStyle.colors.textDisabled
 
                     anchors {
                         fill: parent
diff --git a/modules/gui/qt/player/qml/MiniPlayer.qml b/modules/gui/qt/player/qml/MiniPlayer.qml
index 60c390e825..6629b19151 100644
--- a/modules/gui/qt/player/qml/MiniPlayer.qml
+++ b/modules/gui/qt/player/qml/MiniPlayer.qml
@@ -118,7 +118,7 @@ Widgets.NavigableFocusScope {
                             id: artistLabel
                             text: mainPlaylistController.currentItem.artist
                             font.pixelSize: VLCStyle.fontSize_normal
-                            color: VLCStyle.colors.lightText
+                            color: VLCStyle.colors.textInactive
                         }
                     }
                 }
diff --git a/modules/gui/qt/style/VLCColors.qml b/modules/gui/qt/style/VLCColors.qml
index d0a9074b32..714d323530 100644
--- a/modules/gui/qt/style/VLCColors.qml
+++ b/modules/gui/qt/style/VLCColors.qml
@@ -20,10 +20,6 @@ import QtQuick 2.11
 Item {
     id: colors_id
 
-    SystemPalette { id: activePalette; colorGroup: SystemPalette.Active }
-    SystemPalette { id: inactivePalette; colorGroup: SystemPalette.Inactive }
-    SystemPalette { id: disabledPalette; colorGroup: SystemPalette.Disabled }
-
     function blendColors( a, b, blend ) {
         return Qt.rgba( a.r * blend + b.r * (1. - blend),
                        a.g * blend + b.g * (1. - blend),
@@ -48,35 +44,34 @@ Item {
             return "transparent"
     }
 
-    property color text: activePalette.text;
-    property color textInactive: disabledPalette.text;
+    property color text: systemPalette.text;
+    property color textInactive: systemPalette.textInactive;
+    property color textDisabled: systemPalette.textDisabled;
 
-    property color bg: activePalette.base;
-    property color bgInactive: inactivePalette.base;
+    property color bg: systemPalette.base;
+    property color bgInactive: systemPalette.baseInactive;
 
     //for alternate rows
-    property color bgAlt: activePalette.alternateBase;
-    property color bgAltInactive: inactivePalette.alternateBase;
+    property color bgAlt: systemPalette.alternateBase;
+    property color bgAltInactive: systemPalette.alternateBaseInactive;
 
-    property color bgHover: activePalette.highlight;
-    property color bgHoverInactive: inactivePalette.highlight;
+    property color bgHover: systemPalette.highlight;
+    property color bgHoverInactive: systemPalette.highlightInactive;
 
-    property color button: activePalette.button;
-    property color buttonText: activePalette.buttonText;
-    property color buttonBorder: blendColors(activePalette.button, activePalette.buttonText, 0.8);
+    property color button: systemPalette.button;
+    property color buttonText: systemPalette.buttonText;
+    property color buttonBorder: blendColors(systemPalette.button, systemPalette.buttonText, 0.8);
 
     property color textActiveSource: "red";
 
-    property color banner: activePalette.window;
-    property color bannerHover: activePalette.highlight;
+    property color banner: systemPalette.window;
+    property color bannerHover: systemPalette.highlight;
     property color volsliderbg: "#bdbebf"
     property color volbelowmid: "#99d299"
     property color volabovemid: "#14d214"
     property color volhigh: "#ffc70f"
     property color volmax: "#f5271d"
 
-    property color videosGridInfoLeft: "grey"
-
     property color playerFg: "white"
     property color playerFgInactive: "#888888"
     property color playerBg: "black"
@@ -87,8 +82,6 @@ Item {
 
     property color alert: "red";
 
-    property color lightText: "#747474";
-
     property color buffer: "#696969";
 
     property color seekpoint: "red";
@@ -117,7 +110,7 @@ Item {
 
                 button: "#eff0f1";
                 buttonText: "#232627";
-                buttonBorder: blendColors(activePalette.button, activePalette.buttonText, 0.8);
+                buttonBorder: blendColors(button, buttonText, 0.8);
 
                 textActiveSource: "#ff950d";
 
@@ -126,8 +119,6 @@ Item {
 
                 accent: "#ff950d";
                 alert: "#ff0000";
-
-                lightText: "#747474";
             }
         },
         State {
@@ -136,7 +127,7 @@ Item {
                 target: colors_id
 
                 text: "#eff0f1"
-                textInactive: "#626c76"
+                textInactive: "#bdc3c7"
                 bg: "#232629"
                 bgInactive: "#232629"
                 bgAlt: "#31363b"
@@ -151,7 +142,6 @@ Item {
                 bannerHover: "#3daee9"
                 accent: "#ff950d"
                 alert: "#ff0000"
-                lightText: "#8b8b8b";
             }
         },
         State {
@@ -159,25 +149,26 @@ Item {
             PropertyChanges {
                 target: colors_id
 
-                bg: activePalette.base
-                bgInactive: inactivePalette.base
+                bg: systemPalette.base
+                bgInactive: systemPalette.baseInactive
 
-                bgAlt: activePalette.alternateBase
-                bgAltInactive: inactivePalette.alternateBase
+                bgAlt: systemPalette.alternateBase
+                bgAltInactive: systemPalette.alternateBaseInactive
 
-                bgHover: activePalette.highlight
-                bgHoverInactive: inactivePalette.highlight
+                bgHover: systemPalette.highlight
+                bgHoverInactive: systemPalette.highlightInactive
 
-                text: activePalette.text
-                textInactive: disabledPalette.text
+                text: systemPalette.text
+                textDisabled: systemPalette.textDisabled
+                textInactive: systemPalette.textInactive
 
-                button: activePalette.button
-                buttonText: activePalette.buttonText
+                button: systemPalette.button
+                buttonText: systemPalette.buttonText
                 buttonBorder: blendColors(button, buttonText, 0.8)
 
                 textActiveSource: accent
-                banner: activePalette.window
-                bannerHover: activePalette.highlight
+                banner: systemPalette.window
+                bannerHover: systemPalette.highlight
             }
         }
     ]
diff --git a/modules/gui/qt/widgets/qml/GridItem.qml b/modules/gui/qt/widgets/qml/GridItem.qml
index 3aad512eeb..680b36a07a 100644
--- a/modules/gui/qt/widgets/qml/GridItem.qml
+++ b/modules/gui/qt/widgets/qml/GridItem.qml
@@ -207,7 +207,8 @@ Item {
                     font.weight: Font.Light
                     elide: Text.ElideRight
                     font.pixelSize: VLCStyle.fontSize_small
-                    color: VLCStyle.colors.lightText
+                    color: VLCStyle.colors.textInactive
+
                 }
 
                 RowLayout {
@@ -221,14 +222,14 @@ Item {
                         Layout.alignment: Qt.AlignLeft
                         Layout.fillWidth: true
                         font.pixelSize: VLCStyle.fontSize_small
-                        color: VLCStyle.colors.videosGridInfoLeft
+                        color: VLCStyle.colors.textInactive
                         text: infoLeft
                     }
                     Text {
                         visible: root.isNew
                         Layout.alignment: Qt.AlignRight
                         font.pixelSize: VLCStyle.fontSize_small
-                        color: root.activeFocus ? VLCStyle.colors.lightText : VLCStyle.colors.accent
+                        color: root.activeFocus ? VLCStyle.colors.text : VLCStyle.colors.accent
                         text: "NEW"
                         font.bold: true
                     }
diff --git a/modules/gui/qt/widgets/qml/IconToolButton.qml b/modules/gui/qt/widgets/qml/IconToolButton.qml
index 3c7a6b7ddf..8f04109311 100644
--- a/modules/gui/qt/widgets/qml/IconToolButton.qml
+++ b/modules/gui/qt/widgets/qml/IconToolButton.qml
@@ -30,7 +30,7 @@ ToolButton {
 
     property string iconText: ""
     property color color: VLCStyle.colors.buttonText
-    property color colorDisabled: VLCStyle.colors.lightText
+    property color colorDisabled: VLCStyle.colors.textInactive
     property color colorOverlay: "transparent"
     property string textOverlay: ""
     property bool borderEnabled: false
diff --git a/modules/gui/qt/widgets/qml/KeyNavigableListView.qml b/modules/gui/qt/widgets/qml/KeyNavigableListView.qml
index 7f0159b3b1..ac49271373 100644
--- a/modules/gui/qt/widgets/qml/KeyNavigableListView.qml
+++ b/modules/gui/qt/widgets/qml/KeyNavigableListView.qml
@@ -88,7 +88,7 @@ NavigableFocusScope {
             Rectangle {
                 width: parent.width
                 height: 1
-                color: VLCStyle.colors.textInactive
+                color: VLCStyle.colors.textDisabled
             }
         }
     }
diff --git a/modules/gui/qt/widgets/qml/ListItem.qml b/modules/gui/qt/widgets/qml/ListItem.qml
index 0936697232..805447958e 100644
--- a/modules/gui/qt/widgets/qml/ListItem.qml
+++ b/modules/gui/qt/widgets/qml/ListItem.qml
@@ -126,7 +126,7 @@ NavigableFocusScope {
                         Text {
                             id: cover_text
                             anchors.centerIn: parent
-                            color: VLCStyle.colors.lightText
+                            color: VLCStyle.colors.textInactive
                             font.pixelSize: VLCStyle.fontSize_xsmall
                         }
                     }
@@ -156,7 +156,7 @@ NavigableFocusScope {
                                 id: line2_text
                                 width: parent.width
                                 elide: Text.ElideRight
-                                color: VLCStyle.colors.lightText
+                                color: VLCStyle.colors.textInactive
                                 font.pixelSize: VLCStyle.fontSize_small
                                 visible: text !== ""
                                 enabled: text !== ""
diff --git a/modules/gui/qt/widgets/qml/MenuItemExt.qml b/modules/gui/qt/widgets/qml/MenuItemExt.qml
index 9dd6c427e6..2e208ca272 100644
--- a/modules/gui/qt/widgets/qml/MenuItemExt.qml
+++ b/modules/gui/qt/widgets/qml/MenuItemExt.qml
@@ -57,7 +57,7 @@ T.MenuItem {
         icon: control.icon
         text: control.text
         font: control.font
-        color: control.enabled ? VLCStyle.colors.text : VLCStyle.colors.textInactive
+        color: control.enabled ? VLCStyle.colors.text : VLCStyle.colors.textDisabled
     }
 
     indicator: ColorImage {
@@ -66,7 +66,7 @@ T.MenuItem {
 
         visible: control.checked
         source: control.checkable ? "qrc:/qt-project.org/imports/QtQuick/Controls.2/images/check.png" : ""
-        color: control.enabled ? VLCStyle.colors.text : VLCStyle.colors.textInactive
+        color: control.enabled ? VLCStyle.colors.text : VLCStyle.colors.textDisabled
         defaultColor: "#353637"
     }
 
@@ -77,7 +77,7 @@ T.MenuItem {
         visible: control.subMenu
         mirror: control.mirrored
         source: control.subMenu ? "qrc:/qt-project.org/imports/QtQuick/Controls.2/images/arrow-indicator.png" : ""
-        color: control.enabled ? VLCStyle.colors.text : VLCStyle.colors.textInactive
+        color: control.enabled ? VLCStyle.colors.text : VLCStyle.colors.textDisabled
         defaultColor: "#353637"
     }
 



More information about the vlc-commits mailing list