From fa4463dc88a182cdca6a739b20e8ef5e89918454 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Wed, 27 Jun 2012 02:18:41 +0200 Subject: [PATCH] * No need to check all results for playability. Their sorted by that, so we just check the first one. --- src/libtomahawk/audio/AudioEngine.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/libtomahawk/audio/AudioEngine.cpp b/src/libtomahawk/audio/AudioEngine.cpp index 5d01d65c7..3b7d940ea 100644 --- a/src/libtomahawk/audio/AudioEngine.cpp +++ b/src/libtomahawk/audio/AudioEngine.cpp @@ -604,13 +604,10 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk: { if ( query->resolvingFinished() ) { - foreach ( const result_ptr& result, query->results() ) + if ( query->numResults() && query->results().first()->isOnline() ) { - if ( result->isOnline() ) - { - playItem( playlist, result ); - return; - } + playItem( playlist, query->results().first() ); + return; } JobStatusView::instance()->model()->addJob( @@ -764,7 +761,7 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState ) } } } - + if ( newState == Phonon::PausedState || newState == Phonon::PlayingState || newState == Phonon::ErrorState ) { tDebug() << "Phonon state now:" << newState; @@ -890,10 +887,10 @@ AudioEngine::checkStateQueue() m_mediaObject->play(); if ( paused ) setVolume( m_volume ); - + break; } - + case Paused: { m_volume = volume();