1
0
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:
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

@@ -74,7 +74,7 @@ signals:
void coverChanged(); void coverChanged();
private slots: 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 infoSystemInfo( const Tomahawk::InfoSystem::InfoRequestData& requestData, const QVariant& output );
void infoSystemFinished( const QString& target ); void infoSystemFinished( const QString& target );

View File

@@ -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 );
@@ -88,7 +89,7 @@ signals:
void statsLoaded(); void statsLoaded();
private slots: 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 onAlbumsFound( const QList<Tomahawk::album_ptr>& albums, const QVariant& data );
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output ); void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );

View File

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