[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: do not delay setting topInset of ControlBar
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Nov 17 21:33:17 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
3c4ad604 by Fatih Uzunoglu at 2023-11-17T21:15:17+00:00
qml: do not delay setting topInset of ControlBar
- - - - -
11886f8b by Fatih Uzunoglu at 2023-11-17T21:15:17+00:00
qml: give room for optimization in ControlBar
- - - - -
6481dd9b by Fatih Uzunoglu at 2023-11-17T21:15:17+00:00
qml: prevent more direct access in ControlBar
- - - - -
1 changed file:
- modules/gui/qt/player/qml/ControlBar.qml
Changes:
=====================================
modules/gui/qt/player/qml/ControlBar.qml
=====================================
@@ -41,22 +41,19 @@ T.Pane {
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitHeight: Math.max(implicitBackgroundHeight + bottomInset,
contentHeight + topPadding + bottomPadding)
- bottomPadding: VLCStyle.margin_xsmall
+ topInset: sliderY
- BindingCompat on topInset {
- delayed: true
- value: row2.y
- }
+ bottomPadding: VLCStyle.margin_xsmall
- readonly property alias sliderY: row2.y
+ readonly property real sliderY: mapFromItem(contentItem, 0, contentItem.sliderY).y
property int textPosition: ControlBar.TimeTextPosition.AboveSlider
- property alias identifier: playerControlLayout.identifier
- property alias sliderHeight: trackPositionSlider.barHeight
+ property int identifier: -1
+ property real sliderHeight: VLCStyle.heightBar_xxsmall
property real bookmarksHeight: VLCStyle.controlBarBookmarksHeight
- property alias showRemainingTime: mediaRemainingTime.visible
+ property bool showRemainingTime: true
property var menu: undefined
@@ -71,7 +68,8 @@ T.Pane {
Accessible.name: I18n.qtr("Player controls")
function showChapterMarks() {
- trackPositionSlider.showChapterMarks()
+ if (contentItem.trackPositionSlider)
+ contentItem.trackPositionSlider.showChapterMarks()
}
function applyMenu(menu) {
@@ -106,6 +104,81 @@ T.Pane {
contentItem: ColumnLayout {
spacing: VLCStyle.margin_xsmall
+ readonly property real sliderY: row2.y
+
+ property alias trackPositionSlider: trackPositionSlider
+
+ property alias mediaRemainingTime: mediaRemainingTime
+
+ property alias playerControlLayout: playerControlLayout
+
+ readonly property list<Item> strayItems: [
+ T.Label {
+ id: mediaTime
+ text: Player.time.formatHMS()
+ color: theme.fg.primary
+ font.pixelSize: (textPosition === ControlBar.TimeTextPosition.LeftRightSlider) ? VLCStyle.fontSize_small
+ : VLCStyle.fontSize_normal
+
+ anchors.left: (parent === pseudoRow) ? parent.left : undefined
+ anchors.verticalCenter: (parent === pseudoRow) ? parent.verticalCenter : undefined
+ },
+ T.Label {
+ id: mediaRemainingTime
+
+ text: (MainCtx.showRemainingTime && Player.remainingTime.valid())
+ ? "-" + Player.remainingTime.formatHMS()
+ : Player.length.formatHMS()
+ color: mediaTime.color
+ font.pixelSize: mediaTime.font.pixelSize
+
+ visible: root.showRemainingTime
+
+ anchors.right: (parent === pseudoRow) ? parent.right : undefined
+ anchors.verticalCenter: (parent === pseudoRow) ? parent.verticalCenter : undefined
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: MainCtx.showRemainingTime = !MainCtx.showRemainingTime
+ }
+ },
+ SliderBar {
+ id: trackPositionSlider
+
+ barHeight: root.sliderHeight
+ Layout.fillWidth: true
+ enabled: Player.playingState === Player.PLAYING_STATE_PLAYING || Player.playingState === Player.PLAYING_STATE_PAUSED
+
+ Navigation.parentItem: root
+ Navigation.downItem: playerControlLayout
+
+ activeFocusOnTab: true
+
+ focus: true
+
+ Keys.onPressed: {
+ Navigation.defaultKeyAction(event)
+ }
+ },
+ Loader {
+ id: bookmarksLoader
+
+ parent: root
+ active: MainCtx.mediaLibraryAvailable
+ source: "qrc:/player/Bookmarks.qml"
+
+ x: root.leftPadding + trackPositionSlider.x + row2.Layout.leftMargin
+ y: row2.y + row2.height + VLCStyle.margin_xxsmall
+ width: trackPositionSlider.width
+
+ onLoaded: {
+ item.barHeight = Qt.binding(function() { return bookmarksHeight })
+ item.controlBarHovered = Qt.binding(function() { return root.hovered })
+ item.yShift = Qt.binding(function() { return row2.height + VLCStyle.margin_xxsmall })
+ }
+ }
+ ]
+
Item {
// BUG: RowLayout can not be used here
// because of a Qt bug. (Height is
@@ -169,6 +242,8 @@ T.Pane {
Layout.leftMargin: VLCStyle.margin_large
Layout.rightMargin: VLCStyle.margin_large
+ identifier: root.identifier
+
Navigation.upItem: trackPositionSlider.enabled ? trackPositionSlider : root.Navigation.upItem
onRequestLockUnlockAutoHide: root.requestLockUnlockAutoHide(lock)
@@ -176,69 +251,4 @@ T.Pane {
onMenuOpened: root.applyMenu(menu)
}
}
-
- readonly property list<Item> strayItems: [
- T.Label {
- id: mediaTime
- text: Player.time.formatHMS()
- color: theme.fg.primary
- font.pixelSize: (textPosition === ControlBar.TimeTextPosition.LeftRightSlider) ? VLCStyle.fontSize_small
- : VLCStyle.fontSize_normal
-
- anchors.left: (parent === pseudoRow) ? parent.left : undefined
- anchors.verticalCenter: (parent === pseudoRow) ? parent.verticalCenter : undefined
- },
- T.Label {
- id: mediaRemainingTime
-
- text: (MainCtx.showRemainingTime && Player.remainingTime.valid())
- ? "-" + Player.remainingTime.formatHMS()
- : Player.length.formatHMS()
- color: mediaTime.color
- font.pixelSize: mediaTime.font.pixelSize
-
- anchors.right: (parent === pseudoRow) ? parent.right : undefined
- anchors.verticalCenter: (parent === pseudoRow) ? parent.verticalCenter : undefined
-
- MouseArea {
- anchors.fill: parent
- onClicked: MainCtx.showRemainingTime = !MainCtx.showRemainingTime
- }
- },
- SliderBar {
- id: trackPositionSlider
-
- barHeight: VLCStyle.heightBar_xxsmall
- Layout.fillWidth: true
- enabled: Player.playingState === Player.PLAYING_STATE_PLAYING || Player.playingState === Player.PLAYING_STATE_PAUSED
-
- Navigation.parentItem: root
- Navigation.downItem: playerControlLayout
-
- activeFocusOnTab: true
-
- focus: true
-
- Keys.onPressed: {
- Navigation.defaultKeyAction(event)
- }
- },
- Loader {
- id: bookmarksLoader
-
- parent: root
- active: MainCtx.mediaLibraryAvailable
- source: "qrc:/player/Bookmarks.qml"
-
- x: root.leftPadding + trackPositionSlider.x + row2.Layout.leftMargin
- y: row2.y + row2.height + VLCStyle.margin_xxsmall
- width: trackPositionSlider.width
-
- onLoaded: {
- item.barHeight = Qt.binding(function() { return bookmarksHeight })
- item.controlBarHovered = Qt.binding(function() { return root.hovered })
- item.yShift = Qt.binding(function() { return row2.height + VLCStyle.margin_xxsmall })
- }
- }
- ]
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fe424511854e2640fe746e411258b862284cd402...6481dd9b71a2f9e08b1f36277b85324947cf48a6
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fe424511854e2640fe746e411258b862284cd402...6481dd9b71a2f9e08b1f36277b85324947cf48a6
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list