[vlc-commits] qt: input_slider: Take user settings into account when jumping

Hugo Beauzée-Luyssen git at videolan.org
Thu Apr 19 13:24:23 CEST 2018


vlc/vlc-3.0 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Apr 19 12:24:16 2018 +0200| [7142c0d95ed864055b51b15cc690c49243cd1113] | committer: Hugo Beauzée-Luyssen

qt: input_slider: Take user settings into account when jumping

But do so without using actions, as it would display the position using
OSD, while we're already displaying the FSC

(cherry picked from commit b11576810df6bf87d4e42e3ebe7d696e3a2e0d5f)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/gui/qt/util/input_slider.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt/util/input_slider.cpp b/modules/gui/qt/util/input_slider.cpp
index 75c666ca01..3bacbbe86d 100644
--- a/modules/gui/qt/util/input_slider.cpp
+++ b/modules/gui/qt/util/input_slider.cpp
@@ -401,10 +401,12 @@ void SeekSlider::wheelEvent( QWheelEvent *event )
     /* Don't do anything if we are for somehow reason sliding */
     if( !isSliding && isEnabled() )
     {
-        setValue( value() + event->delta() / 12 ); /* 12 = 8 * 15 / 10
-         Since delta is in 1/8 of ° and mouse have steps of 15 °
-         and that our slider is in 0.1% and we want one step to be a 1%
-         increment of position */
+        mtime_t i_size = var_InheritInteger( p_intf->obj.libvlc, "short-jump-size" );
+        int i_mode = var_InheritInteger( p_intf->obj.libvlc, "hotkeys-x-wheel-mode" );
+        if ( ( event->delta() > 0 && i_mode != 3 ) || ( event->delta() < 0 && i_mode == 3 ) )
+            i_size = - i_size;
+        float posOffset = static_cast<float>( i_size ) / static_cast<float>( inputLength );
+        setValue( value() + posOffset * maximum() );
         emit sliderDragged( value() / static_cast<float>( maximum() ) );
     }
     event->accept();



More information about the vlc-commits mailing list