1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-16 02:54:33 +02:00

* Adjust inheriting models to new PlayableModel API.

This commit is contained in:
Christian Muehlhaeuser
2012-06-29 02:27:41 +02:00
parent f42696de23
commit 79c55f1699
5 changed files with 15 additions and 39 deletions

View File

@@ -188,19 +188,19 @@ PlayableProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourcePa
void
PlayableProxyModel::remove( const QModelIndex& index )
PlayableProxyModel::removeIndex( const QModelIndex& index )
{
if ( !sourceModel() )
return;
if ( !index.isValid() )
return;
sourceModel()->remove( mapToSource( index ) );
sourceModel()->removeIndex( mapToSource( index ) );
}
void
PlayableProxyModel::remove( const QModelIndexList& indexes )
PlayableProxyModel::removeIndexes( const QModelIndexList& indexes )
{
if ( !sourceModel() )
return;
@@ -212,12 +212,12 @@ PlayableProxyModel::remove( const QModelIndexList& indexes )
pil << mapToSource( idx );
}
sourceModel()->remove( pil );
sourceModel()->removeIndexes( pil );
}
void
PlayableProxyModel::remove( const QList< QPersistentModelIndex >& indexes )
PlayableProxyModel::removeIndexes( const QList< QPersistentModelIndex >& indexes )
{
if ( !sourceModel() )
return;
@@ -229,7 +229,7 @@ PlayableProxyModel::remove( const QList< QPersistentModelIndex >& indexes )
pil << mapToSource( idx );
}
sourceModel()->remove( pil );
sourceModel()->removeIndexes( pil );
}

View File

@@ -44,9 +44,9 @@ public:
virtual QPersistentModelIndex currentIndex() const { return mapFromSource( m_model->currentItem() ); }
virtual void setCurrentIndex( const QModelIndex& index ) { m_model->setCurrentItem( mapToSource( index ) ); }
virtual void remove( const QModelIndex& index );
virtual void remove( const QModelIndexList& indexes );
virtual void remove( const QList< QPersistentModelIndex >& indexes );
virtual void removeIndex( const QModelIndex& index );
virtual void removeIndexes( const QModelIndexList& indexes );
virtual void removeIndexes( const QList< QPersistentModelIndex >& indexes );
virtual bool showOfflineResults() const { return m_showOfflineResults; }
virtual void setShowOfflineResults( bool b );

View File

@@ -488,14 +488,7 @@ PlaylistModel::playlistEntries() const
void
PlaylistModel::remove( int row, bool moreToCome )
{
PlayableModel::remove( row, moreToCome );
}
void
PlaylistModel::remove( const QModelIndex& index, bool moreToCome )
PlaylistModel::removeIndex( const QModelIndex& index, bool moreToCome )
{
PlayableItem* item = itemFromIndex( index );
@@ -513,27 +506,13 @@ PlaylistModel::remove( const QModelIndex& index, bool moreToCome )
if ( item && !m_isLoading )
m_savedRemoveTracks << item->query();
PlayableModel::remove( index, moreToCome );
PlayableModel::removeIndex( index, moreToCome );
if ( !moreToCome )
endPlaylistChanges();
}
void
PlaylistModel::remove( const QList<QModelIndex>& indexes )
{
PlayableModel::remove( indexes );
}
void
PlaylistModel::remove( const QList<QPersistentModelIndex>& indexes )
{
PlayableModel::remove( indexes );
}
bool
PlaylistModel::isTemporary() const
{

View File

@@ -68,10 +68,7 @@ public slots:
virtual void insert( const QList< Tomahawk::query_ptr >& queries, int row = 0 );
virtual void insert( const QList< Tomahawk::plentry_ptr >& entries, int row = 0 );
virtual void remove( int row, bool moreToCome = false );
virtual void remove( const QModelIndex& index, bool moreToCome = false );
virtual void remove( const QList<QModelIndex>& indexes );
virtual void remove( const QList<QPersistentModelIndex>& indexes );
virtual void removeIndex( const QModelIndex& index, bool moreToCome = false );
signals:
void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode );

View File

@@ -328,7 +328,7 @@ DynamicModel::addToPlaylist( const QList< query_ptr >& entries, bool clearFirst
void
DynamicModel::remove(const QModelIndex& idx, bool moreToCome)
DynamicModel::removeIndex( const QModelIndex& idx, bool moreToCome )
{
if ( m_playlist->mode() == Static && isReadOnly() )
return;
@@ -340,10 +340,10 @@ DynamicModel::remove(const QModelIndex& idx, bool moreToCome)
{ // if the user is manually removing the last one, re-add as we're a station
newTrackLoading();
}
PlayableModel::remove( idx );
PlayableModel::removeIndex( idx );
}
else
PlaylistModel::remove( idx, moreToCome );
PlaylistModel::removeIndex( idx, moreToCome );
// don't call onPlaylistChanged.
if( !moreToCome )