getSettings()->endGroup();
- CONNECT( THEMIM, inputChanged( input_thread_t * ),
- this, handleInputChange( input_thread_t * ) );
+ CONNECT( THEMIM, leafBecameParent( input_item_t *),
+ this, browseInto( input_item_t * ) );
CONNECT( model, currentChanged( const QModelIndex& ),
this, handleExpansion( const QModelIndex& ) );
void StandardPLPanel::activate( const QModelIndex &index )
{
- last_activated_id = model->itemId( index );
+ last_activated_id = model->getItem( index )->inputItem()->i_id;
if( model->hasChildren( index ) )
{
if( currentView == iconView ) {
}
}
-void StandardPLPanel::handleInputChange( input_thread_t *p_input_thread )
+void StandardPLPanel::browseInto( input_item_t *p_input )
{
- if( currentView != iconView ) return;
- input_item_t *p_input_item = input_GetItem( p_input_thread );
- if( !p_input_item ) return;
+ if( p_input->i_id != last_activated_id ) return;
playlist_Lock( THEPL );
- playlist_item_t *p_item = playlist_ItemGetByInput( THEPL, p_input_item );
+ playlist_item_t *p_item = playlist_ItemGetByInput( THEPL, p_input );
+ assert( p_item != NULL );
- if( p_item && p_item->p_parent &&
- p_item->p_parent->i_id == last_activated_id )
- {
- QModelIndex index = model->index( p_item->p_parent->i_id, 0 );
+ if( currentView == iconView ) {
+ QModelIndex index = model->index( p_item->i_id, 0 );
iconView->setRootIndex( index );
- //title->setText( index.data().toString() );
locationBar->setIndex( index );
- last_activated_id = p_item->i_id;
}
+ last_activated_id = p_item->pp_children[0]->p_input->i_id;
playlist_Unlock( THEPL );
}
void showView( int );
void cycleViews();
void activate( const QModelIndex & );
- void handleInputChange( input_thread_t * );
+ void browseInto( input_item_t * );
};
class LocationBar : public QToolBar
static int ItemChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * );
+static int LeafToParent( vlc_object_t *, const char *,
+ vlc_value_t, vlc_value_t, void * );
static int PLItemChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * );
static int PLItemAppended( vlc_object_t *, const char *,
var_AddCallback( THEPL, "item-change", ItemChanged, im );
var_AddCallback( THEPL, "item-current", PLItemChanged, this );
var_AddCallback( THEPL, "activity", PLItemChanged, this );
+ var_AddCallback( THEPL, "leaf-to-parent", LeafToParent, this );
var_AddCallback( THEPL, "playlist-item-append", PLItemAppended, this );
var_AddCallback( THEPL, "playlist-item-deleted", PLItemRemoved, this );
var_AddCallback( THEPL, "random", RandomChanged, this );
var_DelCallback( THEPL, "activity", PLItemChanged, this );
var_DelCallback( THEPL, "item-change", ItemChanged, im );
+ var_DelCallback( THEPL, "leaf-to-parent", LeafToParent, this );
var_DelCallback( THEPL, "item-current", PLItemChanged, this );
var_DelCallback( THEPL, "playlist-item-append", PLItemAppended, this );
int type = event->type();
PLEvent *plEv;
+ IMEvent *imEv;
// msg_Dbg( p_intf, "New MainIM Event of type: %i", type );
switch( type )
case RepeatChanged_Type:
notifyRepeatLoop();
return;
+ case LeafToParent_Type:
+ imEv = static_cast<IMEvent*>( event );
+ emit leafBecameParent( imEv->p_item );
default:
if( type != ItemChanged_Type ) return;
}
return VLC_SUCCESS;
}
+static int LeafToParent( vlc_object_t *p_this, const char *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *param )
+{
+ MainInputManager *mim = (MainInputManager*)param;
+
+ IMEvent *event = new IMEvent( LeafToParent_Type,
+ static_cast<input_item_t*>( newval.p_address ) );
+ QApplication::postEvent( mim, event );
+ return VLC_SUCCESS;
+}
+
static int VolumeChanged( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param )
{
RandomChanged_Type,
LoopChanged_Type,
RepeatChanged_Type,
+ LeafToParent_Type,
/* SignalChanged_Type, */
FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
class IMEvent : public QEvent
{
friend class InputManager;
+friend class MainInputManager;
public:
IMEvent( int type, input_item_t *p_input = NULL )
: QEvent( (QEvent::Type)(type) )
void playlistItemRemoved( int itemId );
void randomChanged( bool );
void repeatLoopChanged( int );
+ void leafBecameParent( input_item_t * );
};
#endif
var_SetBool( p_playlist, "intf-change", true );
var_Create( p_playlist, "item-change", VLC_VAR_ADDRESS );
+ var_Create( p_playlist, "leaf-to-parent", VLC_VAR_ADDRESS );
var_Create( p_playlist, "playlist-item-deleted", VLC_VAR_INTEGER );
var_SetInteger( p_playlist, "playlist-item-deleted", -1 );
pl_priv(p_playlist)->b_reset_currently_playing = true;
vlc_cond_signal( &pl_priv(p_playlist)->signal );
var_SetAddress( p_playlist, "item-change", p_item_in_category->p_input );
+ var_SetAddress( p_playlist, "leaf-to-parent", p_item_in_category->p_input );
PL_UNLOCK_IF( !b_locked );
return p_item_in_category;
}