mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-17 11:30:49 +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
|
void
|
||||||
PlayableProxyModel::remove( const QModelIndex& index )
|
PlayableProxyModel::removeIndex( const QModelIndex& index )
|
||||||
{
|
{
|
||||||
if ( !sourceModel() )
|
if ( !sourceModel() )
|
||||||
return;
|
return;
|
||||||
if ( !index.isValid() )
|
if ( !index.isValid() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sourceModel()->remove( mapToSource( index ) );
|
sourceModel()->removeIndex( mapToSource( index ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PlayableProxyModel::remove( const QModelIndexList& indexes )
|
PlayableProxyModel::removeIndexes( const QModelIndexList& indexes )
|
||||||
{
|
{
|
||||||
if ( !sourceModel() )
|
if ( !sourceModel() )
|
||||||
return;
|
return;
|
||||||
@@ -212,12 +212,12 @@ PlayableProxyModel::remove( const QModelIndexList& indexes )
|
|||||||
pil << mapToSource( idx );
|
pil << mapToSource( idx );
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceModel()->remove( pil );
|
sourceModel()->removeIndexes( pil );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PlayableProxyModel::remove( const QList< QPersistentModelIndex >& indexes )
|
PlayableProxyModel::removeIndexes( const QList< QPersistentModelIndex >& indexes )
|
||||||
{
|
{
|
||||||
if ( !sourceModel() )
|
if ( !sourceModel() )
|
||||||
return;
|
return;
|
||||||
@@ -229,7 +229,7 @@ PlayableProxyModel::remove( const QList< QPersistentModelIndex >& indexes )
|
|||||||
pil << mapToSource( idx );
|
pil << mapToSource( idx );
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceModel()->remove( pil );
|
sourceModel()->removeIndexes( pil );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -44,9 +44,9 @@ public:
|
|||||||
virtual QPersistentModelIndex currentIndex() const { return mapFromSource( m_model->currentItem() ); }
|
virtual QPersistentModelIndex currentIndex() const { return mapFromSource( m_model->currentItem() ); }
|
||||||
virtual void setCurrentIndex( const QModelIndex& index ) { m_model->setCurrentItem( mapToSource( index ) ); }
|
virtual void setCurrentIndex( const QModelIndex& index ) { m_model->setCurrentItem( mapToSource( index ) ); }
|
||||||
|
|
||||||
virtual void remove( const QModelIndex& index );
|
virtual void removeIndex( const QModelIndex& index );
|
||||||
virtual void remove( const QModelIndexList& indexes );
|
virtual void removeIndexes( const QModelIndexList& indexes );
|
||||||
virtual void remove( const QList< QPersistentModelIndex >& indexes );
|
virtual void removeIndexes( const QList< QPersistentModelIndex >& indexes );
|
||||||
|
|
||||||
virtual bool showOfflineResults() const { return m_showOfflineResults; }
|
virtual bool showOfflineResults() const { return m_showOfflineResults; }
|
||||||
virtual void setShowOfflineResults( bool b );
|
virtual void setShowOfflineResults( bool b );
|
||||||
|
@@ -488,14 +488,7 @@ PlaylistModel::playlistEntries() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PlaylistModel::remove( int row, bool moreToCome )
|
PlaylistModel::removeIndex( const QModelIndex& index, bool moreToCome )
|
||||||
{
|
|
||||||
PlayableModel::remove( row, moreToCome );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
PlaylistModel::remove( const QModelIndex& index, bool moreToCome )
|
|
||||||
{
|
{
|
||||||
PlayableItem* item = itemFromIndex( index );
|
PlayableItem* item = itemFromIndex( index );
|
||||||
|
|
||||||
@@ -513,27 +506,13 @@ PlaylistModel::remove( const QModelIndex& index, bool moreToCome )
|
|||||||
if ( item && !m_isLoading )
|
if ( item && !m_isLoading )
|
||||||
m_savedRemoveTracks << item->query();
|
m_savedRemoveTracks << item->query();
|
||||||
|
|
||||||
PlayableModel::remove( index, moreToCome );
|
PlayableModel::removeIndex( index, moreToCome );
|
||||||
|
|
||||||
if ( !moreToCome )
|
if ( !moreToCome )
|
||||||
endPlaylistChanges();
|
endPlaylistChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
PlaylistModel::remove( const QList<QModelIndex>& indexes )
|
|
||||||
{
|
|
||||||
PlayableModel::remove( indexes );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
PlaylistModel::remove( const QList<QPersistentModelIndex>& indexes )
|
|
||||||
{
|
|
||||||
PlayableModel::remove( indexes );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PlaylistModel::isTemporary() const
|
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::query_ptr >& queries, int row = 0 );
|
||||||
virtual void insert( const QList< Tomahawk::plentry_ptr >& entries, 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 removeIndex( const QModelIndex& index, 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 );
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode );
|
void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode );
|
||||||
|
@@ -328,7 +328,7 @@ DynamicModel::addToPlaylist( const QList< query_ptr >& entries, bool clearFirst
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DynamicModel::remove(const QModelIndex& idx, bool moreToCome)
|
DynamicModel::removeIndex( const QModelIndex& idx, bool moreToCome )
|
||||||
{
|
{
|
||||||
if ( m_playlist->mode() == Static && isReadOnly() )
|
if ( m_playlist->mode() == Static && isReadOnly() )
|
||||||
return;
|
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
|
{ // if the user is manually removing the last one, re-add as we're a station
|
||||||
newTrackLoading();
|
newTrackLoading();
|
||||||
}
|
}
|
||||||
PlayableModel::remove( idx );
|
PlayableModel::removeIndex( idx );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
PlaylistModel::remove( idx, moreToCome );
|
PlaylistModel::removeIndex( idx, moreToCome );
|
||||||
// don't call onPlaylistChanged.
|
// don't call onPlaylistChanged.
|
||||||
|
|
||||||
if( !moreToCome )
|
if( !moreToCome )
|
||||||
|
Reference in New Issue
Block a user