[vlc-devel] commit: Qt: don't save A to B state when the input item changes. Also go to A if before current time is before A (Jean-Philippe Andre )

git version control git at videolan.org
Fri Aug 22 06:36:11 CEST 2008


vlc | branch: master | Jean-Philippe Andre <jpeg at via.ecp.fr> | Fri Aug 22 00:30:34 2008 -0400| [940b39ab78dd42577008e9700af059d9dbacde36] | committer: Jean-Philippe Andre 

Qt: don't save A to B state when the input item changes. Also go to A if before current time is before A

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

 modules/gui/qt4/components/interface_widgets.cpp |   17 ++++++++++++++++-
 modules/gui/qt4/components/interface_widgets.hpp |    1 +
 modules/gui/qt4/input_manager.hpp                |    2 +-
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index 49cda26..94ac612 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -318,6 +318,7 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i, bool b_fsCreation = f
       qtr( "Loop from point A to point B continuously.\nClick to set point A" ),
       fromAtoB() );
     timeA = timeB = 0;
+    i_last_input_id = 0;
     /* in FS controller we skip this, because we dont want to have it double
        controlled */
     if( !b_fsCreation )
@@ -354,8 +355,21 @@ AdvControlsWidget::~AdvControlsWidget()
 
 void AdvControlsWidget::enableInput( bool enable )
 {
+    int i_input_id = 0;
+    if( THEMIM->getInput() != NULL )
+    {
+        input_item_t *p_item = input_GetItem( THEMIM->getInput() );
+        i_input_id = p_item->i_id;
+    }
     ABButton->setEnabled( enable );
     recordButton->setEnabled( enable );
+
+    if( enable && ( i_last_input_id != i_input_id ) )
+    {
+        timeA = timeB = 0;
+        i_last_input_id = i_input_id;
+        emit timeChanged();
+    }
 }
 
 void AdvControlsWidget::enableVideo( bool enable )
@@ -419,7 +433,8 @@ void AdvControlsWidget::AtoBLoop( float f_pos, int i_time, int i_length )
 {
     if( timeB )
     {
-        if( i_time >= (int)(timeB/1000000) )
+        if( ( i_time >= (int)( timeB/1000000 ) )
+            || ( i_time < (int)( timeA/1000000 ) ) )
             var_SetTime( THEMIM->getInput(), "time" , timeA );
     }
 }
diff --git a/modules/gui/qt4/components/interface_widgets.hpp b/modules/gui/qt4/components/interface_widgets.hpp
index 6150a01..098bcbc 100644
--- a/modules/gui/qt4/components/interface_widgets.hpp
+++ b/modules/gui/qt4/components/interface_widgets.hpp
@@ -157,6 +157,7 @@ private:
     QPushButton *snapshotButton, *frameButton;
 
     static mtime_t timeA, timeB;
+    int i_last_input_id;
 
 private slots:
     void snapshot();
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index 2218eaa..6cccdf7 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -71,7 +71,7 @@ public:
     bool hasInput() { return p_input && !p_input->b_dead && vlc_object_alive (p_input); }
     bool hasAudio();
     bool hasVideo();
-    
+
     QString getName() { return old_name; }
 
 private:




More information about the vlc-devel mailing list