1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

tbr: Add id to ScriptCollection

This commit is contained in:
Dominik Schmidt
2014-12-06 15:10:57 +01:00
parent 7e9cb98154
commit 62731c7907
3 changed files with 16 additions and 3 deletions

View File

@@ -823,7 +823,7 @@ JSResolver::loadCollections()
m_collections.clear(); m_collections.clear();
// at this point we assume that all the tracks browsable through a resolver belong to the local source // 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->setServiceName( prettyname );
sc->setDescription( desc ); sc->setDescription( desc );

View File

@@ -32,10 +32,12 @@
using namespace Tomahawk; using namespace Tomahawk;
ScriptCollection::ScriptCollection( const source_ptr& source, ScriptCollection::ScriptCollection( const QString& id,
const source_ptr& source,
ExternalResolver* resolver, ExternalResolver* resolver,
QObject* parent ) QObject* parent )
: Collection( source, QString( "scriptcollection:" + resolver->name() + ":" + uuid() ), parent ) : Collection( source, QString( "scriptcollection:" + resolver->name() + ":" + uuid() ), parent )
, m_id( id )
, m_trackCount( -1 ) //null value , m_trackCount( -1 ) //null value
{ {
Q_ASSERT( resolver ); Q_ASSERT( resolver );
@@ -53,6 +55,13 @@ ScriptCollection::~ScriptCollection()
} }
const QString
ScriptCollection::id() const
{
return m_id;
}
void void
ScriptCollection::setServiceName( const QString& name ) ScriptCollection::setServiceName( const QString& name )
{ {

View File

@@ -40,11 +40,14 @@ class DLLEXPORT ScriptCollection : public Collection
Q_OBJECT Q_OBJECT
public: public:
explicit ScriptCollection( const source_ptr& source, explicit ScriptCollection( const QString& id,
const source_ptr& source,
ExternalResolver* resolver, ExternalResolver* resolver,
QObject* parent = nullptr ); QObject* parent = nullptr );
virtual ~ScriptCollection(); virtual ~ScriptCollection();
const QString id() const;
/** /**
* @brief setServiceName sets the name of the service that provides the ScriptCollection. * @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. * 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; int trackCount() const override;
private: private:
QString m_id;
ExternalResolver* m_resolver; ExternalResolver* m_resolver;
QString m_servicePrettyName; QString m_servicePrettyName;
QString m_description; QString m_description;