]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/playlist/playlist_item.cpp
Qt: consistency between loop and random buttons.
[vlc] / modules / gui / qt4 / components / playlist / playlist_item.cpp
index a64cb166704e96d7c45040a1618adc60903fce07..0edde6a5f91c338b4de5c1333dd0fb0bfc70b3e1 100644 (file)
@@ -64,13 +64,14 @@ void PLItem::init( int _i_id, int _i_input_id, PLItem *parent, PLModel *m, QSett
     {
         if( model->i_depth == DEPTH_SEL )  /* Selector Panel */
         {
+            i_showflags = 0;
             item_col_strings.append( "" );
         }
         else
         {
-            i_showflags = settings->value( "qt-pl-showflags", 39 ).toInt();
+            i_showflags = settings->value( "qt-pl-showflags", COLUMN_DEFAULT ).toInt();
             if( i_showflags < 1)
-                i_showflags = 39; /* reasonable default to show something; */
+                i_showflags = COLUMN_DEFAULT; /* reasonable default to show something; */
             else if ( i_showflags >= COLUMN_END )
                 i_showflags = COLUMN_END - 1; /* show everything */
 
@@ -168,9 +169,6 @@ int PLItem::row() const
    */
 void PLItem::update( playlist_item_t *p_item, bool iscurrent )
 {
-    char psz_duration[MSTRTIME_MAX_SIZE];
-    char *psz_meta;
-
     assert( p_item->p_input->i_id == i_input_id );
 
     /* Useful for the model */
@@ -185,11 +183,18 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
         return;
     }
 
-    assert( parentItem->i_showflags < COLUMN_END );
+    i_showflags = parentItem ? parentItem->i_showflags : i_showflags;
 
-    for( uint32_t i_index=1; i_index < COLUMN_END; i_index <<= 1 )
+    /* Meta: ID */
+    if( i_showflags & COLUMN_NUMBER )
+    {
+        QModelIndex idx = model->index( this, 0 );
+        item_col_strings.append( QString::number( idx.row() + 1 ) );
+    }
+    /* Other meta informations */
+    for( uint32_t i_index=2; i_index < COLUMN_END; i_index <<= 1 )
     {
-        if( parentItem->i_showflags & i_index )
+        if( i_showflags & i_index )
         {
             char *psz = psz_column_meta( p_item->p_input, i_index );
             item_col_strings.append( qfu( psz ) );
@@ -197,3 +202,4 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
         }
     }
 }
+