1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-30 19:00:12 +02:00

* Implemented indexOfQuery in PlayableProxyModelPlaylistInterface.

This commit is contained in:
Christian Muehlhaeuser
2012-11-16 10:47:08 +01:00
parent 00f179a239
commit 6ff68c314c
2 changed files with 22 additions and 0 deletions

View File

@@ -259,3 +259,24 @@ PlayableProxyModelPlaylistInterface::indexOfResult( const Tomahawk::result_ptr&
return -1;
}
int
PlayableProxyModelPlaylistInterface::indexOfQuery( const Tomahawk::query_ptr& query ) const
{
if ( m_proxyModel.isNull() )
return -1;
PlayableProxyModel* proxyModel = m_proxyModel.data();
for ( int i = 0; i < proxyModel->rowCount( QModelIndex() ); i++ )
{
PlayableItem* item = proxyModel->itemFromIndex( proxyModel->mapToSource( proxyModel->index( i, 0 ) ) );
if ( item && item->query() == query )
{
return i;
}
}
return -1;
}

View File

@@ -45,6 +45,7 @@ public:
virtual Tomahawk::query_ptr itemAt( unsigned int position ) const;
virtual int indexOfResult( const Tomahawk::result_ptr& result ) const;
virtual int indexOfQuery( const Tomahawk::query_ptr& query ) const;
virtual Tomahawk::result_ptr currentItem() const;
virtual Tomahawk::result_ptr siblingItem( int itemsAway, bool readOnly );