/* And signal the view */
reset();
-
if( p_root ) emit rootIndexChanged();
}
doDelete(l);
}
+void PLModel::ensureArtRequested( const QModelIndex &index )
+{
+ if ( index.isValid() && hasChildren( index ) )
+ {
+ int nbnodes = rowCount( index );
+ QModelIndex child;
+ for( int row = 0 ; row < nbnodes ; row++ )
+ {
+ child = index.child( row, 0 );
+ if ( child.isValid() && getArtUrl( child ).isEmpty() )
+ THEMIM->getIM()->requestArtUpdate( getItem( child )->inputItem() );
+ }
+ }
+}
+
/*********** Popup *********/
bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QModelIndexList &list )
{
public slots:
virtual void activateItem( const QModelIndex &index );
void clearPlaylist();
+ void ensureArtRequested( const QModelIndex &index );
private:
/* General */
PLItem *rootItem;
/* Store new rootindexid*/
currentRootIndexId = model->itemId( index );
+ model->ensureArtRequested( index );
}
emit viewChanged( index );
QListView::keyPressEvent( event );
}
+void PlTreeView::setModel( QAbstractItemModel * model )
+{
+ QTreeView::setModel( model );
+ CONNECT( this, expanded( const QModelIndex & ),
+ model, ensureArtRequested( const QModelIndex & ) );
+}
+
void PlTreeView::startDrag ( Qt::DropActions supportedActions )
{
plViewStartDrag( this, supportedActions );
virtual void startDrag ( Qt::DropActions supportedActions );
virtual void dragMoveEvent ( QDragMoveEvent * event );
virtual void keyPressEvent( QKeyEvent *event );
+ virtual void setModel( QAbstractItemModel * );
};
class PicFlowView : public QAbstractItemView
data().toString();
}
+QString VLCModel::getArtUrl( const QModelIndex & index )
+{
+ return index.model()->index( index.row(),
+ columnFromMeta( COLUMN_COVER ),
+ index.parent() )
+ .data().toString();
+}
+
QPixmap VLCModel::getArtPixmap( const QModelIndex & index, const QSize & size )
{
- QString artUrl;
- artUrl = index.model()->index( index.row(),
- columnFromMeta( COLUMN_COVER ),
- index.parent() )
- .data().toString();
+ QString artUrl = VLCModel::getArtUrl( index ) ;
+
QPixmap artPix;
QString key = artUrl + QString("%1%2").arg(size.width()).arg(size.height());
virtual ~VLCModel();
static QString getMeta( const QModelIndex & index, int meta );
static QPixmap getArtPixmap( const QModelIndex & index, const QSize & size );
+ static QString getArtUrl( const QModelIndex & index );
static int columnToMeta( int _column )
{
if ( p_item )
{
+ /* check if it has already been enqueued */
+ if ( p_item->p_meta )
+ {
+ int status = vlc_meta_GetStatus( p_item->p_meta );
+ if ( status & ( ITEM_ART_NOTFOUND|ITEM_ART_FETCHED|
+ ITEM_ARTURL_FETCHED|ITEM_PREPARSED ) )
+ return;
+ }
playlist_AskForArtEnqueue( pl_Get(p_intf), p_item );
/* No input will signal the cover art to update,
* let's do it ourself */