1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-02-24 20:03:07 +01:00

* Fixed GStreamer pausing - even more. Sigh for Phonon's states.

This commit is contained in:
Christian Muehlhaeuser 2011-07-21 18:49:04 +02:00
parent 57cdd0d960
commit aa5fb8bc53
2 changed files with 12 additions and 19 deletions

View File

@ -520,10 +520,6 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
if ( newState == Phonon::PlayingState )
setState( Playing );
if ( !m_expectStop )
return;
m_expectStop = false;
if ( oldState == Phonon::PlayingState )
{
qint64 duration = m_mediaObject->totalTime() > 0 ? m_mediaObject->totalTime() : m_currentTrack->duration() * 1000;
@ -533,7 +529,6 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
case Phonon::PausedState:
{
stopped = ( duration - 1000 < m_mediaObject->currentTime() );
if ( !stopped )
setState( Paused );
@ -548,8 +543,9 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
break;
}
if ( stopped )
if ( stopped && m_expectStop )
{
m_expectStop = false;
qDebug() << "Loading next track.";
loadNextTrack();
}

View File

@ -188,13 +188,13 @@ QtScriptResolver::init()
resolverInit();
QVariantMap m = resolverSettings();
m_name = m.value( "name" ).toString();
m_weight = m.value( "weight", 0 ).toUInt();
m_timeout = m.value( "timeout", 25 ).toUInt() * 1000;
m_name = m.value( "name" ).toString();
m_weight = m.value( "weight", 0 ).toUInt();
m_timeout = m.value( "timeout", 25 ).toUInt() * 1000;
// load config widget and apply settings
loadUi();
QVariantMap config = resolverUserConfig();
QVariantMap config = resolverUserConfig();
fillDataInWidgets( config );
qDebug() << Q_FUNC_INFO << m_name << m_weight << m_timeout;
@ -216,21 +216,18 @@ QtScriptResolver::resolve( const Tomahawk::query_ptr& query )
{
if ( QThread::currentThread() != thread() )
{
// qDebug() << "Reinvoking in correct thread:" << Q_FUNC_INFO;
QMetaObject::invokeMethod( this, "resolve", Qt::QueuedConnection, Q_ARG(Tomahawk::query_ptr, query) );
return;
}
qDebug() << Q_FUNC_INFO << "Resolving now with" << m_name << "-" << query->toString();
QString eval;
if ( !query->isFullTextQuery() )
{
eval = QString( RESOLVER_LEGACY_CODE2 "resolver.resolve( '%1', '%2', '%3', '%4' );" )
.arg( query->id().replace( "'", "\\'" ) )
.arg( query->artist().replace( "'", "\\'" ) )
.arg( query->album().replace( "'", "\\'" ) )
.arg( query->track().replace( "'", "\\'" ) );
.arg( query->id().replace( "'", "\\'" ) )
.arg( query->artist().replace( "'", "\\'" ) )
.arg( query->album().replace( "'", "\\'" ) )
.arg( query->track().replace( "'", "\\'" ) );
}
else
{
@ -240,8 +237,8 @@ QtScriptResolver::resolve( const Tomahawk::query_ptr& query )
" resolve( '%1', '', '', '%2' );"
"}"
)
.arg( query->id().replace( "'", "\\'" ) )
.arg( query->fullTextQuery().replace( "'", "\\'" ) );
.arg( query->id().replace( "'", "\\'" ) )
.arg( query->fullTextQuery().replace( "'", "\\'" ) );
}
QList< Tomahawk::result_ptr > results;