1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-13 12:31:52 +02:00

* Don't try to add an empty track-list to the playlist.

This commit is contained in:
Christian Muehlhaeuser 2010-12-01 01:20:26 +01:00
parent 9c379647aa
commit 245ed98b88

View File

@ -66,23 +66,26 @@ PlaylistModel::loadPlaylist( const Tomahawk::playlist_ptr& playlist )
PlItem* plitem;
QList<plentry_ptr> entries = playlist->entries();
int c = rowCount( QModelIndex() );
qDebug() << "starting loading" << playlist->title();
emit loadingStarts();
emit beginInsertRows( QModelIndex(), c, c + entries.count() - 1 );
foreach( const plentry_ptr& entry, entries )
if ( entries.count() )
{
qDebug() << entry->query()->toString();
plitem = new PlItem( entry, m_rootItem );
plitem->index = createIndex( m_rootItem->children.count() - 1, 0, plitem );
int c = rowCount( QModelIndex() );
connect( plitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
qDebug() << "starting loading" << playlist->title();
emit loadingStarts();
emit beginInsertRows( QModelIndex(), c, c + entries.count() - 1 );
foreach( const plentry_ptr& entry, entries )
{
qDebug() << entry->query()->toString();
plitem = new PlItem( entry, m_rootItem );
plitem->index = createIndex( m_rootItem->children.count() - 1, 0, plitem );
connect( plitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
}
emit endInsertRows();
}
emit endInsertRows();
qDebug() << rowCount( QModelIndex() );
emit loadingFinished();
}