Commit bcdcaf27 authored by lukas.durfina's avatar lukas.durfina Committed by Jean-Baptiste Kempf

qt4: fix synchronization of advanced buttons in both controllers

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 4ca1e8b9
...@@ -58,6 +58,10 @@ ...@@ -58,6 +58,10 @@
#define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a media") #define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a media")
/* init static variables in advanced controls */
mtime_t AdvControlsWidget::timeA = 0;
mtime_t AdvControlsWidget::timeB = 0;
/********************************************************************** /**********************************************************************
* Video Widget. A simple frame on which video is drawn * Video Widget. A simple frame on which video is drawn
* This class handles resize issues * This class handles resize issues
...@@ -298,7 +302,7 @@ void VisualSelector::next() ...@@ -298,7 +302,7 @@ void VisualSelector::next()
aButton->setMinimumSize( QSize( 26, 26 ) ); \ aButton->setMinimumSize( QSize( 26, 26 ) ); \
aButton->setIconSize( QSize( 20, 20 ) ); } aButton->setIconSize( QSize( 20, 20 ) ); }
AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) : AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i, bool b_fsCreation = false ) :
QFrame( NULL ), p_intf( _p_i ) QFrame( NULL ), p_intf( _p_i )
{ {
QHBoxLayout *advLayout = new QHBoxLayout( this ); QHBoxLayout *advLayout = new QHBoxLayout( this );
...@@ -314,8 +318,15 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) : ...@@ -314,8 +318,15 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) :
qtr( "Loop from point A to point B continuously.\nClick to set point A" ), qtr( "Loop from point A to point B continuously.\nClick to set point A" ),
fromAtoB() ); fromAtoB() );
timeA = timeB = 0; timeA = timeB = 0;
CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ), /* in FS controller we skip this, because we dont want to have it double
this, AtoBLoop( float, int, int ) ); controlled */
if( !b_fsCreation )
CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
this, AtoBLoop( float, int, int ) );
/* set up synchronization between main controller and fs controller */
CONNECT( THEMIM->getIM(), advControlsSetIcon(), this, setIcon() );
connect( this, SIGNAL( timeChanged() ),
THEMIM->getIM(), SIGNAL( advControlsSetIcon()));
#if 0 #if 0
frameButton = new QPushButton( "Fr" ); frameButton = new QPushButton( "Fr" );
frameButton->setMaximumSize( QSize( 26, 26 ) ); frameButton->setMaximumSize( QSize( 26, 26 ) );
...@@ -368,22 +379,39 @@ void AdvControlsWidget::fromAtoB() ...@@ -368,22 +379,39 @@ void AdvControlsWidget::fromAtoB()
if( !timeA ) if( !timeA )
{ {
timeA = var_GetTime( THEMIM->getInput(), "time" ); timeA = var_GetTime( THEMIM->getInput(), "time" );
ABButton->setToolTip( qtr( "Click to set point B" ) ); emit timeChanged();
ABButton->setIcon( QIcon( ":/atob_noa" ) );
return; return;
} }
if( !timeB ) if( !timeB )
{ {
timeB = var_GetTime( THEMIM->getInput(), "time" ); timeB = var_GetTime( THEMIM->getInput(), "time" );
var_SetTime( THEMIM->getInput(), "time" , timeA ); var_SetTime( THEMIM->getInput(), "time" , timeA );
ABButton->setIcon( QIcon( ":/atob" ) ); emit timeChanged();
ABButton->setToolTip( qtr( "Stop the A to B loop" ) );
return; return;
} }
timeA = 0; timeA = 0;
timeB = 0; timeB = 0;
ABButton->setToolTip( qtr( "Loop from point A to point B continuously\nClick to set point A" ) ); emit timeChanged();
ABButton->setIcon( QIcon( ":/atob_nob" ) ); }
/* setting/synchro icons after click on main or fs controller */
void AdvControlsWidget::setIcon()
{
if( !timeA && !timeB)
{
ABButton->setIcon( QIcon( ":/atob_nob" ) );
ABButton->setToolTip( qtr( "Loop from point A to point B continuously\nClick to set point A" ) );
}
else if( timeA && !timeB )
{
ABButton->setIcon( QIcon( ":/atob_noa" ) );
ABButton->setToolTip( qtr( "Click to set point B" ) );
}
else if( timeA && timeB )
{
ABButton->setIcon( QIcon( ":/atob" ) );
ABButton->setToolTip( qtr( "Stop the A to B loop" ) );
}
} }
/* Function called regularly when in an AtoB loop */ /* Function called regularly when in an AtoB loop */
...@@ -441,7 +469,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -441,7 +469,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
/* advanced Controls handling */ /* advanced Controls handling */
b_advancedVisible = b_advControls; b_advancedVisible = b_advControls;
advControls = new AdvControlsWidget( p_intf ); advControls = new AdvControlsWidget( p_intf, b_fsCreation );
if( !b_advancedVisible ) advControls->hide(); if( !b_advancedVisible ) advControls->hide();
/** Disc and Menus handling */ /** Disc and Menus handling */
......
...@@ -145,7 +145,7 @@ class AdvControlsWidget : public QFrame ...@@ -145,7 +145,7 @@ class AdvControlsWidget : public QFrame
{ {
Q_OBJECT Q_OBJECT
public: public:
AdvControlsWidget( intf_thread_t *); AdvControlsWidget( intf_thread_t *, bool );
virtual ~AdvControlsWidget(); virtual ~AdvControlsWidget();
void enableInput( bool ); void enableInput( bool );
...@@ -156,7 +156,7 @@ private: ...@@ -156,7 +156,7 @@ private:
QPushButton *recordButton, *ABButton; QPushButton *recordButton, *ABButton;
QPushButton *snapshotButton, *frameButton; QPushButton *snapshotButton, *frameButton;
mtime_t timeA, timeB; static mtime_t timeA, timeB;
private slots: private slots:
void snapshot(); void snapshot();
...@@ -166,6 +166,10 @@ private slots: ...@@ -166,6 +166,10 @@ private slots:
void fromAtoB(); void fromAtoB();
void record(); void record();
void AtoBLoop( float, int, int ); void AtoBLoop( float, int, int );
void setIcon();
signals:
void timeChanged();
}; };
/* Button Bar */ /* Button Bar */
......
...@@ -124,6 +124,8 @@ signals: ...@@ -124,6 +124,8 @@ signals:
void toggleTelexButtons(); void toggleTelexButtons();
void toggleTelexTransparency(); void toggleTelexTransparency();
void setNewTelexPage( int ); void setNewTelexPage( int );
/// Advanced buttons
void advControlsSetIcon();
}; };
class MainInputManager : public QObject class MainInputManager : public QObject
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment