mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
* Turned ugly if/else into a switch.
This commit is contained in:
@@ -77,6 +77,7 @@ public:
|
||||
void setWeakRef( QWeakPointer< Tomahawk::Artist > weakRef ) { m_ownRef = weakRef; }
|
||||
|
||||
void loadId( bool autoCreate );
|
||||
|
||||
signals:
|
||||
void tracksAdded( const QList<Tomahawk::query_ptr>& tracks, Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
|
||||
void albumsAdded( const QList<Tomahawk::album_ptr>& albums, Tomahawk::ModelMode mode );
|
||||
|
@@ -271,15 +271,15 @@ PlayableModel::data( const QModelIndex& index, int role ) const
|
||||
if ( !entry )
|
||||
return QVariant();
|
||||
|
||||
if ( role == Qt::DecorationRole )
|
||||
switch ( role )
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
else if ( role == Qt::TextAlignmentRole )
|
||||
case Qt::TextAlignmentRole:
|
||||
{
|
||||
return QVariant( columnAlignment( index.column() ) );
|
||||
break;
|
||||
}
|
||||
else if ( role == PlayableProxyModel::TypeRole )
|
||||
|
||||
case PlayableProxyModel::TypeRole:
|
||||
{
|
||||
if ( entry->result() )
|
||||
{
|
||||
@@ -297,8 +297,11 @@ PlayableModel::data( const QModelIndex& index, int role ) const
|
||||
{
|
||||
return Tomahawk::TypeAlbum;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
if ( !entry->query().isNull() )
|
||||
{
|
||||
return queryData( entry->query()->displayQuery(), index.column(), role );
|
||||
@@ -311,6 +314,9 @@ PlayableModel::data( const QModelIndex& index, int role ) const
|
||||
{
|
||||
return albumData( entry->album(), role );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
Reference in New Issue
Block a user