diff --git a/src/libtomahawk/Collection.cpp b/src/libtomahawk/Collection.cpp index 6f08a5389..a71c80d96 100644 --- a/src/libtomahawk/Collection.cpp +++ b/src/libtomahawk/Collection.cpp @@ -23,6 +23,7 @@ #include "utils/Logger.h" #include "playlist/PlaylistUpdaterInterface.h" +#include "utils/ImageRegistry.h" #include #include @@ -63,6 +64,13 @@ Collection::prettyName() const } +QIcon +Collection::icon() const +{ + return ImageRegistry::instance()->icon( RESPATH "images/collection.svg" ); +} + + const source_ptr& Collection::source() const { diff --git a/src/libtomahawk/Collection.h b/src/libtomahawk/Collection.h index 197e18250..37c40ca18 100644 --- a/src/libtomahawk/Collection.h +++ b/src/libtomahawk/Collection.h @@ -36,6 +36,8 @@ #include "DllMacro.h" +class QIcon; + namespace Tomahawk { @@ -50,6 +52,7 @@ public: virtual QString name() const; virtual QString prettyName() const; virtual QString type() const { return QString(); } + virtual QIcon icon() const; virtual void loadPlaylists() { qDebug() << Q_FUNC_INFO; } virtual void loadAutoPlaylists() { qDebug() << Q_FUNC_INFO; } diff --git a/src/libtomahawk/resolvers/ScriptCollection.cpp b/src/libtomahawk/resolvers/ScriptCollection.cpp index c1b0ce8d1..a1a4abbcf 100644 --- a/src/libtomahawk/resolvers/ScriptCollection.cpp +++ b/src/libtomahawk/resolvers/ScriptCollection.cpp @@ -20,6 +20,9 @@ #include "ScriptCollection.h" #include "Source.h" +#include "ExternalResolverGui.h" + +#include using namespace Tomahawk; @@ -49,3 +52,15 @@ ScriptCollection::prettyName() const "Name of a collection based on a resolver, e.g. Subsonic Collection" ) .arg( m_resolver->name() ); } + + +QIcon +ScriptCollection::icon() const +{ + ExternalResolverGui* gResolver = qobject_cast< ExternalResolverGui* >( m_resolver ); + if ( gResolver ) + { + return gResolver->icon(); + } + return QIcon(); +} diff --git a/src/libtomahawk/resolvers/ScriptCollection.h b/src/libtomahawk/resolvers/ScriptCollection.h index 3e71e54d6..389b6d7a1 100644 --- a/src/libtomahawk/resolvers/ScriptCollection.h +++ b/src/libtomahawk/resolvers/ScriptCollection.h @@ -42,6 +42,7 @@ public: virtual QString prettyName() const; virtual QString type() const { return "scriptcollection"; } + virtual QIcon icon() const; virtual ExternalResolver* resolver() { return m_resolver; } diff --git a/src/sourcetree/items/SourceItem.cpp b/src/sourcetree/items/SourceItem.cpp index 382bb6983..f3519b61e 100644 --- a/src/sourcetree/items/SourceItem.cpp +++ b/src/sourcetree/items/SourceItem.cpp @@ -372,7 +372,7 @@ SourceItem::performAddCollectionItem( const collection_ptr& collection ) GenericPageItem* item = new GenericPageItem( model(), this, collection->prettyName(), - ImageRegistry::instance()->icon( RESPATH "images/collection.svg" ), //FIXME different icon + collection->icon(), boost::bind( &SourceItem::collectionClicked, this, collection ), boost::bind( &SourceItem::getCollectionPage, this, collection ) );