mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +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 setWeakRef( QWeakPointer< Tomahawk::Artist > weakRef ) { m_ownRef = weakRef; }
|
||||||
|
|
||||||
void loadId( bool autoCreate );
|
void loadId( bool autoCreate );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void tracksAdded( const QList<Tomahawk::query_ptr>& tracks, Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
|
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 );
|
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 )
|
if ( !entry )
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if ( role == Qt::DecorationRole )
|
switch ( role )
|
||||||
{
|
{
|
||||||
return QVariant();
|
case Qt::TextAlignmentRole:
|
||||||
}
|
|
||||||
else if ( role == Qt::TextAlignmentRole )
|
|
||||||
{
|
{
|
||||||
return QVariant( columnAlignment( index.column() ) );
|
return QVariant( columnAlignment( index.column() ) );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if ( role == PlayableProxyModel::TypeRole )
|
|
||||||
|
case PlayableProxyModel::TypeRole:
|
||||||
{
|
{
|
||||||
if ( entry->result() )
|
if ( entry->result() )
|
||||||
{
|
{
|
||||||
@@ -297,8 +297,11 @@ PlayableModel::data( const QModelIndex& index, int role ) const
|
|||||||
{
|
{
|
||||||
return Tomahawk::TypeAlbum;
|
return Tomahawk::TypeAlbum;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
if ( !entry->query().isNull() )
|
if ( !entry->query().isNull() )
|
||||||
{
|
{
|
||||||
return queryData( entry->query()->displayQuery(), index.column(), role );
|
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 );
|
return albumData( entry->album(), role );
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user