mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 22:26:32 +02:00
* Implemented AlbumPlaylistInterface.
This commit is contained in:
@@ -55,22 +55,18 @@ AlbumPlaylistInterface::~AlbumPlaylistInterface()
|
|||||||
void
|
void
|
||||||
AlbumPlaylistInterface::setCurrentIndex( qint64 index )
|
AlbumPlaylistInterface::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
|
||||||
AlbumPlaylistInterface::siblingIndex( int itemsAway, qint64 rootIndex ) const
|
AlbumPlaylistInterface::siblingIndex( int itemsAway, qint64 rootIndex ) const
|
||||||
{
|
{
|
||||||
Q_UNUSED( itemsAway );
|
|
||||||
Q_UNUSED( rootIndex );
|
|
||||||
Q_ASSERT( false );
|
|
||||||
|
|
||||||
/*
|
|
||||||
qint64 p = m_currentTrack;
|
qint64 p = m_currentTrack;
|
||||||
|
if ( rootIndex >= 0 )
|
||||||
|
p = rootIndex;
|
||||||
|
|
||||||
p += itemsAway;
|
p += itemsAway;
|
||||||
|
|
||||||
if ( p < 0 )
|
if ( p < 0 )
|
||||||
@@ -79,9 +75,7 @@ AlbumPlaylistInterface::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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -252,3 +246,58 @@ AlbumPlaylistInterface::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
|
||||||
|
AlbumPlaylistInterface::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
|
||||||
|
AlbumPlaylistInterface::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
|
||||||
|
AlbumPlaylistInterface::queryAt( qint64 index ) const
|
||||||
|
{
|
||||||
|
if ( index >= 0 && index < m_queries.count() )
|
||||||
|
{
|
||||||
|
return m_queries.at( index );
|
||||||
|
}
|
||||||
|
|
||||||
|
return Tomahawk::query_ptr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
result_ptr
|
||||||
|
AlbumPlaylistInterface::resultAt( qint64 index ) const
|
||||||
|
{
|
||||||
|
Tomahawk::query_ptr query = queryAt( index );
|
||||||
|
if ( query && query->numResults() )
|
||||||
|
return query->results().first();
|
||||||
|
|
||||||
|
return Tomahawk::result_ptr();
|
||||||
|
}
|
||||||
|
@@ -47,10 +47,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