Commit 778a6f07 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Merge branch 'master' of git.videolan.org:vlc

parents 8d76c39a f8aeca6a
...@@ -160,6 +160,21 @@ void PlIconViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt ...@@ -160,6 +160,21 @@ void PlIconViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
QFont font( index.data( Qt::FontRole ).value<QFont>() ); QFont font( index.data( Qt::FontRole ).value<QFont>() );
font.setPointSize( 7 ); font.setPointSize( 7 );
//Draw children indicator
if( !index.data( PLModel::IsLeafNodeRole ).toBool() )
{
painter->setOpacity( 0.75 );
QRect r( option.rect );
r.setSize( QSize( 25, 25 ) );
r.translate( 5, 5 );
painter->fillRect( r, option.palette.color( QPalette::Mid ) );
painter->setOpacity( 1.0 );
QPixmap dirPix( ":/type/node" );
QRect r2( dirPix.rect() );
r2.moveCenter( r.center() );
painter->drawPixmap( r2, dirPix );
}
// Draw title // Draw title
font.setItalic( true ); font.setItalic( true );
painter->setFont( font ); painter->setFont( font );
...@@ -254,6 +269,15 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt ...@@ -254,6 +269,15 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
textRect.moveBottom( option.rect.center().y() - 1 ); textRect.moveBottom( option.rect.center().y() - 1 );
} }
//Draw children indicator
if( !index.data( PLModel::IsLeafNodeRole ).toBool() )
{
QPixmap dirPix = QPixmap( ":/type/node" );
painter->drawPixmap( QPoint( textRect.x(), textRect.center().y() - dirPix.height() / 2 ),
dirPix );
textRect.setLeft( textRect.x() + dirPix.width() + 5 );
}
painter->drawText( textRect, painter->drawText( textRect,
fm.elidedText( title, Qt::ElideRight, textRect.width() ), fm.elidedText( title, Qt::ElideRight, textRect.width() ),
textOpt ); textOpt );
......
...@@ -354,7 +354,19 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const ...@@ -354,7 +354,19 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
return QVariant( QBrush( Qt::gray ) ); return QVariant( QBrush( Qt::gray ) );
} }
else if( role == IsCurrentRole ) return QVariant( isCurrent( index ) ); else if( role == IsCurrentRole ) return QVariant( isCurrent( index ) );
else if( role == IsLeafNodeRole )
{
QVariant isLeaf;
PL_LOCK;
playlist_item_t *plItem =
playlist_ItemGetById( p_playlist, item->i_id );
if( plItem )
isLeaf = plItem->i_children == -1;
PL_UNLOCK;
return isLeaf;
}
return QVariant(); return QVariant();
} }
......
...@@ -55,7 +55,8 @@ friend class PLItem; ...@@ -55,7 +55,8 @@ friend class PLItem;
public: public:
enum { enum {
IsCurrentRole = Qt::UserRole IsCurrentRole = Qt::UserRole,
IsLeafNodeRole
}; };
PLModel( playlist_t *, intf_thread_t *, PLModel( playlist_t *, intf_thread_t *,
......
...@@ -406,7 +406,7 @@ void StandardPLPanel::cycleViews() ...@@ -406,7 +406,7 @@ void StandardPLPanel::cycleViews()
void StandardPLPanel::activate( const QModelIndex &index ) void StandardPLPanel::activate( const QModelIndex &index )
{ {
if( model->hasChildren( index ) ) if( !index.data( PLModel::IsLeafNodeRole ).toBool() )
{ {
if( currentView != treeView ) if( currentView != treeView )
browseInto( index ); browseInto( index );
......
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