[vlc-commits] [Git][videolan/vlc][master] 6 commits: qml/PlaybackSpeedButton: add missing import

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Tue Jan 18 07:42:03 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
d0bed771 by Prince Gupta at 2022-01-18T07:29:09+00:00
qml/PlaybackSpeedButton: add missing import

- - - - -
51ced3de by Prince Gupta at 2022-01-18T07:29:09+00:00
qml/PlaybackSpeedButton: fix parent assignment

- - - - -
d146e7fa by Prince Gupta at 2022-01-18T07:29:09+00:00
qml/PlaybackSpeedButton: fix navigation parent assignment

Parent Popup is not a QQuickItem, link keyboard navigation directly with source button

- - - - -
df897029 by Prince Gupta at 2022-01-18T07:29:09+00:00
qml/PlaybackSpeedButton: correctly assign Popup's window

- - - - -
7c8d5586 by Prince Gupta at 2022-01-18T07:29:09+00:00
qml/PlaybackSpeed: correctly initialize value property

fixes abrupt playback speed when switching views

- - - - -
98a964b0 by Prince Gupta at 2022-01-18T07:29:09+00:00
qml/PlaybackSpeed: use visualFocus

- - - - -


2 changed files:

- modules/gui/qt/player/qml/PlaybackSpeed.qml
- modules/gui/qt/player/qml/controlbarcontrols/PlaybackSpeedButton.qml


Changes:

=====================================
modules/gui/qt/player/qml/PlaybackSpeed.qml
=====================================
@@ -62,14 +62,17 @@ Popup {
         Slider {
             id: speedSlider
 
-            property bool _inhibitUpdate: false
+            // '_inhibitPlayerUpdate' is used to guard against double update
+            // initialize with true so that we don't update the Player till
+            // we initialize `value` property
+            property bool _inhibitPlayerUpdate: true
 
             from: 0.25
             to: 4
             clip: true
             implicitHeight: VLCStyle.heightBar_small
 
-            Navigation.parentItem: root
+            Navigation.parentItem: root.Navigation.parentItem
             Navigation.downItem: resetButton
             Keys.priority: Keys.AfterItem
             Keys.onPressed: Navigation.defaultKeyAction(event)
@@ -88,7 +91,7 @@ Popup {
                     width: speedSlider.visualPosition * parent.width
                     height: parent.height
                     radius: 2
-                    color: (speedSlider.activeFocus || speedSlider.pressed)
+                    color: (speedSlider.visualFocus || speedSlider.pressed)
                            ? root.colors.accent
                            : root.colors.text
                 }
@@ -100,19 +103,19 @@ Popup {
                 width: speedSlider.implicitHeight
                 height: speedSlider.implicitHeight
                 radius: speedSlider.implicitHeight
-                color: (speedSlider.activeFocus || speedSlider.pressed) ? root.colors.accent : root.colors.text
+                color: (speedSlider.visualFocus || speedSlider.pressed) ? root.colors.accent : root.colors.text
             }
 
             onValueChanged:  {
-                if (_inhibitUpdate)
+                if (_inhibitPlayerUpdate)
                     return
                 Player.rate = value
             }
 
             function _updateFromPlayer() {
-                _inhibitUpdate = true
+                _inhibitPlayerUpdate = true
                 value = Player.rate
-                _inhibitUpdate = false
+                _inhibitPlayerUpdate = false
             }
 
             Connections {
@@ -130,7 +133,7 @@ Popup {
 
             spacing: 0
 
-            Navigation.parentItem: root
+            Navigation.parentItem: root.Navigation.parentItem
             Navigation.upItem: speedSlider
 
             Widgets.IconControlButton {


=====================================
modules/gui/qt/player/qml/controlbarcontrols/PlaybackSpeedButton.qml
=====================================
@@ -23,10 +23,13 @@ import org.videolan.vlc 0.1
 import "qrc:///widgets/" as Widgets
 import "qrc:///style/"
 import "qrc:///player/" as P
+import "qrc:///util/Helpers.js" as Helpers
 
 Widgets.IconControlButton {
     id: playbackSpeedButton
 
+    readonly property bool _isCurrentViewPlayer: !paintOnly && (History.current.name === "player")
+
     size: VLCStyle.icon_medium
     text: I18n.qtr("Playback Speed")
     color: playbackSpeedPopup.visible ? colors.accent : colors.playerControlBarFg
@@ -41,7 +44,9 @@ Widgets.IconControlButton {
         focus: true
         parent: playbackSpeedButton.paintOnly
                 ? playbackSpeedButton // button is not part of main display (ToolbarEditorDialog)
-                : (History.current.view === "player") ? rootPlayer : g_mainDisplay
+                : playbackSpeedButton._isCurrentViewPlayer ? rootPlayer : g_root
+
+        Navigation.parentItem: playbackSpeedButton
 
         onOpened: {
             // update popup coordinates
@@ -65,14 +70,14 @@ Widgets.IconControlButton {
 
             // player related --
             playerControlLayout.requestLockUnlockAutoHide(true, playerControlLayout)
-            if (!!rootPlayer)
+            if (playbackSpeedButton._isCurrentViewPlayer)
                 rootPlayer.menu = playbackSpeedPopup
         }
 
         onClosed: {
             playerControlLayout.requestLockUnlockAutoHide(false, playerControlLayout)
             playbackSpeedButton.forceActiveFocus()
-            if (!!rootPlayer)
+            if (playbackSpeedButton._isCurrentViewPlayer)
                 rootPlayer.menu = undefined
         }
     }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c5ebfdf63e919b81931981f2efe29a80b608e428...98a964b0c6fc4502c57a0a8733866e30e76fe88d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c5ebfdf63e919b81931981f2efe29a80b608e428...98a964b0c6fc4502c57a0a8733866e30e76fe88d
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list