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:
@@ -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;
|
||||
}
|
||||
|
@@ -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 );
|
||||
|
Reference in New Issue
Block a user