mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 01:09:42 +01:00
* Implemented new PlaylistInterface in various ProxyModelInterfaces.
This commit is contained in:
parent
adb185f0cb
commit
473503d786
@ -55,14 +55,18 @@ AlbumPlaylistInterface::~AlbumPlaylistInterface()
|
||||
void
|
||||
AlbumPlaylistInterface::setCurrentIndex( qint64 index )
|
||||
{
|
||||
m_currentTrack = index;
|
||||
m_currentItem = m_queries.at( index )->results().first();
|
||||
Q_ASSERT( false );
|
||||
/* m_currentTrack = index;
|
||||
m_currentItem = m_queries.at( index )->results().first();*/
|
||||
}
|
||||
|
||||
|
||||
qint64
|
||||
AlbumPlaylistInterface::siblingIndex( int itemsAway ) const
|
||||
AlbumPlaylistInterface::siblingIndex( int itemsAway, qint64 rootIndex ) const
|
||||
{
|
||||
Q_ASSERT( false );
|
||||
|
||||
/*
|
||||
qint64 p = m_currentTrack;
|
||||
p += itemsAway;
|
||||
|
||||
@ -72,7 +76,9 @@ AlbumPlaylistInterface::siblingIndex( int itemsAway ) const
|
||||
if ( p >= m_queries.count() )
|
||||
return -1;
|
||||
|
||||
return p;
|
||||
return p;*/
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -86,18 +92,21 @@ AlbumPlaylistInterface::currentItem() const
|
||||
bool
|
||||
AlbumPlaylistInterface::setCurrentTrack( unsigned int albumpos )
|
||||
{
|
||||
albumpos--;
|
||||
Q_ASSERT( false );
|
||||
return false;
|
||||
|
||||
/* albumpos--;
|
||||
if ( ( int ) albumpos >= m_queries.count() )
|
||||
return false;
|
||||
|
||||
m_currentTrack = albumpos;
|
||||
m_currentItem = m_queries.at( albumpos )->results().first();
|
||||
return true;
|
||||
return true;*/
|
||||
}
|
||||
|
||||
|
||||
QList< Tomahawk::query_ptr >
|
||||
AlbumPlaylistInterface::tracks()
|
||||
AlbumPlaylistInterface::tracks() const
|
||||
{
|
||||
if ( m_queries.isEmpty() && m_album )
|
||||
{
|
||||
|
@ -40,12 +40,12 @@ public:
|
||||
AlbumPlaylistInterface( Tomahawk::Album* album, Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
|
||||
virtual ~AlbumPlaylistInterface();
|
||||
|
||||
QList<Tomahawk::query_ptr> tracks();
|
||||
QList<Tomahawk::query_ptr> tracks() const;
|
||||
|
||||
virtual int trackCount() const { return m_queries.count(); }
|
||||
|
||||
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::query_ptr queryAt( qint64 index ) const { Q_UNUSED( index ); Q_ASSERT( false ); return Tomahawk::query_ptr(); }
|
||||
|
@ -54,15 +54,19 @@ ArtistPlaylistInterface::~ArtistPlaylistInterface()
|
||||
void
|
||||
ArtistPlaylistInterface::setCurrentIndex( qint64 index )
|
||||
{
|
||||
m_currentTrack = index;
|
||||
m_currentItem = m_queries.at( index )->results().first();
|
||||
Q_ASSERT( false );
|
||||
|
||||
/* m_currentTrack = index;
|
||||
m_currentItem = m_queries.at( index )->results().first();*/
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
if ( p < 0 )
|
||||
@ -71,7 +75,9 @@ ArtistPlaylistInterface::siblingIndex( int itemsAway ) const
|
||||
if ( p >= m_queries.count() )
|
||||
return -1;
|
||||
|
||||
return p;
|
||||
return p;*/
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +89,7 @@ ArtistPlaylistInterface::currentItem() const
|
||||
|
||||
|
||||
QList<Tomahawk::query_ptr>
|
||||
ArtistPlaylistInterface::tracks()
|
||||
ArtistPlaylistInterface::tracks() const
|
||||
{
|
||||
if ( m_queries.isEmpty() && m_artist )
|
||||
{
|
||||
|
@ -39,12 +39,12 @@ public:
|
||||
ArtistPlaylistInterface( Tomahawk::Artist* artist, Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
|
||||
virtual ~ArtistPlaylistInterface();
|
||||
|
||||
virtual QList<Tomahawk::query_ptr> tracks();
|
||||
virtual QList<Tomahawk::query_ptr> tracks() const;
|
||||
|
||||
virtual int trackCount() const { return m_queries.count(); }
|
||||
|
||||
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::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; }
|
||||
|
@ -48,7 +48,7 @@ PlaylistPlaylistInterface::trackCount() const
|
||||
|
||||
|
||||
QList< Tomahawk::query_ptr >
|
||||
PlaylistPlaylistInterface::tracks()
|
||||
PlaylistPlaylistInterface::tracks() const
|
||||
{
|
||||
QList<Tomahawk::query_ptr> queries;
|
||||
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 );
|
||||
virtual ~PlaylistPlaylistInterface();
|
||||
|
||||
virtual QList<Tomahawk::query_ptr> tracks();
|
||||
virtual QList<Tomahawk::query_ptr> tracks() 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 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 bool shuffled() const { return false; }
|
||||
|
@ -58,9 +58,10 @@ SourcePlaylistInterface::setCurrentIndex( qint64 index )
|
||||
|
||||
|
||||
qint64
|
||||
SourcePlaylistInterface::siblingIndex( int itemsAway ) const
|
||||
SourcePlaylistInterface::siblingIndex( int itemsAway, qint64 rootIndex ) const
|
||||
{
|
||||
Q_UNUSED( itemsAway );
|
||||
Q_UNUSED( rootIndex );
|
||||
|
||||
if ( nextResult() )
|
||||
return 0;
|
||||
@ -125,7 +126,7 @@ SourcePlaylistInterface::hasNextResult() const
|
||||
|
||||
|
||||
QList<Tomahawk::query_ptr>
|
||||
SourcePlaylistInterface::tracks()
|
||||
SourcePlaylistInterface::tracks() const
|
||||
{
|
||||
QList<Tomahawk::query_ptr> tracks;
|
||||
return tracks; // FIXME (with what?)
|
||||
|
@ -36,10 +36,10 @@ class DLLEXPORT SourcePlaylistInterface : public Tomahawk::PlaylistInterface
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SourcePlaylistInterface( Tomahawk::Source *source, Tomahawk::PlaylistModes::LatchMode latchMode = PlaylistModes::StayOnSong );
|
||||
SourcePlaylistInterface( Tomahawk::Source* source, Tomahawk::PlaylistModes::LatchMode latchMode = PlaylistModes::StayOnSong );
|
||||
virtual ~SourcePlaylistInterface();
|
||||
|
||||
QList<Tomahawk::query_ptr> tracks();
|
||||
QList<Tomahawk::query_ptr> tracks() const;
|
||||
|
||||
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 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 hasNextResult() const;
|
||||
virtual Tomahawk::result_ptr nextResult() const;
|
||||
|
@ -55,9 +55,9 @@ public:
|
||||
virtual bool shuffled() const { return false; }
|
||||
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 QList< query_ptr > tracks() { return QList< query_ptr >(); }
|
||||
virtual QList< query_ptr > tracks() const { return QList< query_ptr >(); }
|
||||
|
||||
private:
|
||||
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 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 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 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 )
|
||||
{
|
||||
|
@ -63,9 +63,9 @@ public:
|
||||
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 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 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 )
|
||||
{
|
||||
|
@ -53,9 +53,9 @@ public:
|
||||
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 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 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 )
|
||||
{
|
||||
|
@ -65,9 +65,9 @@ public:
|
||||
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 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 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 bool hasChildInterface( Tomahawk::playlistinterface_ptr other )
|
||||
|
Loading…
x
Reference in New Issue
Block a user