[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: add wrong input state to slider bar state machine
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Jul 14 14:26:54 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
1f6b48c1 by Fatih Uzunoglu at 2023-07-14T12:58:00+00:00
qml: add wrong input state to slider bar state machine
Co-authored-by: Pierre Lamot <pierre at videolabs.io>
- - - - -
36b02614 by Fatih Uzunoglu at 2023-07-14T12:58:00+00:00
qml: clamp progress bar tool tip x
- - - - -
33bf55c4 by Fatih Uzunoglu at 2023-07-14T12:58:00+00:00
qml: use mouse area width instead of control width in progress bar
- - - - -
1 changed file:
- modules/gui/qt/player/qml/SliderBar.qml
Changes:
=====================================
modules/gui/qt/player/qml/SliderBar.qml
=====================================
@@ -94,7 +94,7 @@ Slider {
return _text
}
- pos: Qt.point(sliderRectMouseArea.containsMouse ? sliderRectMouseArea.mouseX
+ pos: Qt.point(sliderRectMouseArea.containsMouse ? Helpers.clamp(sliderRectMouseArea.mouseX, 0, sliderRectMouseArea.width)
: (control.visualPosition * control.width), 0)
}
@@ -104,6 +104,7 @@ Slider {
signal pressControl(real position, bool forcePrecise)
signal releaseControl(real position, bool forcePrecise)
signal moveControl(real position, bool forcePrecise)
+ signal inputChanged()
//each signal is associated to a key, when a signal is received,
//transitions of active state for the given key are evaluated
@@ -111,11 +112,16 @@ Slider {
"playerUpdatePosition": fsm.playerUpdatePosition,
"pressControl": fsm.pressControl,
"releaseControl": fsm.releaseControl,
- "moveControl": fsm.moveControl
+ "moveControl": fsm.moveControl,
+ "inputChanged": fsm.inputChanged
})
initialState: fsmReleased
+ function _setPositionFromValue(position) {
+ control.value = position
+ }
+
function _seekToPosition(position, threshold, forcePrecise) {
position = Helpers.clamp(position, 0., 1.)
control.value = position
@@ -157,6 +163,26 @@ Slider {
fsm._seekToPosition(position, VLCStyle.dp(2) / control.width, forcePrecise)
}
},
+ "releaseControl": {
+ target: fsmReleased
+ },
+ "inputChanged": {
+ target: fsmHeldWrongInput
+ }
+ })
+ }
+
+ Util.FSMState {
+ id: fsmHeldWrongInput
+
+ function enter() {
+ fsm._setPositionFromValue(Player.position)
+ }
+
+ transitions: ({
+ "playerUpdatePosition": {
+ action: fsm._setPositionFromValue
+ },
"releaseControl": {
target: fsmReleased
}
@@ -167,6 +193,7 @@ Slider {
Connections {
target: Player
onPositionChanged: fsm.playerUpdatePosition(Player.position)
+ onInputChanged: fsm.inputChanged()
}
Component.onCompleted: value = Player.position
@@ -200,11 +227,11 @@ Slider {
hoverEnabled: true
- onPressed: fsm.pressControl(mouse.x / control.width, mouse.modifiers === Qt.ShiftModifier)
+ onPressed: fsm.pressControl(mouse.x / width, mouse.modifiers === Qt.ShiftModifier)
- onReleased: fsm.releaseControl(mouse.x / control.width, mouse.modifiers === Qt.ShiftModifier)
+ onReleased: fsm.releaseControl(mouse.x / width, mouse.modifiers === Qt.ShiftModifier)
- onPositionChanged: fsm.moveControl(mouse.x / control.width, mouse.modifiers === Qt.ShiftModifier)
+ onPositionChanged: fsm.moveControl(mouse.x / width, mouse.modifiers === Qt.ShiftModifier)
onEntered: {
if(Player.hasChapters)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e34463bba7de4a2add3b2130c912fc55d03c07e6...33bf55c40a0b12821b95c7730b174929597b029d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e34463bba7de4a2add3b2130c912fc55d03c07e6...33bf55c40a0b12821b95c7730b174929597b029d
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