1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 00:54:20 +02:00

* Added custom UserRoles to access model's data.

This commit is contained in:
Christian Muehlhaeuser
2013-06-12 06:05:52 +02:00
committed by Michael Zanetti
parent db56757bc8
commit fc4e42befa

View File

@@ -294,6 +294,26 @@ PlayableModel::data( const QModelIndex& index, int role ) const
if ( !entry )
return QVariant();
if ( role == PlayableProxyModel::TypeRole )
{
if ( entry->result() )
{
return Tomahawk::TypeResult;
}
else if ( entry->query() )
{
return Tomahawk::TypeQuery;
}
else if ( entry->artist() )
{
return Tomahawk::TypeArtist;
}
else if ( entry->album() )
{
return Tomahawk::TypeAlbum;
}
}
int column = index.column();
if ( role < CoverIDRole && role >= Qt::UserRole )
{
@@ -310,33 +330,6 @@ PlayableModel::data( const QModelIndex& index, int role ) const
break;
}
case IsPlayingRole:
{
return entry->isPlaying();
break;
}
case PlayableProxyModel::TypeRole:
{
if ( entry->result() )
{
return Tomahawk::TypeResult;
}
else if ( entry->query() )
{
return Tomahawk::TypeQuery;
}
else if ( entry->artist() )
{
return Tomahawk::TypeArtist;
}
else if ( entry->album() )
{
return Tomahawk::TypeAlbum;
}
break;
}
default:
{
if ( !entry->query().isNull() )