From 31f95e24cf508f21f302baf7bba503e0b97b5d78 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 26 Apr 2013 14:00:05 +0200 Subject: [PATCH] * Use new Playlist::get(). --- .../widgets/RecentPlaylistsModel.cpp | 21 +++++++++--------- .../widgets/RecentlyPlayedPlaylistsModel.cpp | 22 +++++++++---------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/libtomahawk/widgets/RecentPlaylistsModel.cpp b/src/libtomahawk/widgets/RecentPlaylistsModel.cpp index 563f58e45..d8d6120fc 100644 --- a/src/libtomahawk/widgets/RecentPlaylistsModel.cpp +++ b/src/libtomahawk/widgets/RecentPlaylistsModel.cpp @@ -95,22 +95,23 @@ RecentPlaylistsModel::playlistsLoaded( const QListget( plPair.first ); - if ( s.isNull() ) + source_ptr source = SourceList::instance()->get( plPair.first ); + if ( !source ) continue; - playlist_ptr pl = s->dbCollection()->playlist( plPair.second ); - if ( pl.isNull() ) - pl = s->dbCollection()->autoPlaylist( plPair.second ); - if ( pl.isNull() ) - pl = s->dbCollection()->station( plPair.second ); + playlist_ptr pl = source->dbCollection()->playlist( plPair.second ); + if ( !pl ) + pl = source->dbCollection()->autoPlaylist( plPair.second ); + if ( !pl ) + pl = source->dbCollection()->station( plPair.second ); - if ( pl.isNull() ) + if ( !pl ) { - qDebug() << "Found a playlist that is NOT LOADED FOR ANY SOURCE:" << plPair.first << plPair.second; + tDebug() << "ERROR: Found a playlist that is not associated with any source:" << plPair.first << plPair.second; continue; } - connect( pl.data(), SIGNAL( changed() ), this, SLOT( updatePlaylist() ) ); + + connect( pl.data(), SIGNAL( changed() ), SLOT( updatePlaylist() ) ); m_playlists << pl; if ( !pl->loaded() ) diff --git a/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.cpp b/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.cpp index 48d9ec2f3..c6b442219 100644 --- a/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.cpp +++ b/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.cpp @@ -63,12 +63,12 @@ RecentlyPlayedPlaylistsModel::loadFromSettings() // qDebug() << "loading playlist" << playlist_guids[i]; playlist_ptr pl = m_cached.value( playlist_guids[i], Tomahawk::playlist_ptr() ); - if ( pl.isNull() ) - pl = Tomahawk::Playlist::load( playlist_guids[i] ); - if ( pl.isNull() ) - pl = Tomahawk::DynamicPlaylist::load( playlist_guids[i] ); + if ( !pl ) + pl = Tomahawk::Playlist::get( playlist_guids[i] ); + if ( !pl ) + pl = Tomahawk::DynamicPlaylist::get( playlist_guids[i] ); - if ( !pl.isNull() ) + if ( pl ) { m_recplaylists << pl; @@ -230,16 +230,16 @@ void RecentlyPlayedPlaylistsModel::plAdded( const QString& plguid, int sId ) { source_ptr source = SourceList::instance()->get( sId ); - if ( source.isNull() ) + if ( !source ) return; playlist_ptr pl = source->dbCollection()->playlist( plguid ); - if ( pl.isNull() ) + if ( !pl ) pl = source->dbCollection()->autoPlaylist( plguid ); - if ( pl.isNull() ) + if ( !pl ) pl = source->dbCollection()->station( plguid ); - if ( pl.isNull() ) + if ( !pl ) return; onPlaylistsRemoved( QList< playlist_ptr >() << pl ); @@ -256,7 +256,7 @@ void RecentlyPlayedPlaylistsModel::playlistChanged( Tomahawk::playlistinterface_ptr pli ) { // ARG - if ( pli.isNull() ) + if ( !pli ) return; if ( Playlist *pl = dynamic_cast< Playlist* >( pli.data() ) ) @@ -269,7 +269,7 @@ RecentlyPlayedPlaylistsModel::playlistChanged( Tomahawk::playlistinterface_ptr p ptr = test; } - if ( !ptr.isNull() && m_artists.contains( ptr ) ) + if ( ptr && m_artists.contains( ptr ) ) { m_artists[ ptr ] = QString(); }