diff --git a/src/libtomahawk/audio/AudioEngine.cpp b/src/libtomahawk/audio/AudioEngine.cpp index a3e1177fc..b0ad84cf3 100644 --- a/src/libtomahawk/audio/AudioEngine.cpp +++ b/src/libtomahawk/audio/AudioEngine.cpp @@ -167,17 +167,19 @@ AudioEngine::pause() void AudioEngine::stop( AudioErrorCode errorCode ) { - tDebug() << Q_FUNC_INFO << errorCode; + tDebug() << Q_FUNC_INFO << errorCode << isStopped(); if ( isStopped() ) return; - if( errorCode == NoError ) + if ( errorCode == NoError ) setState( Stopped ); else setState( Error ); - m_mediaObject->stop(); + if ( m_mediaObject->state() != Phonon::StoppedState ) + m_mediaObject->stop(); + emit stopped(); if ( !m_playlist.isNull() ) @@ -746,10 +748,6 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState ) // We don't emit this state to listeners - yet. m_state = Loading; } - if ( newState == Phonon::StoppedState ) - { - m_state = Stopped; - } if ( newState == Phonon::ErrorState ) { stop( UnknownError ); @@ -801,11 +799,14 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState ) m_expectStop = false; tDebug( LOGVERBOSE ) << "Finding next track."; if ( canGoNext() ) + { loadNextTrack(); + } else { if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == Tomahawk::PlaylistModes::Retry ) m_waitingOnNewTrack = true; + stop(); } }