Commit 0f70e31b authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 IM. Commenting the work done.

parent 14e79100
...@@ -50,6 +50,9 @@ static int VolumeChanged( vlc_object_t *, const char *, ...@@ -50,6 +50,9 @@ static int VolumeChanged( vlc_object_t *, const char *,
/********************************************************************** /**********************************************************************
* InputManager implementation * InputManager implementation
**********************************************************************
* The Input Manager can be the main one around the playlist
* But can also be used for VLM dialog or similar
**********************************************************************/ **********************************************************************/
InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) : InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) :
...@@ -66,6 +69,9 @@ InputManager::~InputManager() ...@@ -66,6 +69,9 @@ InputManager::~InputManager()
delInput(); delInput();
} }
/* Define the Input used.
Add the callbacks on input
p_input is yield once here */
void InputManager::setInput( input_thread_t *_p_input ) void InputManager::setInput( input_thread_t *_p_input )
{ {
delInput(); delInput();
...@@ -84,6 +90,9 @@ void InputManager::setInput( input_thread_t *_p_input ) ...@@ -84,6 +90,9 @@ void InputManager::setInput( input_thread_t *_p_input )
} }
} }
/* delete Input if it ever existed.
Delete the callbacls on input
p_input is released once here */
void InputManager::delInput() void InputManager::delInput()
{ {
if( p_input ) if( p_input )
...@@ -102,6 +111,7 @@ void InputManager::delInput() ...@@ -102,6 +111,7 @@ void InputManager::delInput()
} }
} }
/* Add the callbacks on Input. Self explanatory */
void InputManager::addCallbacks() void InputManager::addCallbacks()
{ {
/* We don't care about: /* We don't care about:
...@@ -127,6 +137,7 @@ void InputManager::addCallbacks() ...@@ -127,6 +137,7 @@ void InputManager::addCallbacks()
var_AddCallback( p_input, "intf-change", InterfaceChanged, this ); var_AddCallback( p_input, "intf-change", InterfaceChanged, this );
} }
/* Delete the callbacks on Input. Self explanatory */
void InputManager::delCallbacks() void InputManager::delCallbacks()
{ {
var_DelCallback( p_input, "audio-es", ChangeAudio, this ); var_DelCallback( p_input, "audio-es", ChangeAudio, this );
...@@ -137,16 +148,17 @@ void InputManager::delCallbacks() ...@@ -137,16 +148,17 @@ void InputManager::delCallbacks()
var_DelCallback( p_input, "intf-change", InterfaceChanged, this ); var_DelCallback( p_input, "intf-change", InterfaceChanged, this );
} }
/* Convert the event from the callbacks in actions */
void InputManager::customEvent( QEvent *event ) void InputManager::customEvent( QEvent *event )
{ {
int type = event->type(); int type = event->type();
if ( type != PositionUpdate_Type && type != ItemChanged_Type && if ( type != PositionUpdate_Type &&
type != ItemRateChanged_Type && type != ItemTitleChanged_Type && type != ItemChanged_Type &&
type != ItemRateChanged_Type &&
type != ItemTitleChanged_Type &&
type != ItemStateChanged_Type ) type != ItemStateChanged_Type )
return; return;
msg_Dbg( p_intf, "New IM Event, type: %i", type );
/* Delete the input */ /* Delete the input */
if( !p_input || p_input->b_dead || p_input->b_die ) if( !p_input || p_input->b_dead || p_input->b_die )
{ {
...@@ -154,6 +166,7 @@ void InputManager::customEvent( QEvent *event ) ...@@ -154,6 +166,7 @@ void InputManager::customEvent( QEvent *event )
return; return;
} }
/* Actions */
switch( type ) switch( type )
{ {
case PositionUpdate_Type: case PositionUpdate_Type:
...@@ -293,6 +306,7 @@ void InputManager::sliderUpdate( float new_pos ) ...@@ -293,6 +306,7 @@ void InputManager::sliderUpdate( float new_pos )
var_SetFloat( p_input, "position", new_pos ); var_SetFloat( p_input, "position", new_pos );
} }
/* User togglePlayPause */
void InputManager::togglePlayPause() void InputManager::togglePlayPause()
{ {
vlc_value_t state; vlc_value_t state;
...@@ -397,7 +411,8 @@ void InputManager::setRate( int new_rate ) ...@@ -397,7 +411,8 @@ void InputManager::setRate( int new_rate )
/********************************************************************** /**********************************************************************
* MainInputManager implementation. Wrap an input manager and * MainInputManager implementation. Wrap an input manager and
* take care of updating the main playlist input * take care of updating the main playlist input.
* Used in the main playlist Dialog
**********************************************************************/ **********************************************************************/
MainInputManager * MainInputManager::instance = NULL; MainInputManager * MainInputManager::instance = NULL;
...@@ -407,16 +422,17 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) ...@@ -407,16 +422,17 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf )
p_input = NULL; p_input = NULL;
im = new InputManager( this, p_intf ); im = new InputManager( this, p_intf );
// No necessary, I think
//var_AddCallback( THEPL, "intf-change", ItemChanged, im );
var_AddCallback( THEPL, "item-change", PLItemChanged, this ); var_AddCallback( THEPL, "item-change", PLItemChanged, this );
var_AddCallback( THEPL, "playlist-current", PLItemChanged, this ); var_AddCallback( THEPL, "playlist-current", PLItemChanged, this );
var_AddCallback( THEPL, "playlist-current", ItemChanged, im );
var_AddCallback( THEPL, "activity", PLItemChanged, this ); var_AddCallback( THEPL, "activity", PLItemChanged, this );
var_AddCallback( THEPL, "playlist-current", ItemChanged, im );
var_AddCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, this ); var_AddCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, this );
// No necessary, I think TODO REMOVE ME at the end
//var_AddCallback( THEPL, "intf-change", ItemChanged, im );
/* Warn our embedded IM about input changes */ /* Warn our embedded IM about input changes */
CONNECT( this, inputChanged( input_thread_t * ), CONNECT( this, inputChanged( input_thread_t * ),
im, setInput( input_thread_t * ) ); im, setInput( input_thread_t * ) );
...@@ -435,7 +451,7 @@ MainInputManager::~MainInputManager() ...@@ -435,7 +451,7 @@ MainInputManager::~MainInputManager()
var_DelCallback( THEPL, "activity", PLItemChanged, this ); var_DelCallback( THEPL, "activity", PLItemChanged, this );
var_DelCallback( THEPL, "item-change", PLItemChanged, this ); var_DelCallback( THEPL, "item-change", PLItemChanged, this );
// var_DelCallback( THEPL, "intf-change", ItemChanged, this ); var_DelCallback( THEPL, "playlist-current", ItemChanged, im );
} }
void MainInputManager::customEvent( QEvent *event ) void MainInputManager::customEvent( QEvent *event )
...@@ -450,8 +466,7 @@ void MainInputManager::customEvent( QEvent *event ) ...@@ -450,8 +466,7 @@ void MainInputManager::customEvent( QEvent *event )
return; return;
} }
msg_Dbg( p_intf, "New MIM Event, type: %i", type ); /* Should be PLItemChanged Event */
/* Should be PLItemChanged */
if( VLC_OBJECT_INTF == p_intf->i_object_type ) if( VLC_OBJECT_INTF == p_intf->i_object_type )
{ {
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
......
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