class PlaylistItem : public wxTreeItemData
{
public:
- PlaylistItem( playlist_item_t *p_item ) : i_id(p_item->p_input->i_id) {}
+ PlaylistItem( playlist_item_t *p_item ) : wxTreeItemData()
+ {
+ i_id = p_item->i_id;
+ i_input_id = p_item->p_input->i_id;
+ }
+protected:
+ int i_input_id;
int i_id;
+friend class PlaylistManager;
};
/*****************************************************************************
{
/* Initializations */
p_intf = _p_intf;
- b_need_update = VLC_FALSE;
+ b_need_update = false;
i_items_to_append = 0;
i_cached_item_id = -1;
i_update_counter = 0;
- p_playlist = (playlist_t *)
- vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+ p_playlist = pl_Hold( p_intf );
if( p_playlist == NULL ) return;
var_Create( p_intf, "random", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
#if wxUSE_DRAG_AND_DROP
/* Associate drop targets with the playlist */
- SetDropTarget( new DragAndDrop( p_intf, VLC_TRUE ) );
+ SetDropTarget( new DragAndDrop( p_intf, true ) );
#endif
/* Update the playlist */
- Rebuild( VLC_TRUE );
+ Rebuild( true );
/*
* We want to be notified of playlist changes
vlc_value_t oval, vlc_value_t nval, void *param )
{
PlaylistManager *p_playlist = (PlaylistManager *)param;
- p_playlist->b_need_update = VLC_TRUE;
+ p_playlist->b_need_update = true;
return VLC_SUCCESS;
}
LockPlaylist( p_intf->p_sys, p_playlist );
playlist_item_t *p_item =
playlist_ItemGetById( p_playlist, ((PlaylistItem *)p_data)->i_id,
- VLC_TRUE );
+ true );
if( !p_item )
{
UnlockPlaylist( p_intf->p_sys, p_playlist );
wxString msg;
wxString duration = wxU( "" );
- char *psz_artist = p_item->p_input->p_meta->psz_artist ?
- strdup( p_item->p_input->p_meta->psz_artist ) :
- strdup( "" );
+
+ char *psz_artist = input_item_GetArtist( p_item->p_input );
if( !psz_artist )
- {
- UnlockPlaylist( p_intf->p_sys, p_playlist );
- return;
- }
+ psz_artist = strdup( "" );
+
+ char *psz_name = input_item_GetName( p_item->p_input );
+ if( !psz_name )
+ psz_name = strdup( "" );
char psz_duration[MSTRTIME_MAX_SIZE];
- mtime_t dur = p_item->p_input->i_duration;
+ mtime_t dur = input_item_GetDuration( p_item->p_input );
if( dur != -1 )
{
wxU( " )" ) );
}
- if( !strcmp( psz_artist, "" ) || p_item->p_input->b_fixed_name == VLC_TRUE )
+ if( !strcmp( psz_artist, "" ) || p_item->p_input->b_fixed_name == true )
{
- msg = wxString( wxU( p_item->p_input->psz_name ) ) + duration;
+ msg = wxString( wxU( psz_name ) ) + duration;
}
else
{
msg = wxString(wxU( psz_artist )) + wxT(" - ") +
- wxString(wxU(p_item->p_input->psz_name)) + duration;
+ wxString(wxU(psz_name)) + duration;
}
free( psz_artist );
+ free( psz_name );
treectrl->SetItemText( item , msg );
treectrl->SetItemImage( item, p_item->p_input->i_type );
node = FindItem( treectrl->GetRootItem(), p_add->i_node );
if( !node.IsOk() ) goto update;
- p_item = playlist_ItemGetById( p_playlist, p_add->i_item, VLC_TRUE );
+ p_item = playlist_ItemGetById( p_playlist, p_add->i_item, false );
if( !p_item ) goto update;
item = FindItem( treectrl->GetRootItem(), p_add->i_item );
if( this->b_need_update )
{
- this->b_need_update = VLC_FALSE;
- Rebuild( VLC_TRUE );
+ this->b_need_update = false;
+ Rebuild( true );
}
/* Updating the playing status every 0.5s is enough */
/**********************************************************************
* Rebuild the playlist
**********************************************************************/
-void PlaylistManager::Rebuild( vlc_bool_t b_root )
+void PlaylistManager::Rebuild( bool b_root )
{
i_items_to_append = 0;
i_cached_item_id = -1;
if( !p_wxparent ) return;
LockPlaylist( p_intf->p_sys, p_playlist );
- p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, VLC_TRUE );
- p_node = playlist_ItemGetById( p_playlist, p_wxparent->i_id, VLC_TRUE );
+ p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, true );
+ p_node = playlist_ItemGetById( p_playlist, p_wxparent->i_id, true );
if( !p_item || p_item->i_children >= 0 )
{
p_node = p_item;
p_item = NULL;
}
- playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE, p_node, p_item );
+ playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, p_node, p_item );
UnlockPlaylist( p_intf->p_sys, p_playlist );
}
{
/* Too many items waiting to be added, it will be quicker to rebuild
* the whole playlist */
- p_playlist->b_need_update = VLC_TRUE;
+ p_playlist->b_need_update = true;
return VLC_SUCCESS;
}