From 4a3f1577181782ca75e0f5517943c3bf20b651f5 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser <muesli@gmail.com> Date: Wed, 20 Jul 2011 00:17:15 +0200 Subject: [PATCH] * Fixed GStreamer skipping to the next track on pausing. --- src/libtomahawk/audio/audioengine.cpp | 20 +++++++++++++++++++- src/libtomahawk/database/database.cpp | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/libtomahawk/audio/audioengine.cpp b/src/libtomahawk/audio/audioengine.cpp index b3b3ceaa2..1178e0b9e 100644 --- a/src/libtomahawk/audio/audioengine.cpp +++ b/src/libtomahawk/audio/audioengine.cpp @@ -520,7 +520,25 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState ) if ( oldState == Phonon::PlayingState ) { - if ( newState == Phonon::PausedState || newState == Phonon::StoppedState ) + qint64 duration = m_mediaObject->totalTime() > 0 ? m_mediaObject->totalTime() : m_currentTrack->duration() * 1000; + bool stopped = false; + switch ( newState ) + { + case Phonon::PausedState: + { + stopped = ( duration - 1000 < m_mediaObject->currentTime() ); + break; + } + case Phonon::StoppedState: + { + stopped = true; + break; + } + default: + break; + } + + if ( stopped ) { qDebug() << "Loading next track."; loadNextTrack(); diff --git a/src/libtomahawk/database/database.cpp b/src/libtomahawk/database/database.cpp index c3b00ddbd..8e76ea47b 100644 --- a/src/libtomahawk/database/database.cpp +++ b/src/libtomahawk/database/database.cpp @@ -105,7 +105,7 @@ Database::enqueue( QSharedPointer<DatabaseCommand> lc ) happyThread = worker; } - qDebug() << "Enqueueing command to thread:" << happyThread << busyThreads << lc->commandname(); +// qDebug() << "Enqueueing command to thread:" << happyThread << busyThreads << lc->commandname(); happyThread->enqueue( lc ); } }