Commit 9f666f7c authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Playlist: scrollTo current-item and view issues...

Patch by Ilkka Ollakka
parent f0cf58a8
...@@ -144,9 +144,9 @@ void StandardPLPanel::toggleRandom() ...@@ -144,9 +144,9 @@ void StandardPLPanel::toggleRandom()
void StandardPLPanel::handleExpansion( const QModelIndex &index ) void StandardPLPanel::handleExpansion( const QModelIndex &index )
{ {
QModelIndex parent; QModelIndex parent;
view->scrollTo( index, QAbstractItemView::EnsureVisible );
if( model->isCurrent( index ) ) if( model->isCurrent( index ) )
{ {
view->scrollTo( index, QAbstractItemView::EnsureVisible );
parent = index; parent = index;
while( parent.isValid() ) while( parent.isValid() )
{ {
......
...@@ -79,6 +79,10 @@ void PLItem::init( int _i_id, int _i_input_id, PLItem *parent, PLModel *m) ...@@ -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" ); i_showflags = config_GetInt( model->p_intf , "qt-pl-showflags" );
updateview(); 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 ) ...@@ -86,6 +90,12 @@ void PLItem::updateview( void )
{ {
strings.clear(); 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 ) for( int i_index=1; i_index <= VLC_META_ENGINE_MB_TRM_ID; i_index = i_index*2 )
{ {
if( i_showflags & i_index ) if( i_showflags & i_index )
...@@ -170,7 +180,6 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent ) ...@@ -170,7 +180,6 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
{ {
char psz_duration[MSTRTIME_MAX_SIZE]; char psz_duration[MSTRTIME_MAX_SIZE];
assert( p_item->p_input->i_id == i_input_id ); assert( p_item->p_input->i_id == i_input_id );
strings.clear();
type = p_item->p_input->i_type; type = p_item->p_input->i_type;
current = iscurrent; current = iscurrent;
...@@ -182,6 +191,8 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent ) ...@@ -182,6 +191,8 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
else if( current ) else if( current )
model->removeArt(); model->removeArt();
strings.clear();
if( model->i_depth == 1 ) //left window for playlist etc. if( model->i_depth == 1 ) //left window for playlist etc.
{ {
strings.append( p_item->p_input->psz_name ); strings.append( p_item->p_input->psz_name );
...@@ -209,7 +220,7 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent ) ...@@ -209,7 +220,7 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
{ {
ADD_META( p_item->p_input->p_meta->psz_title ); ADD_META( p_item->p_input->p_meta->psz_title );
} else { } else {
ADD_META( p_item->p_input->psz_name ); strings.append( qfu( p_item->p_input->psz_name ) );
} }
break; break;
case VLC_META_ENGINE_DESCRIPTION: case VLC_META_ENGINE_DESCRIPTION:
...@@ -543,7 +554,6 @@ QModelIndex PLModel::parent(const QModelIndex &index) const ...@@ -543,7 +554,6 @@ QModelIndex PLModel::parent(const QModelIndex &index) const
int PLModel::columnCount( const QModelIndex &i) const int PLModel::columnCount( const QModelIndex &i) const
{ {
if( i_depth == 1 ) return 1;
return rootItem->strings.count(); return rootItem->strings.count();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment