[vlc-commits] [Git][videolan/vlc][master] qml/AddressbarButton: Update look and feel according to our guidelines

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Sep 20 14:32:17 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
4ec74867 by Benjamin Arnaud at 2021-09-20T14:15:57+00:00
qml/AddressbarButton: Update look and feel according to our guidelines

- - - - -


1 changed file:

- modules/gui/qt/network/qml/AddressbarButton.qml


Changes:

=====================================
modules/gui/qt/network/qml/AddressbarButton.qml
=====================================
@@ -25,68 +25,62 @@ import "qrc:///widgets/" as Widgets
 AbstractButton {
     id: button
 
+    // Properties
+
     property bool onlyIcon: true
+
     property bool highlighted: false
-    property color color
-    property color foregroundColor
 
-    font.pixelSize: onlyIcon ? VLCIcons.pixelSize(VLCStyle.icon_normal) : VLCStyle.fontSize_large
-    padding: VLCStyle.margin_xxsmall
+    // Aliases
+
+    property alias foregroundColor: background.foregroundColor
+    property alias backgroundColor: background.backgroundColor
+
+    // Settings
+
     width: implicitWidth
     height: implicitHeight
 
-    state: (button.hovered || button.activeFocus) ? "active" : "normal"
-    states: [
-        State {
-            name: "active"
-            PropertyChanges {
-                target: button
-
-                color: VLCStyle.colors.accent
-                foregroundColor: VLCStyle.colors.accentText
-            }
-        },
-        State {
-            name: "normal"
-            PropertyChanges {
-                target: button
-
-                color: "transparent"
-                foregroundColor: VLCStyle.colors.text
-            }
-        }
-    ]
+    padding: VLCStyle.margin_xxsmall
 
-    transitions: Transition {
-        to: "*"
+    font.pixelSize: (onlyIcon) ? VLCIcons.pixelSize(VLCStyle.icon_normal)
+                               : VLCStyle.fontSize_large
 
-        ColorAnimation {
-            duration: VLCStyle.duration_normal
-            properties: "foregroundColor,color"
-        }
+    // Children
+
+    background: Widgets.AnimatedBackground {
+        id: background
+
+        active: visualFocus
+
+        backgroundColor: "transparent"
+
+        foregroundColor: (hovered) ? VLCStyle.colors.buttonTextHover
+                                   : VLCStyle.colors.buttonBanner
     }
 
     contentItem: contentLoader.item
-    background: Rectangle {
-        color: button.color
-    }
 
     Loader {
         id: contentLoader
 
-        sourceComponent: button.onlyIcon ? iconTextContent : textContent
+        sourceComponent: (onlyIcon) ? iconTextContent
+                                    : textContent
     }
 
     Component {
         id: iconTextContent
 
         Widgets.IconLabel {
+            verticalAlignment: Text.AlignVCenter
+
             text: button.text
+
             elide: Text.ElideRight
-            font.pixelSize: button.font.pixelSize
+
             color: button.foregroundColor
-            opacity: (button.highlighted  || button.hovered || button.activeFocus) ? 1 : .6
-            verticalAlignment: Text.AlignVCenter
+
+            font.pixelSize: button.font.pixelSize
         }
     }
 
@@ -94,13 +88,17 @@ AbstractButton {
         id: textContent
 
         Label {
+            verticalAlignment: Text.AlignVCenter
+
             text: button.text
+
             elide: Text.ElideRight
-            font.pixelSize: button.font.pixelSize
-            font.weight: button.highlighted ? Font.DemiBold : Font.Normal
+
             color: button.foregroundColor
-            opacity: (button.highlighted || button.hovered || button.activeFocus) ? 1 : .6
-            verticalAlignment: Text.AlignVCenter
+
+            font.pixelSize: button.font.pixelSize
+
+            font.weight: (highlighted) ? Font.DemiBold : Font.Normal
         }
     }
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4ec7486787697f1897ca83e17e0a397d49b7f14a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4ec7486787697f1897ca83e17e0a397d49b7f14a
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list