1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-07 06:36:55 +02:00

Add debug and some logic to disconnect sourceplaylistinterface connections

This commit is contained in:
Jeff Mitchell
2011-08-25 23:49:40 -04:00
parent 3fa9fa337e
commit 146eaa226f
2 changed files with 14 additions and 5 deletions

View File

@@ -204,6 +204,7 @@ AudioEngine::next()
bool bool
AudioEngine::canGoNext() AudioEngine::canGoNext()
{ {
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
if ( m_playlist.isNull() ) if ( m_playlist.isNull() )
return false; return false;
@@ -211,6 +212,8 @@ AudioEngine::canGoNext()
m_playlist.data()->skipRestrictions() == PlaylistInterface::NoSkipForwards ) m_playlist.data()->skipRestrictions() == PlaylistInterface::NoSkipForwards )
return false; return false;
tDebug( LOGEXTRA ) << Q_FUNC_INFO << "playlist has next item? " << m_playlist.data()->hasNextItem();
return m_playlist.data()->hasNextItem(); return m_playlist.data()->hasNextItem();
} }
@@ -613,10 +616,15 @@ void
AudioEngine::setPlaylist( PlaylistInterface* playlist ) AudioEngine::setPlaylist( PlaylistInterface* playlist )
{ {
if ( !m_playlist.isNull() ) 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(); m_playlist.data()->reset();
}
if ( !playlist ) if ( !playlist )
return; return;
m_playlist = playlist->getSharedPointer(); m_playlist = playlist->getSharedPointer();
if ( m_playlist.data()->object() && m_playlist.data()->retryMode() == PlaylistInterface::Retry ) if ( m_playlist.data()->object() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )

View File

@@ -47,16 +47,16 @@ SourcePlaylistInterface::siblingItem( int itemsAway )
Tomahawk::result_ptr Tomahawk::result_ptr
SourcePlaylistInterface::nextItem() SourcePlaylistInterface::nextItem()
{ {
qDebug() << Q_FUNC_INFO; tDebug( LOGEXTRA ) << Q_FUNC_INFO;
if ( m_source.isNull() || m_source->currentTrack().isNull() || m_source->currentTrack()->results().isEmpty() ) 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(); m_currentItem = Tomahawk::result_ptr();
return m_currentItem; return m_currentItem;
} }
else if ( !m_gotNextItem ) 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(); return Tomahawk::result_ptr();
} }
@@ -69,6 +69,7 @@ SourcePlaylistInterface::nextItem()
bool bool
SourcePlaylistInterface::hasNextItem() SourcePlaylistInterface::hasNextItem()
{ {
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
if ( m_source.isNull() || m_source->currentTrack().isNull() || m_source->currentTrack()->results().isEmpty() ) if ( m_source.isNull() || m_source->currentTrack().isNull() || m_source->currentTrack()->results().isEmpty() )
return false; return false;
@@ -96,7 +97,7 @@ SourcePlaylistInterface::reset()
void void
SourcePlaylistInterface::onSourcePlaybackStarted( const Tomahawk::query_ptr& query ) 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 ) ) ); connect( query.data(), SIGNAL( resolvingFinished( bool ) ), SLOT( resolvingFinished( bool ) ) );
Pipeline::instance()->resolve( query, true ); Pipeline::instance()->resolve( query, true );
m_gotNextItem = true; m_gotNextItem = true;
@@ -106,7 +107,7 @@ SourcePlaylistInterface::onSourcePlaybackStarted( const Tomahawk::query_ptr& que
void void
SourcePlaylistInterface::resolvingFinished( bool hasResults ) 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 ) if ( hasResults )
emit nextTrackReady(); emit nextTrackReady();
} }