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