]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/playlist/standardpanel.cpp
Qt Imageset update.
[vlc] / modules / gui / qt4 / components / playlist / standardpanel.cpp
index be76a247c1a9085181fffd078d33e98f6f35cef4..e56651abb2ac027bd96f4c95f959b65773833121 100644 (file)
@@ -47,6 +47,8 @@
 
 #include <assert.h>
 
+#include "sorting.h"
+
 StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
                                   intf_thread_t *_p_intf,
                                   playlist_t *p_playlist,
@@ -60,11 +62,12 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
 
     /* 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 );
@@ -96,7 +99,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
 
     /* 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 );
@@ -105,12 +108,12 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
     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() );
@@ -120,17 +123,17 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
     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() );
@@ -155,10 +158,8 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
     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 */
@@ -174,19 +175,19 @@ void StandardPLPanel::toggleRepeat()
     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 ));
     }
 }
@@ -197,8 +198,8 @@ void StandardPLPanel::toggleRandom()
     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 ) );
 }
 
@@ -264,24 +265,24 @@ void StandardPLPanel::popupSelectColumn( QPoint pos )
 
     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( TRACKID );
-    ADD_META_ACTION( TITLE );
-    ADD_META_ACTION( DURATION );
-    ADD_META_ACTION( ARTIST );
-    ADD_META_ACTION( GENRE );
-    ADD_META_ACTION( COLLECTION );
-    ADD_META_ACTION( SEQ_NUM );
-    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
 
@@ -312,11 +313,14 @@ void StandardPLPanel::doPopup( QModelIndex index, QPoint point )
 /* 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 );
 }