1
0
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:
Christian Muehlhaeuser
2013-01-25 16:28:41 +01:00
parent 9e9459486a
commit 835e64fe55
3 changed files with 44 additions and 37 deletions

View File

@@ -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 );

View File

@@ -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();
}