1 /*****************************************************************************
2 * selector.cpp : Playlist source selector
3 ****************************************************************************
4 * Copyright (C) 2000-2005 the VideoLAN team
5 * $Id: standardpanel.cpp 16024 2006-07-13 13:51:05Z xtophe $
7 * Authors: Clément Stenac <zorglub@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #include "components/playlist/selector.hpp"
26 #include <QVBoxLayout>
27 #include <QHeaderView>
30 PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf,
31 playlist_t *p_playlist ) : QWidget( p ), p_intf(_p_intf)
33 model = new PLModel( THEPL, THEPL->p_root_category, 1, this );
34 view = new QTreeView( 0 );
35 view->setIconSize( QSize( 24,24 ) );
36 view->setAlternatingRowColors( true );
37 view->setIndentation( 0 );
38 view->header()->hide();
39 view->setModel( model );
41 CONNECT( view, activated( const QModelIndex& ),
42 this, setSource( const QModelIndex& ) );
43 CONNECT( view, clicked( const QModelIndex& ),
44 this, setSource( const QModelIndex& ) );
46 QVBoxLayout *layout = new QVBoxLayout();
47 layout->setSpacing( 0 ); layout->setMargin( 0 );
48 layout->addWidget( view );
52 void PLSelector::setSource( const QModelIndex &index )
55 emit activated( model->itemId( index ) );
58 PLSelector::~PLSelector()