]> git.sesse.net Git - vlc/commitdiff
Qt4 - Playlist: scrollTo current-item and view issues...
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 7 Aug 2007 17:57:46 +0000 (17:57 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 7 Aug 2007 17:57:46 +0000 (17:57 +0000)
Patch by Ilkka Ollakka

modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/playlist_model.cpp

index 594f4c09597262a48b26b0f6ef82bd34586c362a..ad5dc82c386561f00673669deae7f5746a9f2db8 100644 (file)
@@ -144,9 +144,9 @@ void StandardPLPanel::toggleRandom()
 void StandardPLPanel::handleExpansion( const QModelIndex &index )
 {
     QModelIndex parent;
-    view->scrollTo( index, QAbstractItemView::EnsureVisible );
     if( model->isCurrent( index ) )
     {
+        view->scrollTo( index, QAbstractItemView::EnsureVisible );
         parent = index;
         while( parent.isValid() )
         {
index 0d7c2fea2a6a5fa770cb50b19b03aa9d970acffd..9af62515fa139500f9bf27e6942562910cb877ce 100644 (file)
@@ -79,6 +79,10 @@ void PLItem::init( int _i_id, int _i_input_id, PLItem *parent, PLModel *m)
     {
         i_showflags = config_GetInt( model->p_intf , "qt-pl-showflags" );
         updateview();
+    } else {
+        i_showflags = parentItem->i_showflags;
+        //Add empty string and update() handles data appending
+        strings.append( qtr("") ); 
     }
 }
 
@@ -86,6 +90,12 @@ void PLItem::updateview( void )
 {
     strings.clear();
 
+    if( model->i_depth == 1 )  //left window for playlist etc.
+    {
+        strings.append( qtr("") );   
+        return;
+    }
+
     for( int i_index=1; i_index <= VLC_META_ENGINE_MB_TRM_ID; i_index = i_index*2 )
     {
         if( i_showflags & i_index )
@@ -170,7 +180,6 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
 {
     char psz_duration[MSTRTIME_MAX_SIZE];
     assert( p_item->p_input->i_id == i_input_id );
-    strings.clear();
 
     type = p_item->p_input->i_type;
     current = iscurrent;
@@ -182,6 +191,8 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
     else if( current )
         model->removeArt();
 
+    strings.clear();
+
     if( model->i_depth == 1 )  //left window for playlist etc.
     {
         strings.append( p_item->p_input->psz_name );
@@ -209,7 +220,7 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
                     {
                         ADD_META( p_item->p_input->p_meta->psz_title );
                     } else {
-                        ADD_META( p_item->p_input->psz_name );
+                        strings.append( qfu( p_item->p_input->psz_name ) );
                     }
                     break;
                 case VLC_META_ENGINE_DESCRIPTION:
@@ -543,7 +554,6 @@ QModelIndex PLModel::parent(const QModelIndex &index) const
 
 int PLModel::columnCount( const QModelIndex &i) const
 {
-    if( i_depth == 1 ) return 1;
     return rootItem->strings.count();
 }