1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 16:29:43 +01:00

Update playlists when revision info comes in

This commit is contained in:
Leo Franchi 2011-08-11 21:11:59 -04:00
parent 78d867b16f
commit 595d0cf987
2 changed files with 23 additions and 0 deletions

View File

@ -70,7 +70,13 @@ WelcomePlaylistModel::loadFromSettings()
m_recplaylists << pl;
if( !m_cached.contains( playlist_guids[i] ) )
{
if ( pl.dynamicCast< DynamicPlaylist >().isNull() )
connect( pl.data(), SIGNAL(revisionLoaded(Tomahawk::PlaylistRevision)), this, SLOT(playlistRevisionLoaded()) );
else
connect( pl.data(), SIGNAL(dynamicRevisionLoaded(Tomahawk::DynamicPlaylistRevision)), this, SLOT(playlistRevisionLoaded()) );
m_cached[playlist_guids[i]] = pl;
}
} else
m_waitingForSome = true;
}
@ -141,6 +147,22 @@ WelcomePlaylistModel::data( const QModelIndex& index, int role ) const
}
}
void
WelcomePlaylistModel::playlistRevisionLoaded()
{
Playlist* p = qobject_cast< Playlist* >( sender() );
Q_ASSERT( p );
for ( int i = 0; i < m_recplaylists.size(); i++ )
{
if ( m_recplaylists[ i ]->guid() == p->guid() )
{
QModelIndex idx = index( i, 0, QModelIndex() );
emit dataChanged( idx, idx );
}
}
}
void
WelcomePlaylistModel::onSourceAdded( const Tomahawk::source_ptr& source )

View File

@ -51,6 +51,7 @@ private slots:
void loadFromSettings();
void plAdded( const Tomahawk::playlist_ptr& );
void playlistRevisionLoaded();
private:
QList< Tomahawk::playlist_ptr > m_recplaylists;