mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 01:09:42 +01:00
Add debug and some logic to disconnect sourceplaylistinterface connections
This commit is contained in:
parent
3fa9fa337e
commit
146eaa226f
@ -204,6 +204,7 @@ AudioEngine::next()
|
||||
bool
|
||||
AudioEngine::canGoNext()
|
||||
{
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
|
||||
if ( m_playlist.isNull() )
|
||||
return false;
|
||||
|
||||
@ -211,6 +212,8 @@ AudioEngine::canGoNext()
|
||||
m_playlist.data()->skipRestrictions() == PlaylistInterface::NoSkipForwards )
|
||||
return false;
|
||||
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO << "playlist has next item? " << m_playlist.data()->hasNextItem();
|
||||
|
||||
return m_playlist.data()->hasNextItem();
|
||||
}
|
||||
|
||||
@ -613,10 +616,15 @@ void
|
||||
AudioEngine::setPlaylist( PlaylistInterface* playlist )
|
||||
{
|
||||
if ( !m_playlist.isNull() )
|
||||
{
|
||||
if ( m_playlist.data()->object() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )
|
||||
disconnect( m_playlist.data()->object(), SIGNAL( nextTrackReady() ) );
|
||||
m_playlist.data()->reset();
|
||||
}
|
||||
|
||||
if ( !playlist )
|
||||
return;
|
||||
|
||||
m_playlist = playlist->getSharedPointer();
|
||||
|
||||
if ( m_playlist.data()->object() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )
|
||||
|
@ -47,16 +47,16 @@ SourcePlaylistInterface::siblingItem( int itemsAway )
|
||||
Tomahawk::result_ptr
|
||||
SourcePlaylistInterface::nextItem()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
|
||||
if ( m_source.isNull() || m_source->currentTrack().isNull() || m_source->currentTrack()->results().isEmpty() )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << " Results were empty for current track or source no longer valid";
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO << " Results were empty for current track or source no longer valid";
|
||||
m_currentItem = Tomahawk::result_ptr();
|
||||
return m_currentItem;
|
||||
}
|
||||
else if ( !m_gotNextItem )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << " This song was already fetched";
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO << " This song was already fetched";
|
||||
return Tomahawk::result_ptr();
|
||||
}
|
||||
|
||||
@ -69,6 +69,7 @@ SourcePlaylistInterface::nextItem()
|
||||
bool
|
||||
SourcePlaylistInterface::hasNextItem()
|
||||
{
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
|
||||
if ( m_source.isNull() || m_source->currentTrack().isNull() || m_source->currentTrack()->results().isEmpty() )
|
||||
return false;
|
||||
|
||||
@ -96,7 +97,7 @@ SourcePlaylistInterface::reset()
|
||||
void
|
||||
SourcePlaylistInterface::onSourcePlaybackStarted( const Tomahawk::query_ptr& query )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
|
||||
connect( query.data(), SIGNAL( resolvingFinished( bool ) ), SLOT( resolvingFinished( bool ) ) );
|
||||
Pipeline::instance()->resolve( query, true );
|
||||
m_gotNextItem = true;
|
||||
@ -106,7 +107,7 @@ SourcePlaylistInterface::onSourcePlaybackStarted( const Tomahawk::query_ptr& que
|
||||
void
|
||||
SourcePlaylistInterface::resolvingFinished( bool hasResults )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << " and has results? : " << (hasResults ? "true" : "false");
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO << " and has results? : " << (hasResults ? "true" : "false");
|
||||
if ( hasResults )
|
||||
emit nextTrackReady();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user