[vlc-devel] [PATCH 17/25] qml: use ControlBar widget in MiniPlayer

Prince Gupta guptaprince8832 at gmail.com
Thu Mar 11 09:16:25 UTC 2021


---
 modules/gui/qt/player/qml/MiniPlayer.qml | 90 +++++-------------------
 1 file changed, 19 insertions(+), 71 deletions(-)

diff --git a/modules/gui/qt/player/qml/MiniPlayer.qml b/modules/gui/qt/player/qml/MiniPlayer.qml
index 697cf286a0..748751da31 100644
--- a/modules/gui/qt/player/qml/MiniPlayer.qml
+++ b/modules/gui/qt/player/qml/MiniPlayer.qml
@@ -63,7 +63,7 @@ Widgets.NavigableFocusScope {
     }
 
     Widgets.FrostedGlassEffect {
-        anchors.fill: column
+        anchors.fill: controlBar
 
         source: mainContent
         sourceRect: Qt.rect(root.x, root.y, root.width, root.height)
@@ -71,78 +71,26 @@ Widgets.NavigableFocusScope {
         tint: VLCStyle.colors.blendColors(VLCStyle.colors.bg, VLCStyle.colors.banner, 0.85)
     }
 
-    Column {
-        id: column
+    ControlBar {
+        id: controlBar
+
         anchors.left: parent.left
         anchors.right: parent.right
-
-        SliderBar {
-            id: progressBar
-
-            barHeight: VLCStyle.dp(3, VLCStyle.scale)
-            value: player.position
-            visible: progressBar.value >= 0.0 && progressBar.value <= 1.0
-            backgroundColor: colors.sliderBarMiniplayerBgColor
-            progressBarColor: colors.accent
-            focus: true
-            anchors {
-                left: parent.left
-                right: parent.right
-            }
-
-            Keys.onDownPressed: buttonsLayout.focus = true
-            Keys.onUpPressed: root.navigationUpItem.focus = true
-        }
-
-        Item {
-            id: mainRect
-
-            anchors {
-                left: parent.left
-                right: parent.right
-            }
-
-            height: VLCStyle.miniPlayerHeight
-
-            PlayerButtonsLayout {
-                id: buttonsLayout
-
-                anchors {
-                    fill: parent
-                    leftMargin: VLCStyle.applicationHorizontalMargin
-                    rightMargin: VLCStyle.applicationHorizontalMargin
-                    bottomMargin: VLCStyle.applicationVerticalMargin
-                }
-
-                models: [miniPlayerModel_left, miniPlayerModel_center, miniPlayerModel_right]
-
-                navigationUpItem: progressBar.enabled ? progressBar : root.navigationUpItem
-            }
-
-            PlayerControlBarModel {
-                id: miniPlayerModel_left
-                mainCtx: mainctx
-                configName: "MiniPlayerToolbar-left"
-            }
-
-            PlayerControlBarModel {
-                id: miniPlayerModel_center
-                mainCtx: mainctx
-                configName: "MiniPlayerToolbar-center"
-            }
-
-            PlayerControlBarModel {
-                id: miniPlayerModel_right
-                mainCtx: mainctx
-                configName: "MiniPlayerToolbar-right"
-            }
-
-            Keys.onPressed: {
-                if (!event.accepted)
-                    defaultKeyAction(event, 0)
-                if (!event.accepted)
-                    mainInterface.sendHotkey(event.key, event.modifiers);
-            }
+        focus: true
+        colors: VLCStyle.colors
+        height: VLCStyle.miniPlayerHeight
+        textPosition: ControlBar.TimeTextPosition.Hide
+        sliderHeight: VLCStyle.dp(3, VLCStyle.scale)
+        sliderBackgroundColor: colors.sliderBarMiniplayerBgColor
+        sliderProgressColor: colors.accent
+        configs: ["MiniPlayerToolbar-left", "MiniPlayerToolbar-center", "MiniPlayerToolbar-right"]
+        navigationParent: root
+
+        Keys.onPressed: {
+            if (!event.accepted)
+                defaultKeyAction(event, 0)
+            if (!event.accepted)
+                mainInterface.sendHotkey(event.key, event.modifiers);
         }
     }
 }
-- 
2.25.1



More information about the vlc-devel mailing list