diff --git a/src/libtomahawk/audio/audioengine.cpp b/src/libtomahawk/audio/audioengine.cpp index 646390436..7c492642e 100644 --- a/src/libtomahawk/audio/audioengine.cpp +++ b/src/libtomahawk/audio/audioengine.cpp @@ -235,13 +235,22 @@ AudioEngine::canGoPrevious() return true; } +bool +AudioEngine::canSeek() +{ + return !m_playlist.isNull() && (m_playlist.data()->seekRestrictions() != PlaylistInterface::NoSeek) && m_mediaObject->isSeekable(); +} + void AudioEngine::seek( qint64 ms ) { - if ( !m_playlist.isNull() && m_playlist.data()->seekRestrictions() == PlaylistInterface::NoSeek ) + if( !canSeek() ) + { + qDebug() << "Could not seek!"; return; + } - if ( isPlaying() || isPaused() ) + if( isPlaying() || isPaused() ) { tDebug( LOGVERBOSE ) << Q_FUNC_INFO << ms; m_mediaObject->seek( ms ); diff --git a/src/libtomahawk/audio/audioengine.h b/src/libtomahawk/audio/audioengine.h index 04876dd99..038579d9c 100644 --- a/src/libtomahawk/audio/audioengine.h +++ b/src/libtomahawk/audio/audioengine.h @@ -83,6 +83,7 @@ public slots: bool canGoPrevious(); bool canGoNext(); + bool canSeek(); void seek( qint64 ms ); void seek( int ms ); // for compatibility with seekbar in audiocontrols