mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 01:09:42 +01:00
* AudioEngine methods for directly playing artists / albums / queries.
This commit is contained in:
parent
9291ee80c9
commit
8d6d584bb4
@ -576,6 +576,54 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk:
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query )
|
||||
{
|
||||
tDebug() << query->toString();
|
||||
if ( !query.isNull() && query->numResults() )
|
||||
playItem( playlist, query->results().first() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::playItem( const Tomahawk::artist_ptr& artist )
|
||||
{
|
||||
if ( artist->playlistInterface()->trackCount() )
|
||||
{
|
||||
playItem( artist->playlistInterface(), artist->playlistInterface()->tracks().first() );
|
||||
}
|
||||
else
|
||||
{
|
||||
_detail::Closure* closure = NewClosure( artist.data(), SIGNAL( tracksAdded( QList<Tomahawk::query_ptr> ) ), const_cast<AudioEngine*>(this), SLOT( playItem( Tomahawk::artist_ptr ) ), artist );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::playItem( const Tomahawk::album_ptr& album )
|
||||
{
|
||||
playlistinterface_ptr pli = album->playlistInterface( Mixed );
|
||||
if ( pli->trackCount() )
|
||||
{
|
||||
if ( pli->tracks().first()->resolvingFinished() )
|
||||
{
|
||||
playItem( pli, pli->tracks().first() );
|
||||
}
|
||||
else
|
||||
{
|
||||
_detail::Closure* closure = NewClosure( pli->tracks().first().data(), SIGNAL( resolvingFinished( bool ) ),
|
||||
const_cast<AudioEngine*>(this), SLOT( playItem( Tomahawk::album_ptr ) ), album );
|
||||
}
|
||||
}
|
||||
else if ( !pli->tracksLoaded() )
|
||||
{
|
||||
_detail::Closure* closure = NewClosure( album.data(), SIGNAL( tracksAdded( QList<Tomahawk::query_ptr>, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ),
|
||||
const_cast<AudioEngine*>(this), SLOT( playItem( Tomahawk::album_ptr ) ), album );
|
||||
pli->tracks();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::onPlaylistNextTrackReady()
|
||||
{
|
||||
|
@ -93,6 +93,9 @@ public slots:
|
||||
void mute();
|
||||
|
||||
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result );
|
||||
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query );
|
||||
void playItem( const Tomahawk::artist_ptr& artist );
|
||||
void playItem( const Tomahawk::album_ptr& album );
|
||||
void setPlaylist( Tomahawk::playlistinterface_ptr playlist );
|
||||
void setQueue( Tomahawk::playlistinterface_ptr queue ) { m_queue = queue; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user