From 940b39ab78dd42577008e9700af059d9dbacde36 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Fri, 22 Aug 2008 00:30:34 -0400 Subject: [PATCH] Qt: don't save A to B state when the input item changes. Also go to A if before current time is before A --- .../gui/qt4/components/interface_widgets.cpp | 17 ++++++++++++++++- .../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 49cda26567..94ac61228a 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 6150a01b84..098bcbcf96 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 2218eaac1b..6cccdf70fd 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: -- 2.39.2