[vlc-commits] [Git][videolan/vlc][master] 5 commits: qml: add text before combobox in Playback Speed component
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Dec 9 18:17:20 UTC 2023
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
6c066bd3 by Prince Gupta at 2023-12-09T17:25:07+00:00
qml: add text before combobox in Playback Speed component
- - - - -
1b7336a9 by Prince Gupta at 2023-12-09T17:25:07+00:00
qml: rename Slider widget to SliderExt
all other custom 'Widget' has suffix Ext
- - - - -
90fbcaae by Prince Gupta at 2023-12-09T17:25:07+00:00
qml: fix hover handling in SliderExt
- - - - -
0c87e759 by Prince Gupta at 2023-12-09T17:25:07+00:00
qml: don't show tooltip beyond bounds in Slider
- - - - -
76d2267c by Prince Gupta at 2023-12-09T17:25:07+00:00
qml: add tickmark in playback speed
also remove 1.0x button which is used to reset the button
- - - - -
5 changed files:
- modules/gui/qt/Makefile.am
- modules/gui/qt/player/qml/PlaybackSpeed.qml
- modules/gui/qt/player/qml/controlbarcontrols/VolumeWidget.qml
- modules/gui/qt/vlc.qrc
- modules/gui/qt/widgets/qml/Slider.qml → modules/gui/qt/widgets/qml/SliderExt.qml
Changes:
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -1047,7 +1047,7 @@ libqt_plugin_la_QML = \
gui/qt/widgets/qml/ScanProgressBar.qml \
gui/qt/widgets/qml/ScrollingText.qml \
gui/qt/widgets/qml/SearchBox.qml \
- gui/qt/widgets/qml/Slider.qml \
+ gui/qt/widgets/qml/SliderExt.qml \
gui/qt/widgets/qml/SortControl.qml \
gui/qt/widgets/qml/SpinBoxExt.qml \
gui/qt/widgets/qml/StackViewExt.qml \
=====================================
modules/gui/qt/player/qml/PlaybackSpeed.qml
=====================================
@@ -179,8 +179,6 @@ ColumnLayout {
Layout.alignment: Qt.AlignTop
- implicitHeight: buttonReset.height
-
Navigation.parentItem: root
Navigation.downItem: slider
@@ -194,34 +192,6 @@ ColumnLayout {
font.pixelSize: VLCStyle.fontSize_normal
}
- Widgets.IconControlButton {
- id: buttonReset
-
- // NOTE: This needs to be wider to fully encapsulate the label.
- width: VLCStyle.dp(64, VLCStyle.scale)
-
- anchors.centerIn: parent
-
- focus: true
-
- text: I18n.qtr("Reset")
-
- Navigation.parentItem: rowA
- Navigation.downItem: slider
-
- onClicked: slider.value = 0
-
- Widgets.CaptionLabel {
- anchors.centerIn: parent
-
- text: I18n.qtr("1.00x")
-
- color: theme.fg.primary
-
- font.pixelSize: VLCStyle.fontSize_xlarge
- }
- }
-
Widgets.CaptionLabel {
anchors.right: parent.right
@@ -235,10 +205,12 @@ ColumnLayout {
}
}
- Widgets.Slider {
+ Widgets.SliderExt {
id: slider
Layout.fillWidth: true
+ Layout.topMargin: VLCStyle.margin_xsmall
+ topPadding: 0
// NOTE: These values come from the VLC 3.x implementation.
from: -34
@@ -255,7 +227,6 @@ ColumnLayout {
toolTipFollowsMouse: true
Navigation.parentItem: root
- Navigation.upItem: buttonReset
Navigation.downItem: comboBox
Keys.priority: Keys.AfterItem
@@ -274,24 +245,40 @@ ColumnLayout {
root._shiftPressed = (mouse.modifiers === Qt.ShiftModifier)
}
}
+
+ Rectangle {
+ id: tickmark
+
+ parent: slider.background
+ x: parent.width * .5
+ width: VLCStyle.dp(1, VLCStyle.scale)
+ height: parent.height
+ visible: root.sliderToSpeed(slider.value) !== 1
+ color: {
+ const theme = slider.colorContext
+ return root.sliderToSpeed(slider.value) > 1 ? theme.fg.negative : theme.fg.primary
+ }
+ }
}
- Item {
+ RowLayout {
id: rowB
Layout.fillWidth: true
Layout.topMargin: VLCStyle.margin_xsmall
- implicitHeight: comboBox.height
-
Navigation.parentItem: root
Navigation.upItem: slider
+ Widgets.ListLabel {
+ text: I18n.qtr("Presets")
+ color: colorContext.fg.primary
+ Layout.fillWidth: true
+ }
+
Widgets.ComboBoxExt {
id: comboBox
- anchors.centerIn: parent
-
width: VLCStyle.combobox_width_normal
height: VLCStyle.combobox_height_normal
=====================================
modules/gui/qt/player/qml/controlbarcontrols/VolumeWidget.qml
=====================================
@@ -91,7 +91,7 @@ T.Pane {
Navigation.rightItem: volControl
}
- Widgets.Slider {
+ Widgets.SliderExt {
id: volControl
// FIXME: use VLCStyle
=====================================
modules/gui/qt/vlc.qrc
=====================================
@@ -224,7 +224,7 @@
<file alias="CSDThemeButtonSet.qml">widgets/qml/CSDThemeButtonSet.qml</file>
<file alias="CSDThemeButton.qml">widgets/qml/CSDThemeButton.qml</file>
<file alias="TextFieldExt.qml">widgets/qml/TextFieldExt.qml</file>
- <file alias="Slider.qml">widgets/qml/Slider.qml</file>
+ <file alias="SliderExt.qml">widgets/qml/SliderExt.qml</file>
<file alias="FadingEdge.qml">widgets/qml/FadingEdge.qml</file>
<file alias="FadingEdgeForListView.qml">widgets/qml/FadingEdgeForListView.qml</file>
<file alias="PopupIconToolButton.qml">widgets/qml/PopupIconToolButton.qml</file>
=====================================
modules/gui/qt/widgets/qml/Slider.qml → modules/gui/qt/widgets/qml/SliderExt.qml
=====================================
@@ -24,6 +24,7 @@ import QtQuick.Templates 2.12 as T
import org.videolan.vlc 0.1
import "qrc:///style/"
+import "qrc:///util/Helpers.js" as Helpers
T.Slider {
id: control
@@ -62,8 +63,12 @@ T.Slider {
return value
}
- readonly property real _tooltipX: toolTipFollowsMouse ? hoverHandler.point.position.x
- : (handle.x + handle.width / 2) // handle center
+ readonly property real _tooltipX: {
+ if (toolTipFollowsMouse && hoverHandler.hovered)
+ return hoverHandler.point.position.x
+
+ return (handle.x + handle.width / 2) // handle center
+ }
// find position under given x, can be used with Slider::valueAt()
// x is coordinate in this control's coordinate space
@@ -132,6 +137,8 @@ T.Slider {
acceptedPointerTypes: PointerDevice.Mouse
enabled: true
+
+ target: background
}
PointingTooltip {
@@ -146,7 +153,10 @@ T.Slider {
text: {
if (!visible) return ""
- const v = control.valueAt(control.positionAt(pos.x))
+ // position is only measured till half of handle width
+ // pos.x may go beyond the position at the edges
+ const p = Helpers.clamp(control.positionAt(pos.x), 0.0, 1.0)
+ const v = control.valueAt(p)
return control.toolTipTextProvider(v)
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/65ee7a1704b0371cabbd0e1e3fc772c47e2d9c4a...76d2267c4902e305f5e8ad8c98f3f777480a924b
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/65ee7a1704b0371cabbd0e1e3fc772c47e2d9c4a...76d2267c4902e305f5e8ad8c98f3f777480a924b
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