mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
* Convenience method to add an entire album-collection to a PlayableModel.
This commit is contained in:
@@ -1005,6 +1005,14 @@ PlayableModel::appendAlbums( const QList< Tomahawk::album_ptr >& albums )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PlayableModel::appendAlbums( const Tomahawk::collection_ptr& collection )
|
||||||
|
{
|
||||||
|
emit loadingStarted();
|
||||||
|
insertAlbums( collection, rowCount( QModelIndex() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PlayableModel::appendQueries( const QList< Tomahawk::query_ptr >& queries )
|
PlayableModel::appendQueries( const QList< Tomahawk::query_ptr >& queries )
|
||||||
{
|
{
|
||||||
@@ -1080,6 +1088,16 @@ PlayableModel::insertAlbums( const QList< Tomahawk::album_ptr >& albums, int row
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PlayableModel::insertAlbums( const Tomahawk::collection_ptr& collection, int row )
|
||||||
|
{
|
||||||
|
Tomahawk::AlbumsRequest* req = collection->requestAlbums( Tomahawk::artist_ptr() );
|
||||||
|
connect( dynamic_cast< QObject* >( req ), SIGNAL( albums( QList< Tomahawk::album_ptr > ) ),
|
||||||
|
this, SLOT( appendAlbums( QList< Tomahawk::album_ptr > ) ), Qt::UniqueConnection );
|
||||||
|
req->enqueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PlayableModel::insertQueries( const QList< Tomahawk::query_ptr >& queries, int row, const QList< Tomahawk::PlaybackLog >& logs, const QModelIndex& parent )
|
PlayableModel::insertQueries( const QList< Tomahawk::query_ptr >& queries, int row, const QList< Tomahawk::PlaybackLog >& logs, const QModelIndex& parent )
|
||||||
{
|
{
|
||||||
@@ -1092,20 +1110,13 @@ PlayableModel::insertTracks( const Tomahawk::collection_ptr& collection, int row
|
|||||||
{
|
{
|
||||||
Tomahawk::TracksRequest* req = collection->requestTracks( Tomahawk::album_ptr() );
|
Tomahawk::TracksRequest* req = collection->requestTracks( Tomahawk::album_ptr() );
|
||||||
connect( dynamic_cast< QObject* >( req ), SIGNAL( tracks( QList< Tomahawk::query_ptr > ) ),
|
connect( dynamic_cast< QObject* >( req ), SIGNAL( tracks( QList< Tomahawk::query_ptr > ) ),
|
||||||
this, SLOT( onTracksAdded( QList< Tomahawk::query_ptr > ) ), Qt::UniqueConnection );
|
this, SLOT( appendQueries( QList< Tomahawk::query_ptr > ) ), Qt::UniqueConnection );
|
||||||
req->enqueue();
|
req->enqueue();
|
||||||
|
|
||||||
// connect( collection.data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
|
// connect( collection.data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
PlayableModel::onTracksAdded( const QList< Tomahawk::query_ptr >& queries )
|
|
||||||
{
|
|
||||||
appendQueries( queries );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PlayableModel::setTitle( const QString& title )
|
PlayableModel::setTitle( const QString& title )
|
||||||
{
|
{
|
||||||
|
@@ -159,6 +159,7 @@ public slots:
|
|||||||
virtual void appendQueries( const QList< Tomahawk::query_ptr >& queries );
|
virtual void appendQueries( const QList< Tomahawk::query_ptr >& queries );
|
||||||
virtual void appendArtists( const QList< Tomahawk::artist_ptr >& artists );
|
virtual void appendArtists( const QList< Tomahawk::artist_ptr >& artists );
|
||||||
virtual void appendAlbums( const QList< Tomahawk::album_ptr >& albums );
|
virtual void appendAlbums( const QList< Tomahawk::album_ptr >& albums );
|
||||||
|
virtual void appendAlbums( const Tomahawk::collection_ptr& collection );
|
||||||
virtual void appendQuery( const Tomahawk::query_ptr& query );
|
virtual void appendQuery( const Tomahawk::query_ptr& query );
|
||||||
virtual void appendArtist( const Tomahawk::artist_ptr& artist );
|
virtual void appendArtist( const Tomahawk::artist_ptr& artist );
|
||||||
virtual void appendAlbum( const Tomahawk::album_ptr& album );
|
virtual void appendAlbum( const Tomahawk::album_ptr& album );
|
||||||
@@ -167,6 +168,7 @@ public slots:
|
|||||||
virtual void insertQueries( const QList< Tomahawk::query_ptr >& queries, int row = 0, const QList< Tomahawk::PlaybackLog >& logs = QList< Tomahawk::PlaybackLog >(), const QModelIndex& parent = QModelIndex() );
|
virtual void insertQueries( const QList< Tomahawk::query_ptr >& queries, int row = 0, const QList< Tomahawk::PlaybackLog >& logs = QList< Tomahawk::PlaybackLog >(), const QModelIndex& parent = QModelIndex() );
|
||||||
virtual void insertArtists( const QList< Tomahawk::artist_ptr >& artists, int row = 0 );
|
virtual void insertArtists( const QList< Tomahawk::artist_ptr >& artists, int row = 0 );
|
||||||
virtual void insertAlbums( const QList< Tomahawk::album_ptr >& albums, int row = 0 );
|
virtual void insertAlbums( const QList< Tomahawk::album_ptr >& albums, int row = 0 );
|
||||||
|
virtual void insertAlbums( const Tomahawk::collection_ptr& collection, int row = 0 );
|
||||||
virtual void insertQuery( const Tomahawk::query_ptr& query, int row = 0, const Tomahawk::PlaybackLog& log = Tomahawk::PlaybackLog(), const QModelIndex& parent = QModelIndex() );
|
virtual void insertQuery( const Tomahawk::query_ptr& query, int row = 0, const Tomahawk::PlaybackLog& log = Tomahawk::PlaybackLog(), const QModelIndex& parent = QModelIndex() );
|
||||||
virtual void insertArtist( const Tomahawk::artist_ptr& artist, int row = 0 );
|
virtual void insertArtist( const Tomahawk::artist_ptr& artist, int row = 0 );
|
||||||
virtual void insertAlbum( const Tomahawk::album_ptr& album, int row = 0 );
|
virtual void insertAlbum( const Tomahawk::album_ptr& album, int row = 0 );
|
||||||
@@ -197,8 +199,6 @@ private slots:
|
|||||||
void onPlaybackStarted( const Tomahawk::result_ptr result );
|
void onPlaybackStarted( const Tomahawk::result_ptr result );
|
||||||
void onPlaybackStopped();
|
void onPlaybackStopped();
|
||||||
|
|
||||||
void onTracksAdded( const QList< Tomahawk::query_ptr >& queries );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
Reference in New Issue
Block a user