1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 05:37:29 +02:00

* Fixed AudioEngine not correctly emitting stopped().

This commit is contained in:
Christian Muehlhaeuser
2013-01-08 21:42:36 +01:00
parent d2c83bf614
commit 0a97127ea8

View File

@@ -167,17 +167,19 @@ AudioEngine::pause()
void void
AudioEngine::stop( AudioErrorCode errorCode ) AudioEngine::stop( AudioErrorCode errorCode )
{ {
tDebug() << Q_FUNC_INFO << errorCode; tDebug() << Q_FUNC_INFO << errorCode << isStopped();
if ( isStopped() ) if ( isStopped() )
return; return;
if( errorCode == NoError ) if ( errorCode == NoError )
setState( Stopped ); setState( Stopped );
else else
setState( Error ); setState( Error );
if ( m_mediaObject->state() != Phonon::StoppedState )
m_mediaObject->stop(); m_mediaObject->stop();
emit stopped(); emit stopped();
if ( !m_playlist.isNull() ) 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. // We don't emit this state to listeners - yet.
m_state = Loading; m_state = Loading;
} }
if ( newState == Phonon::StoppedState )
{
m_state = Stopped;
}
if ( newState == Phonon::ErrorState ) if ( newState == Phonon::ErrorState )
{ {
stop( UnknownError ); stop( UnknownError );
@@ -801,11 +799,14 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
m_expectStop = false; m_expectStop = false;
tDebug( LOGVERBOSE ) << "Finding next track."; tDebug( LOGVERBOSE ) << "Finding next track.";
if ( canGoNext() ) if ( canGoNext() )
{
loadNextTrack(); loadNextTrack();
}
else else
{ {
if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == Tomahawk::PlaylistModes::Retry ) if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == Tomahawk::PlaylistModes::Retry )
m_waitingOnNewTrack = true; m_waitingOnNewTrack = true;
stop(); stop();
} }
} }