From 62731c79078991ded3ced1a0d1f37e0bb86bc224 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Sat, 6 Dec 2014 15:10:57 +0100 Subject: [PATCH] tbr: Add id to ScriptCollection --- src/libtomahawk/resolvers/JSResolver.cpp | 2 +- src/libtomahawk/resolvers/ScriptCollection.cpp | 11 ++++++++++- src/libtomahawk/resolvers/ScriptCollection.h | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/libtomahawk/resolvers/JSResolver.cpp b/src/libtomahawk/resolvers/JSResolver.cpp index ee3baa003..5888b78c7 100644 --- a/src/libtomahawk/resolvers/JSResolver.cpp +++ b/src/libtomahawk/resolvers/JSResolver.cpp @@ -823,7 +823,7 @@ JSResolver::loadCollections() m_collections.clear(); // at this point we assume that all the tracks browsable through a resolver belong to the local source - Tomahawk::ScriptCollection* sc = new Tomahawk::ScriptCollection( SourceList::instance()->getLocal(), this ); + Tomahawk::ScriptCollection* sc = new Tomahawk::ScriptCollection( collectionInfo[ "id" ].toString(), SourceList::instance()->getLocal(), this ); sc->setServiceName( prettyname ); sc->setDescription( desc ); diff --git a/src/libtomahawk/resolvers/ScriptCollection.cpp b/src/libtomahawk/resolvers/ScriptCollection.cpp index a1e21335e..f19e4d814 100644 --- a/src/libtomahawk/resolvers/ScriptCollection.cpp +++ b/src/libtomahawk/resolvers/ScriptCollection.cpp @@ -32,10 +32,12 @@ using namespace Tomahawk; -ScriptCollection::ScriptCollection( const source_ptr& source, +ScriptCollection::ScriptCollection( const QString& id, + const source_ptr& source, ExternalResolver* resolver, QObject* parent ) : Collection( source, QString( "scriptcollection:" + resolver->name() + ":" + uuid() ), parent ) + , m_id( id ) , m_trackCount( -1 ) //null value { Q_ASSERT( resolver ); @@ -53,6 +55,13 @@ ScriptCollection::~ScriptCollection() } +const QString +ScriptCollection::id() const +{ + return m_id; +} + + void ScriptCollection::setServiceName( const QString& name ) { diff --git a/src/libtomahawk/resolvers/ScriptCollection.h b/src/libtomahawk/resolvers/ScriptCollection.h index 5d1459f2c..8843e4aa3 100644 --- a/src/libtomahawk/resolvers/ScriptCollection.h +++ b/src/libtomahawk/resolvers/ScriptCollection.h @@ -40,11 +40,14 @@ class DLLEXPORT ScriptCollection : public Collection Q_OBJECT public: - explicit ScriptCollection( const source_ptr& source, + explicit ScriptCollection( const QString& id, + const source_ptr& source, ExternalResolver* resolver, QObject* parent = nullptr ); virtual ~ScriptCollection(); + const QString id() const; + /** * @brief setServiceName sets the name of the service that provides the ScriptCollection. * Please note that by default, the pretty name is the same as the resolver's name, e.g. @@ -76,6 +79,7 @@ public: int trackCount() const override; private: + QString m_id; ExternalResolver* m_resolver; QString m_servicePrettyName; QString m_description;