]> git.sesse.net Git - vlc/commitdiff
Qt: don't save A to B state when the input item changes. Also go to A if before curre...
authorJean-Philippe Andre <jpeg@via.ecp.fr>
Fri, 22 Aug 2008 04:30:34 +0000 (00:30 -0400)
committerJean-Philippe Andre <jpeg@via.ecp.fr>
Fri, 22 Aug 2008 04:38:38 +0000 (00:38 -0400)
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/input_manager.hpp

index 49cda26567f850c8bf6fbb712894c90400aaba00..94ac61228a9df135ea16f8437b47b651743b36b7 100644 (file)
@@ -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 );
     }
 }
index 6150a01b8476b130452d99476e28c9f8c562d888..098bcbcf96c0aa699042982e08366e93c3d6e562 100644 (file)
@@ -157,6 +157,7 @@ private:
     QPushButton *snapshotButton, *frameButton;
 
     static mtime_t timeA, timeB;
+    int i_last_input_id;
 
 private slots:
     void snapshot();
index 2218eaac1b5cd5758d443df14108cc8d92fc3b7d..6cccdf70fd3c590254a3a4d4f38f7287c27240f6 100644 (file)
@@ -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: