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:
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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 );
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -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 );
|
||||
|
@@ -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 )
|
||||
|
Reference in New Issue
Block a user