1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 01:09:42 +01:00

* Let AudioEngine wait for a query to finish resolving and start playback asap.

This commit is contained in:
Christian Muehlhaeuser 2012-05-19 07:23:33 +02:00
parent 5f1564fd3d
commit 69f41c41e8
2 changed files with 14 additions and 12 deletions

View File

@ -105,6 +105,8 @@ private:
QString m_filter;
};
};
}
Q_DECLARE_METATYPE( Tomahawk::playlistinterface_ptr )
#endif // PLAYLISTINTERFACE_H

View File

@ -579,8 +579,16 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk:
void
AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query )
{
if ( !query.isNull() && query->numResults() )
playItem( playlist, query->results().first() );
if ( query->resolvingFinished() )
{
if ( query->numResults() )
playItem( playlist, query->results().first() );
}
else
{
_detail::Closure* closure = NewClosure( query.data(), SIGNAL( resolvingFinished( bool ) ),
const_cast<AudioEngine*>(this), SLOT( playItem( Tomahawk::playlistinterface_ptr, Tomahawk::query_ptr ) ), playlist, query );
}
}
@ -605,15 +613,7 @@ 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 );
}
playItem( pli, pli->tracks().first() );
}
else
{