mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-25 23:06:23 +02:00
* Reset the PlaylistModel if we clear it.
This commit is contained in:
@@ -75,9 +75,9 @@ PlaylistModel::loadPlaylist( const Tomahawk::playlist_ptr& playlist, bool loadEn
|
|||||||
|
|
||||||
if ( rowCount( QModelIndex() ) && loadEntries )
|
if ( rowCount( QModelIndex() ) && loadEntries )
|
||||||
{
|
{
|
||||||
emit beginRemoveRows( QModelIndex(), 0, rowCount( QModelIndex() ) - 1 );
|
emit beginResetModel();
|
||||||
delete m_rootItem;
|
delete m_rootItem;
|
||||||
emit endRemoveRows();
|
emit endResetModel();
|
||||||
m_rootItem = new PlItem( 0, this );
|
m_rootItem = new PlItem( 0, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,6 +143,7 @@ PlaylistModel::loadHistory( const Tomahawk::source_ptr& source, unsigned int amo
|
|||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PlaylistModel::clear()
|
PlaylistModel::clear()
|
||||||
{
|
{
|
||||||
@@ -263,7 +264,6 @@ PlaylistModel::onDataChanged()
|
|||||||
void
|
void
|
||||||
PlaylistModel::onRevisionLoaded( Tomahawk::PlaylistRevision revision )
|
PlaylistModel::onRevisionLoaded( Tomahawk::PlaylistRevision revision )
|
||||||
{
|
{
|
||||||
qDebug() << "PLAYLIST::onRevisionLoaded";
|
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
if ( m_waitForUpdate )
|
if ( m_waitForUpdate )
|
||||||
@@ -365,12 +365,18 @@ PlaylistModel::onPlaylistChanged( bool waitForUpdate )
|
|||||||
|
|
||||||
m_waitForUpdate = waitForUpdate;
|
m_waitForUpdate = waitForUpdate;
|
||||||
QString newrev = uuid();
|
QString newrev = uuid();
|
||||||
if( dynplaylist_ptr dynplaylist = m_playlist.dynamicCast<Tomahawk::DynamicPlaylist>() ) {
|
if( dynplaylist_ptr dynplaylist = m_playlist.dynamicCast<Tomahawk::DynamicPlaylist>() )
|
||||||
|
{
|
||||||
if( dynplaylist->mode() == OnDemand )
|
if( dynplaylist->mode() == OnDemand )
|
||||||
|
{
|
||||||
dynplaylist->createNewRevision( newrev );
|
dynplaylist->createNewRevision( newrev );
|
||||||
|
}
|
||||||
else if( dynplaylist->mode() == Static )
|
else if( dynplaylist->mode() == Static )
|
||||||
|
{
|
||||||
dynplaylist->createNewRevision( newrev, dynplaylist->currentrevision(), dynplaylist->type(), dynplaylist->generator()->controls(), l );
|
dynplaylist->createNewRevision( newrev, dynplaylist->currentrevision(), dynplaylist->type(), dynplaylist->generator()->controls(), l );
|
||||||
} else {
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
m_playlist->createNewRevision( newrev, m_playlist->currentrevision(), l );
|
m_playlist->createNewRevision( newrev, m_playlist->currentrevision(), l );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user