[vlc-devel] commit: Improving the accuracy of the A to B looping in the qt4 interface. (Steven Sheehy )

git version control git at videolan.org
Mon Jan 18 08:26:29 CET 2010


vlc | branch: master | Steven Sheehy <steven.sheehy at gmail.com> | Mon Jan 18 08:25:38 2010 +0100| [9a706d6099a1b55480eb057a6fc1c20338422064] | committer: Jean-Baptiste Kempf 

Improving the accuracy of the A to B looping in the qt4 interface.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9a706d6099a1b55480eb057a6fc1c20338422064
---

 modules/gui/qt4/components/controller.cpp        |    4 ++--
 modules/gui/qt4/components/interface_widgets.cpp |    7 ++++---
 modules/gui/qt4/components/interface_widgets.hpp |    2 +-
 modules/gui/qt4/input_manager.cpp                |   18 +++++++++---------
 modules/gui/qt4/input_manager.hpp                |    4 ++--
 modules/gui/qt4/util/input_slider.cpp            |    2 +-
 modules/gui/qt4/util/input_slider.hpp            |    2 +-
 7 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/modules/gui/qt4/components/controller.cpp b/modules/gui/qt4/components/controller.cpp
index 7b8e26b..ed3f9c1 100644
--- a/modules/gui/qt4/components/controller.cpp
+++ b/modules/gui/qt4/components/controller.cpp
@@ -289,8 +289,8 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
         InputSlider *slider = new InputSlider( Qt::Horizontal, NULL );
 
         /* Update the position when the IM has changed */
-        CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
-                slider, setPosition( float, int, int ) );
+        CONNECT( THEMIM->getIM(), positionUpdated( float, int64_t, int ),
+                slider, setPosition( float, int64_t, int ) );
         /* And update the IM, when the position has changed */
         CONNECT( slider, sliderDragged( float ),
                  THEMIM->getIM(), sliderUpdate( float ) );
diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index 1da5835..e540836 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -601,11 +601,11 @@ TimeLabel::TimeLabel( intf_thread_t *_p_intf  ) :QLabel(), p_intf( _p_intf )
 
    CONNECT( THEMIM->getIM(), cachingChanged( float ),
             this, setCaching( float ) );
-   CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
-             this, setDisplayPosition( float, int, int ) );
+   CONNECT( THEMIM->getIM(), positionUpdated( float, int64_t, int ),
+             this, setDisplayPosition( float, int64_t, int ) );
 }
 
-void TimeLabel::setDisplayPosition( float pos, int time, int length )
+void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
 {
     if( pos == -1.f )
     {
@@ -613,6 +613,7 @@ void TimeLabel::setDisplayPosition( float pos, int time, int length )
         return;
     }
 
+    int time = t / 1000000;
     char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
     secstotimestr( psz_length, length );
     secstotimestr( psz_time, ( b_remainingTime && length ) ? length - time
diff --git a/modules/gui/qt4/components/interface_widgets.hpp b/modules/gui/qt4/components/interface_widgets.hpp
index dc611bc..f37b0e3 100644
--- a/modules/gui/qt4/components/interface_widgets.hpp
+++ b/modules/gui/qt4/components/interface_widgets.hpp
@@ -144,7 +144,7 @@ private:
 signals:
     void timeLabelDoubleClicked();
 private slots:
-    void setDisplayPosition( float pos, int time, int length );
+    void setDisplayPosition( float pos, int64_t time, int length );
     void setCaching( float );
 };
 
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index b6af6b3..e015077 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -373,10 +373,11 @@ static int VbiEvent( vlc_object_t *, const char *,
 void InputManager::UpdatePosition()
 {
     /* Update position */
-    int i_length, i_time; /* Int is enough, since we store seconds */
+    int i_length;
+    int64_t i_time;
     float f_pos;
     i_length = var_GetTime(  p_input , "length" ) / 1000000;
-    i_time = var_GetTime(  p_input , "time") / 1000000;
+    i_time = var_GetTime(  p_input , "time");
     f_pos = var_GetFloat(  p_input , "position" );
     emit positionUpdated( f_pos, i_time, i_length );
 }
@@ -861,26 +862,25 @@ void InputManager::setAtoB()
     {
         timeB = var_GetTime( THEMIM->getInput(), "time"  );
         var_SetTime( THEMIM->getInput(), "time" , timeA );
-        CONNECT( this, positionUpdated( float, int, int ),
-                 this, AtoBLoop( float, int, int ) );
+        CONNECT( this, positionUpdated( float, int64_t, int ),
+                 this, AtoBLoop( float, int64_t, int ) );
     }
     else
     {
         timeA = 0;
         timeB = 0;
-        disconnect( this, SIGNAL( positionUpdated( float, int, int ) ),
-                    this, SLOT( AtoBLoop( float, int, int ) ) );
+        disconnect( this, SIGNAL( positionUpdated( float, int64_t, int ) ),
+                    this, SLOT( AtoBLoop( float, int64_t, int ) ) );
     }
     emit AtoBchanged( (timeA != 0 ), (timeB != 0 ) );
 }
 
 /* Function called regularly when in an AtoB loop */
-void InputManager::AtoBLoop( float, int i_time, int )
+void InputManager::AtoBLoop( float, int64_t i_time, int )
 {
     if( timeB )
     {
-        if( ( i_time >= (int)( timeB/1000000 ) )
-            || ( i_time < (int)( timeA/1000000 ) ) )
+        if( i_time >= timeB || i_time < timeA )
             var_SetTime( THEMIM->getInput(), "time" , timeA );
     }
 }
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index 9355f4b..604a5b6 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -194,11 +194,11 @@ public slots:
 
 private slots:
     void togglePlayPause();
-    void AtoBLoop( float, int, int );
+    void AtoBLoop( float, int64_t, int );
 
 signals:
     /// Send new position, new time and new length
-    void positionUpdated( float , int, int );
+    void positionUpdated( float , int64_t, int );
     void rateChanged( int );
     void nameChanged( const QString& );
     /// Used to signal whether we should show navigation buttons
diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index e395f0a..9d57d3e 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -62,7 +62,7 @@ InputSlider::InputSlider( Qt::Orientation q, QWidget *_parent ) :
     CONNECT( timer, timeout(), this, seekTick() );
 }
 
-void InputSlider::setPosition( float pos, int a, int b )
+void InputSlider::setPosition( float pos, int64_t a, int b )
 {
     if( pos == -1.0 )
     {
diff --git a/modules/gui/qt4/util/input_slider.hpp b/modules/gui/qt4/util/input_slider.hpp
index 8bdc58f..08800f1 100644
--- a/modules/gui/qt4/util/input_slider.hpp
+++ b/modules/gui/qt4/util/input_slider.hpp
@@ -54,7 +54,7 @@ private:
     QTimer *timer;
 
 public slots:
-    void setPosition( float, int, int );
+    void setPosition( float, int64_t, int );
 private slots:
     void userDrag( int );
     void seekTick();




More information about the vlc-devel mailing list