[vlc-commits] qml: use ControlBar widget in MiniPlayer

Prince Gupta git at videolan.org
Mon Mar 15 10:33:04 UTC 2021


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Tue Feb  9 19:21:47 2021 +0530| [de1f6f77d7eb17131121bf39967d5c9abd3e8cc3] | committer: Pierre Lamot

qml: use ControlBar widget in MiniPlayer

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 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);
         }
     }
 }



More information about the vlc-commits mailing list