mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +02:00
Add colum mapping to PlayableProxyModel
This commit is contained in:
@@ -119,8 +119,9 @@ int
|
||||
PlayableModel::columnCount( const QModelIndex& parent ) const
|
||||
{
|
||||
Q_UNUSED( parent );
|
||||
Q_D( const PlayableModel );
|
||||
|
||||
return 13;
|
||||
return d->header.length();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -614,11 +614,11 @@ PlayableProxyModel::columnCount( const QModelIndex& parent ) const
|
||||
break;
|
||||
|
||||
case Collection:
|
||||
return 10;
|
||||
return m_headerStyle[ Collection ].length();
|
||||
break;
|
||||
|
||||
case Locker:
|
||||
return 11;
|
||||
return m_headerStyle[ Locker ].length();
|
||||
break;
|
||||
|
||||
case Detailed:
|
||||
@@ -733,6 +733,13 @@ PlayableProxyModel::setFilter( const QString& pattern )
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
PlayableProxyModel::mapSourceColumnToColumn( PlayableModel::Columns column )
|
||||
{
|
||||
return m_headerStyle[ m_style ].indexOf( column );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlayableProxyModel::setCurrentIndex( const QModelIndex& index )
|
||||
{
|
||||
|
@@ -98,6 +98,8 @@ public:
|
||||
virtual void setFilter( const QString& pattern );
|
||||
virtual void updateDetailedInfo( const QModelIndex& index );
|
||||
|
||||
int mapSourceColumnToColumn( PlayableModel::Columns column );
|
||||
|
||||
signals:
|
||||
void filterChanged( const QString& filter );
|
||||
|
||||
|
@@ -62,6 +62,8 @@ CollectionViewPage::CollectionViewPage( const Tomahawk::collection_ptr& collecti
|
||||
|
||||
m_columnView->proxyModel()->setStyle( PlayableProxyModel::SingleColumn );
|
||||
|
||||
|
||||
PlayableProxyModel* trackViewProxyModel = m_trackView->proxyModel();
|
||||
if ( collection->backendType() == Collection::ScriptCollectionType )
|
||||
{
|
||||
m_trackView->proxyModel()->setStyle( PlayableProxyModel::Locker );
|
||||
@@ -70,6 +72,12 @@ CollectionViewPage::CollectionViewPage( const Tomahawk::collection_ptr& collecti
|
||||
{
|
||||
m_trackView->proxyModel()->setStyle( PlayableProxyModel::Collection );
|
||||
}
|
||||
// mapSourceColumnToColumn depends on the just set PlayableProxyModel::PlayableItemStyle
|
||||
m_trackView->setColumnHidden( trackViewProxyModel->mapSourceColumnToColumn( PlayableModel::Composer ), true );
|
||||
m_trackView->setColumnHidden( trackViewProxyModel->mapSourceColumnToColumn( PlayableModel::Origin ), true );
|
||||
m_trackView->setColumnHidden( trackViewProxyModel->mapSourceColumnToColumn( PlayableModel::Score ), true );
|
||||
m_trackView->setColumnHidden( trackViewProxyModel->mapSourceColumnToColumn( PlayableModel::Bitrate ), true );
|
||||
|
||||
|
||||
m_trackView->setGuid( QString( "trackview/flat" ) );
|
||||
|
||||
|
Reference in New Issue
Block a user