1 /*****************************************************************************
2 * playlist_item.cpp : Manage playlist item
3 ****************************************************************************
4 * Copyright © 2006-2008 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Baptiste Kempf <jb@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
32 #include "playlist_item.hpp"
33 #include <vlc_intf_strings.h>
37 /*************************************************************************
38 * Playlist item implementation
39 *************************************************************************/
42 Playlist item is just a wrapper, an abstraction of the playlist_item
43 in order to be managed by PLModel
45 PLItem have a parent, and id and a input Id
49 void PLItem::init( playlist_item_t *_playlist_item, PLItem *parent )
51 parentItem = parent; /* Can be NULL, but only for the rootItem */
52 i_id = _playlist_item->i_id; /* Playlist item specific id */
53 p_input = _playlist_item->p_input;
54 vlc_gc_incref( p_input );
60 Call the above function init
62 PLItem::PLItem( playlist_item_t *p_item, PLItem *parent )
64 init( p_item, parent );
67 PLItem::PLItem( playlist_item_t * p_item )
74 vlc_gc_decref( p_input );
75 qDeleteAll( children );
79 /* So far signal is always true.
80 Using signal false would not call PLModel... Why ?
82 void PLItem::insertChild( PLItem *item, int i_pos, bool signal )
84 children.insert( i_pos, item );
87 /* This function is used to get one's parent's row number in the model */
88 int PLItem::row() const
91 return parentItem->children.indexOf( const_cast<PLItem*>(this) );
92 // We don't ever inherit PLItem, yet, but it might come :D