1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 03:10:12 +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
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();
}
}