#include <assert.h>
+#include "sorting.h"
+
StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
intf_thread_t *_p_intf,
playlist_t *p_playlist,
/* Create and configure the QTreeView */
view = new QVLCTreeView( 0 );
- view->setModel(model);
+ view->setSortingEnabled( true );
+ view->sortByColumn( 0 , Qt::AscendingOrder );
+ view->setModel( model );
view->setIconSize( QSize( 20, 20 ) );
view->setAlternatingRowColors( true );
view->setAnimated( true );
- view->setSortingEnabled( true );
view->setSelectionMode( QAbstractItemView::ExtendedSelection );
view->setDragEnabled( true );
view->setAcceptDrops( true );
/* Add item to the playlist button */
addButton = new QPushButton;
- addButton->setIcon( QIcon( ":/pixmaps/playlist_add.png" ) );
+ addButton->setIcon( QIcon( ":/playlist_add" ) );
addButton->setMaximumWidth( 30 );
BUTTONACT( addButton, popupAdd() );
buttons->addWidget( addButton );
randomButton = new QPushButton( this );
if( model->hasRandom() )
{
- randomButton->setIcon( QIcon( ":/pixmaps/playlist_shuffle_on.png" ));
+ randomButton->setIcon( QIcon( ":/shuffle_on" ));
randomButton->setToolTip( qtr( I_PL_RANDOM ));
}
else
{
- randomButton->setIcon( QIcon( ":/pixmaps/playlist_shuffle_off.png" ) );
+ randomButton->setIcon( QIcon( ":/shuffle_off" ) );
randomButton->setToolTip( qtr( I_PL_NORANDOM ));
}
BUTTONACT( randomButton, toggleRandom() );
repeatButton = new QPushButton( this );
if( model->hasRepeat() )
{
- repeatButton->setIcon( QIcon( ":/pixmaps/playlist_repeat_one.png" ) );
+ repeatButton->setIcon( QIcon( ":/repeat_one" ) );
repeatButton->setToolTip( qtr( I_PL_REPEAT ));
}
else if( model->hasLoop() )
{
- repeatButton->setIcon( QIcon( ":/pixmaps/playlist_repeat_all.png" ) );
+ repeatButton->setIcon( QIcon( ":/repeat_all" ) );
repeatButton->setToolTip( qtr( I_PL_LOOP ));
}
else
{
- repeatButton->setIcon( QIcon( ":/pixmaps/playlist_repeat_off.png" ) );
+ repeatButton->setIcon( QIcon( ":/repeat_off" ) );
repeatButton->setToolTip( qtr( I_PL_NOREPEAT ));
}
BUTTONACT( repeatButton, toggleRepeat() );
buttons->addWidget( searchLine ); filter->setBuddy( searchLine );
QPushButton *clear = new QPushButton;
- clear->setText( qfu( "CL") );
clear->setMaximumWidth( 30 );
- clear->setToolTip( qtr( "Clear" ));
- BUTTONACT( clear, clearFilter() );
+ BUTTON_SET_ACT_I( clear, "", clear, qtr( "Clear" ), clearFilter() );
buttons->addWidget( clear );
/* Finish the layout */
if( model->hasRepeat() )
{
model->setRepeat( false ); model->setLoop( true );
- repeatButton->setIcon( QIcon( ":/pixmaps/playlist_repeat_all.png" ) );
+ repeatButton->setIcon( QIcon( ":/repeat_all" ) );
repeatButton->setToolTip( qtr( I_PL_LOOP ));
}
else if( model->hasLoop() )
{
model->setRepeat( false ) ; model->setLoop( false );
- repeatButton->setIcon( QIcon( ":/pixmaps/playlist_repeat_off.png" ) );
+ repeatButton->setIcon( QIcon( ":/repeat_off" ) );
repeatButton->setToolTip( qtr( I_PL_NOREPEAT ));
}
else
{
model->setRepeat( true );
- repeatButton->setIcon( QIcon( ":/pixmaps/playlist_repeat_one.png" ) );
+ repeatButton->setIcon( QIcon( ":/repeat_one" ) );
repeatButton->setToolTip( qtr( I_PL_REPEAT ));
}
}
bool prev = model->hasRandom();
model->setRandom( !prev );
randomButton->setIcon( prev ?
- QIcon( ":/pixmaps/playlist_shuffle_off.png" ) :
- QIcon( ":/pixmaps/playlist_shuffle_on.png" ) );
+ QIcon( ":/shuffle_off" ) :
+ QIcon( ":/shuffle_on" ) );
randomButton->setToolTip( prev ? qtr( I_PL_NORANDOM ) : qtr(I_PL_RANDOM ) );
}
QMenu selectColMenu;
-#define ADD_META_ACTION( meta ) { \
- QAction* option = selectColMenu.addAction( qfu(VLC_META_##meta) ); \
- option->setCheckable( true ); \
- option->setChecked( model->shownFlags() & VLC_META_ENGINE_##meta ); \
- ContextUpdateMapper->setMapping( option, VLC_META_ENGINE_##meta ); \
- CONNECT( option, triggered(), ContextUpdateMapper, map() ); \
+#define ADD_META_ACTION( meta ) { \
+ QAction* option = selectColMenu.addAction( qfu( psz_column_title( meta ) ) ); \
+ option->setCheckable( true ); \
+ option->setChecked( model->shownFlags() & meta ); \
+ ContextUpdateMapper->setMapping( option, meta ); \
+ CONNECT( option, triggered(), ContextUpdateMapper, map() ); \
}
CONNECT( ContextUpdateMapper, mapped( int ), model, viewchanged( int ) );
- ADD_META_ACTION( TITLE );
- ADD_META_ACTION( ARTIST );
- ADD_META_ACTION( DURATION );
- ADD_META_ACTION( COLLECTION );
- ADD_META_ACTION( GENRE );
- ADD_META_ACTION( SEQ_NUM );
- ADD_META_ACTION( RATING );
- ADD_META_ACTION( DESCRIPTION );
+ ADD_META_ACTION( COLUMN_NUMBER );
+ ADD_META_ACTION( COLUMN_TITLE );
+ ADD_META_ACTION( COLUMN_DURATION );
+ ADD_META_ACTION( COLUMN_ARTIST );
+ ADD_META_ACTION( COLUMN_GENRE );
+ ADD_META_ACTION( COLUMN_ALBUM );
+ ADD_META_ACTION( COLUMN_TRACK_NUMBER );
+ ADD_META_ACTION( COLUMN_DESCRIPTION );
#undef ADD_META_ACTION
/* This activated by the selector selection */
void StandardPLPanel::setRoot( int i_root_id )
{
+ QPL_LOCK;
playlist_item_t *p_item = playlist_ItemGetById( THEPL, i_root_id,
- VLC_TRUE );
+ pl_Locked );
assert( p_item );
p_item = playlist_GetPreferredNode( THEPL, p_item );
assert( p_item );
+ QPL_UNLOCK;
+
model->rebuild( p_item );
}
model->removeItem( i_id );
}
-/* Delete and Suppr key remove the selection
+/* Delete and Suppr key remove the selection
FilterKey function and code function */
void StandardPLPanel::keyPressEvent( QKeyEvent *e )
{