]> git.sesse.net Git - vlc/commitdiff
Qt4 - A to B Loop implementation.
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 11 Nov 2007 01:52:28 +0000 (01:52 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sun, 11 Nov 2007 01:52:28 +0000 (01:52 +0000)
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp

index 388053ff8af76b8292bcd01f8148808cc8c82eaa..c5f1246ad4222209161dec5326d49fe77414f698 100644 (file)
@@ -237,6 +237,10 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) :
     ABButton->setIconSize( QSize( 20, 20 ) );
     advLayout->addWidget( ABButton );
     BUTTON_SET_ACT( ABButton, "AB", qtr( "A to B" ), fromAtoB() );
+    timeA = 0;
+    timeB = 0;
+    CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
+             this, AtoBLoop( float, int, int ) );
 
 //FIXME Frame by frame function
     frameButton = new QPushButton( "Fr" );
@@ -282,10 +286,40 @@ void AdvControlsWidget::snapshot()
     if( p_vout ) vout_Control( p_vout, VOUT_SNAPSHOT );
 }
 
-void AdvControlsWidget::frame(){}
-void AdvControlsWidget::fromAtoB(){}
+void AdvControlsWidget::frame()
+{
+}
+
+void AdvControlsWidget::fromAtoB()
+{
+    if( !timeA )
+    {
+        timeA = var_GetTime( THEMIM->getInput(), "time"  );
+        ABButton->setText( "A->..." );
+        return;
+    }
+    if( !timeB )
+    {
+        timeB = var_GetTime( THEMIM->getInput(), "time"  );
+        var_SetTime( THEMIM->getInput(), "time" , timeA );
+        ABButton->setText( "A<=>B" );
+        return;
+    }
+    timeA = 0;
+    timeB = 0;
+    ABButton->setText( "AB" );
+}
+   
 void AdvControlsWidget::record(){}
 
+void AdvControlsWidget::AtoBLoop( float f_pos, int i_time, int i_length )
+{
+    if( timeB )
+    {
+        if( i_time == (int)(timeB/1000000) )
+            var_SetTime( THEMIM->getInput(), "time" , timeA );
+    }
+}
 /*****************************
  * DA Control Widget !
  *****************************/
index 0605da2ce568622fa9d4522a691ba2e0e7c405a5..2bd25cdbfca93c3297e6ee972b91548ac1a756fb 100644 (file)
@@ -125,11 +125,14 @@ private:
     QPushButton *recordButton, *ABButton;
     QPushButton *snapshotButton, *frameButton;
 
+    mtime_t timeA, timeB;
+
 private slots:
     void snapshot();
     void frame();
     void fromAtoB();
     void record();
+    void AtoBLoop( float, int, int );
 };
 
 /* Button Bar */