1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-24 01:39:42 +01:00

* Added setFilter methods to proxy models.

This commit is contained in:
Christian Muehlhaeuser 2012-07-03 02:49:31 +02:00
parent dc0316018a
commit 6a23954539
4 changed files with 17 additions and 16 deletions

View File

@ -578,3 +578,14 @@ PlayableProxyModel::updateDetailedInfo( const QModelIndex& index )
item->query()->loadSocialActions();
}
}
void
PlayableProxyModel::setFilter( const QString& pattern )
{
if ( pattern != filterRegExp().pattern() )
{
setFilterRegExp( pattern );
emit filterChanged( pattern );
}
}

View File

@ -66,8 +66,6 @@ public:
virtual int maxVisibleItems() const { return m_maxVisibleItems; }
virtual void setMaxVisibleItems( int items );
virtual void emitFilterChanged( const QString &pattern ) { emit filterChanged( pattern ); }
virtual PlayableItem* itemFromIndex( const QModelIndex& index ) const { return sourceModel()->itemFromIndex( index ); }
virtual Tomahawk::playlistinterface_ptr playlistInterface();
@ -78,7 +76,8 @@ public:
virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
virtual QVariant headerData( int section, Qt::Orientation orientation, int role ) const;
void updateDetailedInfo( const QModelIndex& index );
virtual void setFilter( const QString& pattern );
virtual void updateDetailedInfo( const QModelIndex& index );
signals:
void filterChanged( const QString& filter );

View File

@ -92,7 +92,7 @@ TreeProxyModel::onModelReset()
void
TreeProxyModel::newFilterFromPlaylistInterface( const QString& pattern )
TreeProxyModel::setFilter( const QString& pattern )
{
emit filteringStarted();
@ -170,16 +170,8 @@ TreeProxyModel::filterFinished()
{
m_artistsFilterCmd = 0;
if ( qobject_cast< Tomahawk::TreeProxyModelPlaylistInterface* >( m_playlistInterface.data() )->vanillaFilter() != m_filter )
{
emit filterChanged( m_filter );
}
qobject_cast< Tomahawk::TreeProxyModelPlaylistInterface* >( m_playlistInterface )->setVanillaFilter( m_filter );
setFilterRegExp( m_filter );
qobject_cast< Tomahawk::TreeProxyModelPlaylistInterface* >( m_playlistInterface )->sendTrackCount();
emit filterChanged( m_filter );
emit filteringFinished();
}

View File

@ -42,11 +42,10 @@ public:
virtual ~TreeProxyModel() {}
virtual void setSourcePlayableModel( TreeModel* model );
virtual void newFilterFromPlaylistInterface( const QString& pattern );
virtual Tomahawk::playlistinterface_ptr playlistInterface();
virtual void setFilter( const QString& pattern );
signals:
protected: