QVariant MLModel::data( const QModelIndex &index, const int role ) const { if( index.isValid() ) { if( role == Qt::DisplayRole || role == Qt::EditRole ) { MLItem *it = static_cast<MLItem*>( index.internalPointer() ); if( !it ) return QVariant(); QVariant tmp = it->data( columnType( index.column() ) ); return tmp; } else if( role == Qt::DecorationRole && index.column() == 0 ) { /* FIXME: (see ml_type_e) media->type uses flags for media type information */ return QVariant( icons[ getInputItem(index)->i_type ] ); } else if( role == IsLeafNodeRole ) return isLeaf( index ); else if( role == IsCurrentsParentNodeRole ) return isParent( index, currentIndex() ); else if( role == IsCurrentRole ) { return QVariant( isCurrent( index ) ); } } return QVariant(); }
void VLCModel::ensureArtRequested( const QModelIndex &index ) { if ( index.isValid() && hasChildren( index ) ) { bool b_access = var_InheritBool( THEPL, "metadata-network-access" ); if ( !b_access ) return; int nbnodes = rowCount( index ); QModelIndex child; for( int row = 0 ; row < nbnodes ; row++ ) { child = index.child( row, COLUMN_COVER ); if ( child.isValid() && child.data().toString().isEmpty() ) THEMIM->getIM()->requestArtUpdate( getInputItem( child ), false ); } } }
void VLCModel::ensureArtRequested( const QModelIndex &index ) { if ( index.isValid() && hasChildren( index ) ) { int i_art_policy = var_GetInteger( THEPL, "album-art" ); if ( i_art_policy != ALBUM_ART_ALL ) return; 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( getInputItem( child ) ); } } }