mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 01:09:42 +01:00
* Turned ugly if/else into a switch.
This commit is contained in:
parent
9e9459486a
commit
835e64fe55
@ -74,7 +74,7 @@ signals:
|
||||
void coverChanged();
|
||||
|
||||
private slots:
|
||||
void onTracksLoaded(Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
|
||||
void onTracksLoaded( Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
|
||||
|
||||
void infoSystemInfo( const Tomahawk::InfoSystem::InfoRequestData& requestData, const QVariant& output );
|
||||
void infoSystemFinished( const QString& target );
|
||||
|
@ -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 );
|
||||
@ -88,7 +89,7 @@ signals:
|
||||
void statsLoaded();
|
||||
|
||||
private slots:
|
||||
void onTracksLoaded(Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
|
||||
void onTracksLoaded( Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
|
||||
void onAlbumsFound( const QList<Tomahawk::album_ptr>& albums, const QVariant& data );
|
||||
|
||||
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||
|
@ -271,45 +271,51 @@ 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 )
|
||||
{
|
||||
return QVariant( columnAlignment( index.column() ) );
|
||||
}
|
||||
else if ( role == PlayableProxyModel::TypeRole )
|
||||
{
|
||||
if ( entry->result() )
|
||||
case Qt::TextAlignmentRole:
|
||||
{
|
||||
return Tomahawk::TypeResult;
|
||||
return QVariant( columnAlignment( index.column() ) );
|
||||
break;
|
||||
}
|
||||
else if ( entry->query() )
|
||||
{
|
||||
return Tomahawk::TypeQuery;
|
||||
}
|
||||
else if ( entry->artist() )
|
||||
{
|
||||
return Tomahawk::TypeArtist;
|
||||
}
|
||||
else if ( entry->album() )
|
||||
{
|
||||
return Tomahawk::TypeAlbum;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !entry->query().isNull() )
|
||||
{
|
||||
return queryData( entry->query()->displayQuery(), index.column(), role );
|
||||
}
|
||||
else if ( !entry->artist().isNull() )
|
||||
{
|
||||
return artistData( entry->artist(), role );
|
||||
}
|
||||
else if ( !entry->album().isNull() )
|
||||
{
|
||||
return albumData( entry->album(), role );
|
||||
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() )
|
||||
{
|
||||
return queryData( entry->query()->displayQuery(), index.column(), role );
|
||||
}
|
||||
else if ( !entry->artist().isNull() )
|
||||
{
|
||||
return artistData( entry->artist(), role );
|
||||
}
|
||||
else if ( !entry->album().isNull() )
|
||||
{
|
||||
return albumData( entry->album(), role );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
|
Loading…
x
Reference in New Issue
Block a user