1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 00:09:47 +01:00

Introduce Locker style for PlayableProxyModel.

This commit is contained in:
Christian Muehlhaeuser 2015-04-10 05:58:30 +02:00
parent cea45a9bf4
commit 3734167a14
4 changed files with 21 additions and 10 deletions

View File

@ -120,7 +120,7 @@ PlayableModel::columnCount( const QModelIndex& parent ) const
{
Q_UNUSED( parent );
return 12;
return 13;
}

View File

@ -49,8 +49,9 @@ PlayableProxyModel::PlayableProxyModel( QObject* parent )
PlayableProxyModel::setSourcePlayableModel( NULL );
m_headerStyle[ Fancy ] << PlayableModel::Name;
m_headerStyle[ Detailed ] << PlayableModel::Artist << PlayableModel::Track << PlayableModel::Composer << PlayableModel::Album << PlayableModel::Download << PlayableModel::AlbumPos << PlayableModel::Duration << PlayableModel::Bitrate << PlayableModel::Age << PlayableModel::Year << PlayableModel::Filesize << PlayableModel::Origin << PlayableModel::Score;
m_headerStyle[ Collection ] << PlayableModel::Name << PlayableModel::Composer << PlayableModel::Duration << PlayableModel::Bitrate << PlayableModel::Age << PlayableModel::Year << PlayableModel::Filesize << PlayableModel::Origin;
m_headerStyle[ Detailed ] << PlayableModel::Artist << PlayableModel::Track << PlayableModel::Composer << PlayableModel::Album << PlayableModel::AlbumPos << PlayableModel::Duration << PlayableModel::Bitrate << PlayableModel::Age << PlayableModel::Year << PlayableModel::Filesize << PlayableModel::Origin << PlayableModel::Score;
m_headerStyle[ Collection ] << PlayableModel::Artist << PlayableModel::Track << PlayableModel::Composer << PlayableModel::Album << PlayableModel::AlbumPos << PlayableModel::Duration << PlayableModel::Bitrate << PlayableModel::Age << PlayableModel::Year << PlayableModel::Filesize;
m_headerStyle[ Locker ] << PlayableModel::Artist << PlayableModel::Track << PlayableModel::Composer << PlayableModel::Album << PlayableModel::Download << PlayableModel::AlbumPos << PlayableModel::Duration << PlayableModel::Bitrate << PlayableModel::Age << PlayableModel::Year << PlayableModel::Filesize;
}
@ -607,12 +608,16 @@ PlayableProxyModel::columnCount( const QModelIndex& parent ) const
break;
case Collection:
return 8;
return 10;
break;
case Locker:
return 11;
break;
case Detailed:
default:
return 13;
return 12;
break;
}
}
@ -669,12 +674,16 @@ PlayableProxyModel::columnWeights() const
break;
case Collection:
w << 0.42 << 0.12 << 0.07 << 0.07 << 0.07 << 0.07 << 0.07; // << 0.11;
w << 0.16 << 0.17 << 0.15 << 0.15 << 0.06 << 0.06 << 0.06 << 0.06 << 0.06; // << 0.07;
break;
case Locker:
w << 0.14 << 0.15 << 0.12 << 0.12 << 0.12 << 0.06 << 0.06 << 0.06 << 0.06 << 0.06; // << 0.05;
break;
case Detailed:
default:
w << 0.12 << 0.12 << 0.12 << 0.12 << 0.06 << 0.05 << 0.05 << 0.05 << 0.05 << 0.05 << 0.05 << 0.09; // << 0.03;
w << 0.15 << 0.16 << 0.13 << 0.13 << 0.05 << 0.05 << 0.05 << 0.05 << 0.05 << 0.05 << 0.08; // << 0.05;
break;
}

View File

@ -47,7 +47,7 @@ Q_OBJECT
public:
enum PlayableItemStyle
{ Detailed = 0, Fancy = 1, Collection = 2 };
{ Detailed = 0, Fancy = 1, Collection = 2, Locker = 3 };
enum PlayableProxyModelRole
{ StyleRole = Qt::UserRole + 1, TypeRole };

View File

@ -102,7 +102,7 @@ PlaylistItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModel
QSize size = QStyledItemDelegate::sizeHint( option, index );
{
if ( m_model->style() == PlayableProxyModel::Detailed )
if ( m_model->style() != PlayableProxyModel::Fancy )
{
int rowHeight = option.fontMetrics.height() * 1.6;
size.setHeight( rowHeight );
@ -217,6 +217,8 @@ PlaylistItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& opti
const int style = index.data( PlayableProxyModel::StyleRole ).toInt();
switch ( style )
{
case PlayableProxyModel::Collection:
case PlayableProxyModel::Locker:
case PlayableProxyModel::Detailed:
paintDetailed( painter, option, index );
break;
@ -855,7 +857,7 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
}
else if ( hoveringInfo )
{
if ( m_model->style() != PlayableProxyModel::Detailed )
if ( m_model->style() == PlayableProxyModel::Fancy )
{
if ( item->query() )
ViewManager::instance()->show( item->query()->track()->toQuery() );