mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-19 12:21:52 +02:00
* Make use of new Playlist::get() API.
This commit is contained in:
@@ -50,18 +50,14 @@ DatabaseCommand_DeleteDynamicPlaylist::exec( DatabaseImpl* lib )
|
||||
void
|
||||
DatabaseCommand_DeleteDynamicPlaylist::postCommitHook()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "Reporting:" << m_playlistguid;
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Reporting:" << m_playlistguid;
|
||||
if ( !source() || !source()->dbCollection() )
|
||||
{
|
||||
Q_ASSERT( false );
|
||||
return;
|
||||
}
|
||||
|
||||
// we arent sure which it is, but it can't be more than one. so try both
|
||||
dynplaylist_ptr playlist = source()->dbCollection()->autoPlaylist( m_playlistguid );
|
||||
if ( !playlist )
|
||||
playlist = source()->dbCollection()->station( m_playlistguid );
|
||||
|
||||
dynplaylist_ptr playlist = DynamicPlaylist::get( m_playlistguid );
|
||||
if ( playlist )
|
||||
{
|
||||
playlist->reportDeleted( playlist );
|
||||
|
@@ -58,18 +58,14 @@ DatabaseCommand_RenamePlaylist::exec( DatabaseImpl* lib )
|
||||
void
|
||||
DatabaseCommand_RenamePlaylist::postCommitHook()
|
||||
{
|
||||
playlist_ptr playlist = source()->dbCollection()->playlist( m_playlistguid );
|
||||
// fallback, check for auto and stations too
|
||||
if( playlist.isNull() )
|
||||
playlist = source()->dbCollection()->autoPlaylist( m_playlistguid );
|
||||
if( playlist.isNull() )
|
||||
playlist = source()->dbCollection()->station( m_playlistguid );
|
||||
|
||||
playlist_ptr playlist = Playlist::get( m_playlistguid );
|
||||
Q_ASSERT( !playlist.isNull() );
|
||||
if ( !playlist )
|
||||
return;
|
||||
|
||||
qDebug() << "Renaming old playlist" << playlist->title() << "to" << m_playlistTitle << m_playlistguid;
|
||||
tDebug() << "Renaming playlist" << playlist->title() << "to" << m_playlistTitle << m_playlistguid;
|
||||
playlist->setTitle( m_playlistTitle );
|
||||
|
||||
if( source()->isLocal() )
|
||||
if ( source()->isLocal() )
|
||||
Servent::instance()->triggerDBSync();
|
||||
}
|
||||
|
@@ -95,16 +95,7 @@ RecentPlaylistsModel::playlistsLoaded( const QList<DatabaseCommand_LoadAllSorted
|
||||
DatabaseCommand_LoadAllSortedPlaylists::SourcePlaylistPair plPair;
|
||||
foreach ( plPair, playlistGuids )
|
||||
{
|
||||
source_ptr source = SourceList::instance()->get( plPair.first );
|
||||
if ( !source )
|
||||
continue;
|
||||
|
||||
playlist_ptr pl = source->dbCollection()->playlist( plPair.second );
|
||||
if ( !pl )
|
||||
pl = source->dbCollection()->autoPlaylist( plPair.second );
|
||||
if ( !pl )
|
||||
pl = source->dbCollection()->station( plPair.second );
|
||||
|
||||
const playlist_ptr& pl = Playlist::get( plPair.second );
|
||||
if ( !pl )
|
||||
{
|
||||
tDebug() << "ERROR: Found a playlist that is not associated with any source:" << plPair.first << plPair.second;
|
||||
|
@@ -227,18 +227,10 @@ RecentlyPlayedPlaylistsModel::rowCount( const QModelIndex& ) const
|
||||
|
||||
|
||||
void
|
||||
RecentlyPlayedPlaylistsModel::plAdded( const QString& plguid, int sId )
|
||||
RecentlyPlayedPlaylistsModel::plAdded( const QString& plguid, int sourceId )
|
||||
{
|
||||
source_ptr source = SourceList::instance()->get( sId );
|
||||
if ( !source )
|
||||
return;
|
||||
|
||||
playlist_ptr pl = source->dbCollection()->playlist( plguid );
|
||||
if ( !pl )
|
||||
pl = source->dbCollection()->autoPlaylist( plguid );
|
||||
if ( !pl )
|
||||
pl = source->dbCollection()->station( plguid );
|
||||
|
||||
Q_UNUSED( sourceId );
|
||||
const playlist_ptr& pl = Playlist::get( plguid );
|
||||
if ( !pl )
|
||||
return;
|
||||
|
||||
|
@@ -54,7 +54,7 @@ private slots:
|
||||
void onPlaylistsRemoved( QList<Tomahawk::playlist_ptr> );
|
||||
void loadFromSettings();
|
||||
|
||||
void plAdded( const QString& plid, int sid );
|
||||
void plAdded( const QString& plguid, int sourceId );
|
||||
void playlistRevisionLoaded();
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user