mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +02:00
* Implemented new PlaylistInterface in various ProxyModelInterfaces.
This commit is contained in:
@@ -55,14 +55,18 @@ AlbumPlaylistInterface::~AlbumPlaylistInterface()
|
|||||||
void
|
void
|
||||||
AlbumPlaylistInterface::setCurrentIndex( qint64 index )
|
AlbumPlaylistInterface::setCurrentIndex( qint64 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 ) const
|
AlbumPlaylistInterface::siblingIndex( int itemsAway, qint64 rootIndex ) const
|
||||||
{
|
{
|
||||||
|
Q_ASSERT( false );
|
||||||
|
|
||||||
|
/*
|
||||||
qint64 p = m_currentTrack;
|
qint64 p = m_currentTrack;
|
||||||
p += itemsAway;
|
p += itemsAway;
|
||||||
|
|
||||||
@@ -72,7 +76,9 @@ AlbumPlaylistInterface::siblingIndex( int itemsAway ) const
|
|||||||
if ( p >= m_queries.count() )
|
if ( p >= m_queries.count() )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return p;
|
return p;*/
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -86,18 +92,21 @@ AlbumPlaylistInterface::currentItem() const
|
|||||||
bool
|
bool
|
||||||
AlbumPlaylistInterface::setCurrentTrack( unsigned int albumpos )
|
AlbumPlaylistInterface::setCurrentTrack( unsigned int albumpos )
|
||||||
{
|
{
|
||||||
albumpos--;
|
Q_ASSERT( false );
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* albumpos--;
|
||||||
if ( ( int ) albumpos >= m_queries.count() )
|
if ( ( int ) albumpos >= m_queries.count() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_currentTrack = albumpos;
|
m_currentTrack = albumpos;
|
||||||
m_currentItem = m_queries.at( albumpos )->results().first();
|
m_currentItem = m_queries.at( albumpos )->results().first();
|
||||||
return true;
|
return true;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QList< Tomahawk::query_ptr >
|
QList< Tomahawk::query_ptr >
|
||||||
AlbumPlaylistInterface::tracks()
|
AlbumPlaylistInterface::tracks() const
|
||||||
{
|
{
|
||||||
if ( m_queries.isEmpty() && m_album )
|
if ( m_queries.isEmpty() && m_album )
|
||||||
{
|
{
|
||||||
|
@@ -40,12 +40,12 @@ public:
|
|||||||
AlbumPlaylistInterface( Tomahawk::Album* album, Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
|
AlbumPlaylistInterface( Tomahawk::Album* album, Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
|
||||||
virtual ~AlbumPlaylistInterface();
|
virtual ~AlbumPlaylistInterface();
|
||||||
|
|
||||||
QList<Tomahawk::query_ptr> tracks();
|
QList<Tomahawk::query_ptr> tracks() const;
|
||||||
|
|
||||||
virtual int trackCount() const { return m_queries.count(); }
|
virtual int trackCount() const { return m_queries.count(); }
|
||||||
|
|
||||||
virtual void setCurrentIndex( qint64 index );
|
virtual void setCurrentIndex( qint64 index );
|
||||||
virtual qint64 siblingIndex( int itemsAway ) 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 { Q_UNUSED( index ); Q_ASSERT( false ); return Tomahawk::result_ptr(); }
|
||||||
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 { Q_UNUSED( index ); Q_ASSERT( false ); return Tomahawk::query_ptr(); }
|
||||||
|
@@ -54,15 +54,19 @@ ArtistPlaylistInterface::~ArtistPlaylistInterface()
|
|||||||
void
|
void
|
||||||
ArtistPlaylistInterface::setCurrentIndex( qint64 index )
|
ArtistPlaylistInterface::setCurrentIndex( qint64 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 ) const
|
ArtistPlaylistInterface::siblingIndex( int itemsAway, qint64 rootIndex ) const
|
||||||
{
|
{
|
||||||
qint64 p = m_currentTrack;
|
Q_ASSERT( false );
|
||||||
|
|
||||||
|
/* qint64 p = m_currentTrack;
|
||||||
p += itemsAway;
|
p += itemsAway;
|
||||||
|
|
||||||
if ( p < 0 )
|
if ( p < 0 )
|
||||||
@@ -71,7 +75,9 @@ ArtistPlaylistInterface::siblingIndex( int itemsAway ) const
|
|||||||
if ( p >= m_queries.count() )
|
if ( p >= m_queries.count() )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return p;
|
return p;*/
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -83,7 +89,7 @@ ArtistPlaylistInterface::currentItem() const
|
|||||||
|
|
||||||
|
|
||||||
QList<Tomahawk::query_ptr>
|
QList<Tomahawk::query_ptr>
|
||||||
ArtistPlaylistInterface::tracks()
|
ArtistPlaylistInterface::tracks() const
|
||||||
{
|
{
|
||||||
if ( m_queries.isEmpty() && m_artist )
|
if ( m_queries.isEmpty() && m_artist )
|
||||||
{
|
{
|
||||||
|
@@ -39,12 +39,12 @@ public:
|
|||||||
ArtistPlaylistInterface( Tomahawk::Artist* artist, Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
|
ArtistPlaylistInterface( Tomahawk::Artist* artist, Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
|
||||||
virtual ~ArtistPlaylistInterface();
|
virtual ~ArtistPlaylistInterface();
|
||||||
|
|
||||||
virtual QList<Tomahawk::query_ptr> tracks();
|
virtual QList<Tomahawk::query_ptr> tracks() const;
|
||||||
|
|
||||||
virtual int trackCount() const { return m_queries.count(); }
|
virtual int trackCount() const { return m_queries.count(); }
|
||||||
|
|
||||||
virtual void setCurrentIndex( qint64 index );
|
virtual void setCurrentIndex( qint64 index );
|
||||||
virtual qint64 siblingIndex( int itemsAway ) 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 { Q_UNUSED( index ); Q_ASSERT( false ); return Tomahawk::result_ptr(); }
|
||||||
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 { Q_UNUSED( index ); Q_ASSERT( false ); return Tomahawk::query_ptr(); }
|
||||||
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 { Q_UNUSED( result ); Q_ASSERT( false ); return -1; }
|
||||||
|
@@ -48,7 +48,7 @@ PlaylistPlaylistInterface::trackCount() const
|
|||||||
|
|
||||||
|
|
||||||
QList< Tomahawk::query_ptr >
|
QList< Tomahawk::query_ptr >
|
||||||
PlaylistPlaylistInterface::tracks()
|
PlaylistPlaylistInterface::tracks() const
|
||||||
{
|
{
|
||||||
QList<Tomahawk::query_ptr> queries;
|
QList<Tomahawk::query_ptr> queries;
|
||||||
foreach( const plentry_ptr& p, ( m_playlist.isNull() ? QList< Tomahawk::plentry_ptr >() : m_playlist.data()->entries() ) )
|
foreach( const plentry_ptr& p, ( m_playlist.isNull() ? QList< Tomahawk::plentry_ptr >() : m_playlist.data()->entries() ) )
|
||||||
|
@@ -42,7 +42,7 @@ public:
|
|||||||
PlaylistPlaylistInterface( Tomahawk::Playlist* playlist );
|
PlaylistPlaylistInterface( Tomahawk::Playlist* playlist );
|
||||||
virtual ~PlaylistPlaylistInterface();
|
virtual ~PlaylistPlaylistInterface();
|
||||||
|
|
||||||
virtual QList<Tomahawk::query_ptr> tracks();
|
virtual QList<Tomahawk::query_ptr> tracks() const;
|
||||||
|
|
||||||
virtual int trackCount() const;
|
virtual int trackCount() const;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ public:
|
|||||||
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 { Q_UNUSED( query ); Q_ASSERT( false ); return -1; }
|
||||||
|
|
||||||
virtual Tomahawk::result_ptr currentItem() const { return m_currentItem; }
|
virtual Tomahawk::result_ptr currentItem() const { return m_currentItem; }
|
||||||
virtual qint64 siblingIndex( int /*itemsAway*/ ) const { return -1; }
|
virtual qint64 siblingIndex( int /*itemsAway*/, qint64 rootIndex = -1 ) const { Q_UNUSED( rootIndex ); return -1; }
|
||||||
|
|
||||||
virtual PlaylistModes::RepeatMode repeatMode() const { return PlaylistModes::NoRepeat; }
|
virtual PlaylistModes::RepeatMode repeatMode() const { return PlaylistModes::NoRepeat; }
|
||||||
virtual bool shuffled() const { return false; }
|
virtual bool shuffled() const { return false; }
|
||||||
|
@@ -58,9 +58,10 @@ SourcePlaylistInterface::setCurrentIndex( qint64 index )
|
|||||||
|
|
||||||
|
|
||||||
qint64
|
qint64
|
||||||
SourcePlaylistInterface::siblingIndex( int itemsAway ) const
|
SourcePlaylistInterface::siblingIndex( int itemsAway, qint64 rootIndex ) const
|
||||||
{
|
{
|
||||||
Q_UNUSED( itemsAway );
|
Q_UNUSED( itemsAway );
|
||||||
|
Q_UNUSED( rootIndex );
|
||||||
|
|
||||||
if ( nextResult() )
|
if ( nextResult() )
|
||||||
return 0;
|
return 0;
|
||||||
@@ -125,7 +126,7 @@ SourcePlaylistInterface::hasNextResult() const
|
|||||||
|
|
||||||
|
|
||||||
QList<Tomahawk::query_ptr>
|
QList<Tomahawk::query_ptr>
|
||||||
SourcePlaylistInterface::tracks()
|
SourcePlaylistInterface::tracks() const
|
||||||
{
|
{
|
||||||
QList<Tomahawk::query_ptr> tracks;
|
QList<Tomahawk::query_ptr> tracks;
|
||||||
return tracks; // FIXME (with what?)
|
return tracks; // FIXME (with what?)
|
||||||
|
@@ -36,10 +36,10 @@ class DLLEXPORT SourcePlaylistInterface : public Tomahawk::PlaylistInterface
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SourcePlaylistInterface( Tomahawk::Source *source, Tomahawk::PlaylistModes::LatchMode latchMode = PlaylistModes::StayOnSong );
|
SourcePlaylistInterface( Tomahawk::Source* source, Tomahawk::PlaylistModes::LatchMode latchMode = PlaylistModes::StayOnSong );
|
||||||
virtual ~SourcePlaylistInterface();
|
virtual ~SourcePlaylistInterface();
|
||||||
|
|
||||||
QList<Tomahawk::query_ptr> tracks();
|
QList<Tomahawk::query_ptr> tracks() const;
|
||||||
|
|
||||||
virtual int trackCount() const { return 1; }
|
virtual int trackCount() const { return 1; }
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
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 { Q_UNUSED( result ); Q_ASSERT( false ); return -1; }
|
||||||
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 { Q_UNUSED( query ); Q_ASSERT( false ); return -1; }
|
||||||
|
|
||||||
virtual qint64 siblingIndex( int itemsAway ) const;
|
virtual qint64 siblingIndex( int itemsAway, qint64 rootIndex = -1 ) const;
|
||||||
virtual bool sourceValid() const;
|
virtual bool sourceValid() const;
|
||||||
virtual bool hasNextResult() const;
|
virtual bool hasNextResult() const;
|
||||||
virtual Tomahawk::result_ptr nextResult() const;
|
virtual Tomahawk::result_ptr nextResult() const;
|
||||||
|
@@ -55,9 +55,9 @@ public:
|
|||||||
virtual bool shuffled() const { return false; }
|
virtual bool shuffled() const { return false; }
|
||||||
virtual void setShuffled( bool ) {}
|
virtual void setShuffled( bool ) {}
|
||||||
|
|
||||||
virtual qint64 siblingIndex( int ) const { return -1; }
|
virtual qint64 siblingIndex( int, qint64 rootIndex = -1 ) const { Q_UNUSED( rootIndex ); return -1; }
|
||||||
virtual int trackCount() const { return 1; }
|
virtual int trackCount() const { return 1; }
|
||||||
virtual QList< query_ptr > tracks() { return QList< query_ptr >(); }
|
virtual QList< query_ptr > tracks() const { return QList< query_ptr >(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
query_ptr m_track;
|
query_ptr m_track;
|
||||||
|
@@ -69,9 +69,9 @@ public:
|
|||||||
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 { Q_UNUSED( result ); Q_ASSERT( false ); return -1; }
|
||||||
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 { Q_UNUSED( query ); Q_ASSERT( false ); return -1; }
|
||||||
virtual Tomahawk::result_ptr currentItem() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->currentItem(); }
|
virtual Tomahawk::result_ptr currentItem() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->currentItem(); }
|
||||||
virtual qint64 siblingIndex( int itemsAway ) const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->siblingIndex( itemsAway ); }
|
virtual qint64 siblingIndex( int itemsAway, qint64 rootIndex = -1 ) const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->siblingIndex( itemsAway, rootIndex ); }
|
||||||
virtual int trackCount() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->trackCount(); }
|
virtual int trackCount() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->trackCount(); }
|
||||||
virtual QList< Tomahawk::query_ptr > tracks() { return m_w->ui->tracksView->proxyModel()->playlistInterface()->tracks(); }
|
virtual QList< Tomahawk::query_ptr > tracks() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->tracks(); }
|
||||||
|
|
||||||
virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other )
|
virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other )
|
||||||
{
|
{
|
||||||
|
@@ -63,9 +63,9 @@ public:
|
|||||||
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 { Q_UNUSED( result ); Q_ASSERT( false ); return -1; }
|
||||||
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 { Q_UNUSED( query ); Q_ASSERT( false ); return -1; }
|
||||||
virtual Tomahawk::result_ptr currentItem() const { return Tomahawk::result_ptr(); }
|
virtual Tomahawk::result_ptr currentItem() const { return Tomahawk::result_ptr(); }
|
||||||
virtual qint64 siblingIndex( int ) const { return -1; }
|
virtual qint64 siblingIndex( int, qint64 rootIndex = -1 ) const { Q_UNUSED( rootIndex ); return -1; }
|
||||||
virtual int trackCount() const { return 0; }
|
virtual int trackCount() const { return 0; }
|
||||||
virtual QList< Tomahawk::query_ptr > tracks() { return QList< Tomahawk::query_ptr >(); }
|
virtual QList< Tomahawk::query_ptr > tracks() const { return QList< Tomahawk::query_ptr >(); }
|
||||||
|
|
||||||
virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other )
|
virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other )
|
||||||
{
|
{
|
||||||
|
@@ -53,9 +53,9 @@ public:
|
|||||||
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 { Q_UNUSED( result ); Q_ASSERT( false ); return -1; }
|
||||||
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 { Q_UNUSED( query ); Q_ASSERT( false ); return -1; }
|
||||||
virtual Tomahawk::result_ptr currentItem() const { return m_w->ui->tracks->proxyModel()->playlistInterface()->currentItem(); }
|
virtual Tomahawk::result_ptr currentItem() const { return m_w->ui->tracks->proxyModel()->playlistInterface()->currentItem(); }
|
||||||
virtual qint64 siblingIndex( int itemsAway ) const { return m_w->ui->tracks->proxyModel()->playlistInterface()->siblingIndex( itemsAway ); }
|
virtual qint64 siblingIndex( int itemsAway, qint64 rootIndex = -1 ) const { return m_w->ui->tracks->proxyModel()->playlistInterface()->siblingIndex( itemsAway, rootIndex ); }
|
||||||
virtual int trackCount() const { return m_w->ui->tracks->proxyModel()->playlistInterface()->trackCount(); }
|
virtual int trackCount() const { return m_w->ui->tracks->proxyModel()->playlistInterface()->trackCount(); }
|
||||||
virtual QList< Tomahawk::query_ptr > tracks() { return m_w->ui->tracks->proxyModel()->playlistInterface()->tracks(); }
|
virtual QList< Tomahawk::query_ptr > tracks() const { return m_w->ui->tracks->proxyModel()->playlistInterface()->tracks(); }
|
||||||
|
|
||||||
virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other )
|
virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other )
|
||||||
{
|
{
|
||||||
|
@@ -65,9 +65,9 @@ public:
|
|||||||
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 { Q_UNUSED( result ); Q_ASSERT( false ); return -1; }
|
||||||
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 { Q_UNUSED( query ); Q_ASSERT( false ); return -1; }
|
||||||
virtual Tomahawk::result_ptr currentItem() const { return Tomahawk::result_ptr(); }
|
virtual Tomahawk::result_ptr currentItem() const { return Tomahawk::result_ptr(); }
|
||||||
virtual qint64 siblingIndex( int ) const { return -1; }
|
virtual qint64 siblingIndex( int itemsAway, qint64 rootIndex = -1 ) const { Q_UNUSED( itemsAway ); Q_UNUSED( rootIndex ); return -1; }
|
||||||
virtual int trackCount() const { return 0; }
|
virtual int trackCount() const { return 0; }
|
||||||
virtual QList< Tomahawk::query_ptr > tracks() { return QList< Tomahawk::query_ptr >(); }
|
virtual QList< Tomahawk::query_ptr > tracks() const { return QList< Tomahawk::query_ptr >(); }
|
||||||
virtual int unfilteredTrackCount() const { return 0; }
|
virtual int unfilteredTrackCount() const { return 0; }
|
||||||
|
|
||||||
virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other )
|
virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other )
|
||||||
|
Reference in New Issue
Block a user