mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 06:36:55 +02:00
* Implemented ArtistPlaylistInterface.
This commit is contained in:
@@ -54,22 +54,18 @@ ArtistPlaylistInterface::~ArtistPlaylistInterface()
|
|||||||
void
|
void
|
||||||
ArtistPlaylistInterface::setCurrentIndex( qint64 index )
|
ArtistPlaylistInterface::setCurrentIndex( qint64 index )
|
||||||
{
|
{
|
||||||
Q_UNUSED( index );
|
m_currentTrack = index;
|
||||||
Q_ASSERT( false );
|
m_currentItem = m_queries.at( index )->results().first();
|
||||||
|
|
||||||
/* m_currentTrack = index;
|
|
||||||
m_currentItem = m_queries.at( index )->results().first();*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
qint64
|
qint64
|
||||||
ArtistPlaylistInterface::siblingIndex( int itemsAway, qint64 rootIndex ) const
|
ArtistPlaylistInterface::siblingIndex( int itemsAway, qint64 rootIndex ) const
|
||||||
{
|
{
|
||||||
Q_UNUSED( itemsAway );
|
qint64 p = m_currentTrack;
|
||||||
Q_UNUSED( rootIndex );
|
if ( rootIndex >= 0 )
|
||||||
Q_ASSERT( false );
|
p = rootIndex;
|
||||||
|
|
||||||
/* qint64 p = m_currentTrack;
|
|
||||||
p += itemsAway;
|
p += itemsAway;
|
||||||
|
|
||||||
if ( p < 0 )
|
if ( p < 0 )
|
||||||
@@ -78,9 +74,7 @@ ArtistPlaylistInterface::siblingIndex( int itemsAway, qint64 rootIndex ) const
|
|||||||
if ( p >= m_queries.count() )
|
if ( p >= m_queries.count() )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return p;*/
|
return p;
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -232,3 +226,58 @@ ArtistPlaylistInterface::onTracksLoaded( const QList< query_ptr >& tracks )
|
|||||||
m_finished = true;
|
m_finished = true;
|
||||||
emit tracksLoaded( m_mode, m_collection );
|
emit tracksLoaded( m_mode, m_collection );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
qint64
|
||||||
|
ArtistPlaylistInterface::indexOfResult( const Tomahawk::result_ptr& result ) const
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
foreach ( const Tomahawk::query_ptr& query, m_queries )
|
||||||
|
{
|
||||||
|
if ( query->numResults() && query->results().contains( result ) )
|
||||||
|
return i;
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
qint64
|
||||||
|
ArtistPlaylistInterface::indexOfQuery( const Tomahawk::query_ptr& query ) const
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
foreach ( const Tomahawk::query_ptr& q, m_queries )
|
||||||
|
{
|
||||||
|
if ( q->equals( query ) )
|
||||||
|
return i;
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
query_ptr
|
||||||
|
ArtistPlaylistInterface::queryAt( qint64 index ) const
|
||||||
|
{
|
||||||
|
if ( index >= 0 && index < m_queries.count() )
|
||||||
|
{
|
||||||
|
return m_queries.at( index );
|
||||||
|
}
|
||||||
|
|
||||||
|
return Tomahawk::query_ptr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
result_ptr
|
||||||
|
ArtistPlaylistInterface::resultAt( qint64 index ) const
|
||||||
|
{
|
||||||
|
Tomahawk::query_ptr query = queryAt( index );
|
||||||
|
if ( query && query->numResults() )
|
||||||
|
return query->results().first();
|
||||||
|
|
||||||
|
return Tomahawk::result_ptr();
|
||||||
|
}
|
||||||
|
@@ -45,10 +45,10 @@ public:
|
|||||||
|
|
||||||
virtual void setCurrentIndex( qint64 index );
|
virtual void setCurrentIndex( qint64 index );
|
||||||
virtual qint64 siblingIndex( int itemsAway, qint64 rootIndex = -1 ) const;
|
virtual qint64 siblingIndex( int itemsAway, qint64 rootIndex = -1 ) const;
|
||||||
virtual Tomahawk::result_ptr resultAt( qint64 index ) const { Q_UNUSED( index ); Q_ASSERT( false ); return Tomahawk::result_ptr(); }
|
virtual Tomahawk::result_ptr resultAt( qint64 index ) const;
|
||||||
virtual Tomahawk::query_ptr queryAt( qint64 index ) const { Q_UNUSED( index ); Q_ASSERT( false ); return Tomahawk::query_ptr(); }
|
virtual Tomahawk::query_ptr queryAt( qint64 index ) const;
|
||||||
virtual qint64 indexOfResult( const Tomahawk::result_ptr& result ) const { Q_UNUSED( result ); Q_ASSERT( false ); return -1; }
|
virtual qint64 indexOfResult( const Tomahawk::result_ptr& result ) const;
|
||||||
virtual qint64 indexOfQuery( const Tomahawk::query_ptr& query ) const { Q_UNUSED( query ); Q_ASSERT( false ); return -1; }
|
virtual qint64 indexOfQuery( const Tomahawk::query_ptr& query ) const;
|
||||||
|
|
||||||
virtual Tomahawk::result_ptr currentItem() const;
|
virtual Tomahawk::result_ptr currentItem() const;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user