1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 17:43:59 +02:00

Modernize ScriptCollection

This commit is contained in:
Uwe L. Korn
2014-10-17 23:56:43 +02:00
parent a7602504bb
commit bf32273ef5
2 changed files with 19 additions and 18 deletions

View File

@@ -137,7 +137,7 @@ Tomahawk::ArtistsRequest*
ScriptCollection::requestArtists() ScriptCollection::requestArtists()
{ {
Tomahawk::collection_ptr thisCollection = m_resolver->collections().value( name() ); Tomahawk::collection_ptr thisCollection = m_resolver->collections().value( name() );
if ( thisCollection->name() != this->name() ) if ( thisCollection->name() != name() )
return 0; return 0;
Tomahawk::ArtistsRequest* cmd = new ScriptCommand_AllArtists( thisCollection ); Tomahawk::ArtistsRequest* cmd = new ScriptCommand_AllArtists( thisCollection );
@@ -150,7 +150,7 @@ Tomahawk::AlbumsRequest*
ScriptCollection::requestAlbums( const Tomahawk::artist_ptr& artist ) ScriptCollection::requestAlbums( const Tomahawk::artist_ptr& artist )
{ {
Tomahawk::collection_ptr thisCollection = m_resolver->collections().value( name() ); Tomahawk::collection_ptr thisCollection = m_resolver->collections().value( name() );
if ( thisCollection->name() != this->name() ) if ( thisCollection->name() != name() )
return 0; return 0;
Tomahawk::AlbumsRequest* cmd = new ScriptCommand_AllAlbums( thisCollection, artist ); Tomahawk::AlbumsRequest* cmd = new ScriptCommand_AllAlbums( thisCollection, artist );
@@ -163,7 +163,7 @@ Tomahawk::TracksRequest*
ScriptCollection::requestTracks( const Tomahawk::album_ptr& album ) ScriptCollection::requestTracks( const Tomahawk::album_ptr& album )
{ {
Tomahawk::collection_ptr thisCollection = m_resolver->collections().value( name() ); Tomahawk::collection_ptr thisCollection = m_resolver->collections().value( name() );
if ( thisCollection->name() != this->name() ) if ( thisCollection->name() != name() )
return 0; return 0;
Tomahawk::TracksRequest* cmd = new ScriptCommand_AllTracks( thisCollection, album ); Tomahawk::TracksRequest* cmd = new ScriptCommand_AllTracks( thisCollection, album );

View File

@@ -1,6 +1,7 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
* *
* Copyright 2013, Teo Mrnjavac <teo@kde.org> * Copyright 2013, Teo Mrnjavac <teo@kde.org>
* Copyright 2014, Uwe L. Korn <uwelk@xhochy.com>
* *
* Tomahawk is free software: you can redistribute it and/or modify * Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -41,7 +42,7 @@ class DLLEXPORT ScriptCollection : public Collection
public: public:
explicit ScriptCollection( const source_ptr& source, explicit ScriptCollection( const source_ptr& source,
ExternalResolver* resolver, ExternalResolver* resolver,
QObject* parent = 0 ); QObject* parent = nullptr );
virtual ~ScriptCollection(); virtual ~ScriptCollection();
/** /**
@@ -53,26 +54,26 @@ public:
* different from the resolver's name, to identify the specific service rather than just the * different from the resolver's name, to identify the specific service rather than just the
* resolver. * resolver.
*/ */
virtual void setServiceName( const QString& name ); void setServiceName( const QString& name );
virtual QString prettyName() const; QString prettyName() const override;
virtual QString itemName() const; QString itemName() const override;
virtual BackendType backendType() const { return ScriptCollectionType; } BackendType backendType() const override { return ScriptCollectionType; }
virtual void setIcon( const QIcon& icon ); void setIcon( const QIcon& icon );
virtual QIcon icon() const; QIcon icon() const override;
virtual QPixmap bigIcon() const; QPixmap bigIcon() const override;
virtual void setDescription( const QString& text ); void setDescription( const QString& text );
virtual QString description() const; QString description() const override;
virtual ExternalResolver* resolver() { return m_resolver; } virtual ExternalResolver* resolver() { return m_resolver; }
virtual Tomahawk::ArtistsRequest* requestArtists(); Tomahawk::ArtistsRequest* requestArtists() override;
virtual Tomahawk::AlbumsRequest* requestAlbums( const Tomahawk::artist_ptr& artist ); Tomahawk::AlbumsRequest* requestAlbums( const Tomahawk::artist_ptr& artist ) override;
virtual Tomahawk::TracksRequest* requestTracks( const Tomahawk::album_ptr& album ); Tomahawk::TracksRequest* requestTracks( const Tomahawk::album_ptr& album ) override;
virtual void setTrackCount( int count ); void setTrackCount( int count );
virtual int trackCount() const; int trackCount() const override;
private: private:
ExternalResolver* m_resolver; ExternalResolver* m_resolver;