1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-18 23:09:42 +01: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();
// 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 );

View File

@ -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 )
{

View File

@ -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;