{
Qt::ItemFlags flags = QAbstractItemModel::flags( index );
- PLItem *item = index.isValid() ? getItem( index ) : rootItem;
+ const PLItem *item = index.isValid() ? getItem( index ) : rootItem;
if( canEdit() )
{
void PLModel::activateItem( const QModelIndex &index )
{
assert( index.isValid() );
- PLItem *item = getItem( index );
+ const PLItem *item = getItem( index );
assert( item );
PL_LOCK;
playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id );
}
/****************** Base model mandatory implementations *****************/
-QVariant PLModel::data( const QModelIndex &index, int role ) const
+QVariant PLModel::data( const QModelIndex &index, const int role ) const
{
if( !index.isValid() ) return QVariant();
- PLItem *item = getItem( index );
+ const PLItem *item = getItem( index );
if( role == Qt::DisplayRole )
{
int metadata = columnToMeta( index.column() );
return QVariant( qfu( psz_column_title( meta_col ) ) );
}
-QModelIndex PLModel::index( int row, int column, const QModelIndex &parent )
+QModelIndex PLModel::index( const int row, const int column, const QModelIndex &parent )
const
{
PLItem *parentItem = parent.isValid() ? getItem( parent ) : rootItem;
return QModelIndex();
}
-QModelIndex PLModel::index( int i_id, int c )
+QModelIndex PLModel::index( const int i_id, const int c )
{
return index( findById( rootItem, i_id ), c );
}
int PLModel::rowCount( const QModelIndex &parent ) const
{
- PLItem *parentItem = parent.isValid() ? getItem( parent ) : rootItem;
+ const PLItem *parentItem = parent.isValid() ? getItem( parent ) : rootItem;
return parentItem->childCount();
}
QStringList lst;
for( int i = 0; i < current_selection.size(); i++ )
{
- PLItem *item = getItem( current_selection[i] );
+ const PLItem *item = getItem( current_selection[i] );
if( item )
{
PL_LOCK;
PLItem *nodeItem = findById( rootItem, i_parent );
if( !nodeItem ) return;
- foreach( PLItem *existing, nodeItem->children )
+ foreach( const PLItem *existing, nodeItem->children )
if( existing->i_id == i_item ) return;
PL_LOCK;
}
/******* Volume III: Sorting and searching ********/
-void PLModel::sort( int column, Qt::SortOrder order )
+void PLModel::sort( const int column, Qt::SortOrder order )
{
sort( rootItem->i_id, column, order );
}
-void PLModel::sort( int i_root_id, int column, Qt::SortOrder order )
+void PLModel::sort( const int i_root_id, const int column, Qt::SortOrder order )
{
msg_Dbg( p_intf, "Sorting by column %i, order %i", column, order );
/*** QModel subclassing ***/
/* Data structure */
- QVariant data( const QModelIndex &index, int role ) const;
+ QVariant data( const QModelIndex &index, const int role ) const;
QVariant headerData( int section, Qt::Orientation orientation,
int role = Qt::DisplayRole ) const;
int rowCount( const QModelIndex &parent = QModelIndex() ) const;
int columnCount( const QModelIndex &parent = QModelIndex() ) const;
Qt::ItemFlags flags( const QModelIndex &index ) const;
- QModelIndex index( int r, int c, const QModelIndex &parent ) const;
+ QModelIndex index( const int r, const int c, const QModelIndex &parent ) const;
QModelIndex parent( const QModelIndex &index ) const;
/* Drag and Drop */
/* Lookups */
QStringList selectedURIs();
- QModelIndex index( PLItem *, int c ) const;
- QModelIndex index( int i_id, int c );
+ QModelIndex index( PLItem *, const int c ) const;
+ QModelIndex index( const int i_id, const int c );
QModelIndex currentIndex() const;
bool isParent( const QModelIndex &index, const QModelIndex ¤t) const;
bool isCurrent( const QModelIndex &index ) const;
bool popup( const QModelIndex & index, const QPoint &point, const QModelIndexList &list );
void doDelete( QModelIndexList selected );
void search( const QString& search_text, const QModelIndex & root, bool b_recursive );
- void sort( int column, Qt::SortOrder order );
- void sort( int i_root_id, int column, Qt::SortOrder order );
+ void sort( const int column, Qt::SortOrder order );
+ void sort( const int i_root_id, const int column, Qt::SortOrder order );
void rebuild();
void rebuild( playlist_item_t * );