1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-22 17:01:51 +02:00

* Clean up TrackModel / TrackProxyModel API a bit.

This commit is contained in:
Christian Muehlhaeuser 2010-10-23 09:20:24 +02:00
parent 5ed57069d3
commit bf43dadac9
4 changed files with 5 additions and 5 deletions

@ -16,8 +16,8 @@ CollectionProxyModel::CollectionProxyModel( QObject* parent )
bool
CollectionProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) const
{
PlItem* p1 = ((PlaylistInterface*)model())->itemFromIndex( left );
PlItem* p2 = ((PlaylistInterface*)model())->itemFromIndex( right );
PlItem* p1 = itemFromIndex( left );
PlItem* p2 = itemFromIndex( right );
if ( !p1 )
return true;

@ -23,7 +23,7 @@ public:
virtual int rowCount( const QModelIndex& parent ) const;
virtual int columnCount( const QModelIndex& parent ) const;
virtual QVariant data( const QModelIndex& index, int role ) const;
virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
virtual QVariant headerData( int section, Qt::Orientation orientation, int role ) const;
virtual PlItem* previousItem() { return 0; }

@ -132,7 +132,7 @@ TrackProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParen
if ( filterRegExp().isEmpty() )
return true;
PlItem* pi = ((PlaylistInterface*)model())->itemFromIndex( model()->index( sourceRow, 0, sourceParent ) );
PlItem* pi = itemFromIndex( sourceModel()->index( sourceRow, 0, sourceParent ) );
if ( !pi )
return false;

@ -13,7 +13,7 @@ Q_OBJECT
public:
explicit TrackProxyModel ( QObject* parent = 0 );
virtual TrackModel* model() const { return m_model; }
virtual TrackModel* sourceModel() const { return m_model; }
virtual void setSourceModel( TrackModel* sourceModel );
virtual QPersistentModelIndex currentItem() const { return mapFromSource( m_model->currentItem() ); }