/src/libtomahawk/database/DatabaseCollection.h

http://github.com/tomahawk-player/tomahawk · C Header · 84 lines · 45 code · 19 blank · 20 comment · 0 complexity · 5cbd445391d3500d411867e190d38cae MD5 · raw file

  1. /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
  2. *
  3. * Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
  4. * Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
  5. * Copyright 2013, Teo Mrnjavac <teo@kde.org>
  6. *
  7. * Tomahawk is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * Tomahawk is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef DATABASECOLLECTION_H
  21. #define DATABASECOLLECTION_H
  22. #include "collection/Collection.h"
  23. #include "DllMacro.h"
  24. #include "Source.h"
  25. #include "Typedefs.h"
  26. #include <QDir>
  27. namespace Tomahawk
  28. {
  29. class DLLEXPORT DatabaseCollection : public Tomahawk::Collection
  30. {
  31. Q_OBJECT
  32. public:
  33. explicit DatabaseCollection( const Tomahawk::source_ptr& source, QObject* parent = nullptr );
  34. virtual ~DatabaseCollection()
  35. {
  36. qDebug() << Q_FUNC_INFO;
  37. }
  38. BackendType backendType() const override { return DatabaseCollectionType; }
  39. bool isOnline() const override;
  40. bool isLocal() const override { return source()->isLocal(); }
  41. using Collection::source;
  42. void loadPlaylists() override;
  43. void loadAutoPlaylists() override;
  44. void loadStations() override;
  45. QList< Tomahawk::playlist_ptr > playlists() override;
  46. QList< Tomahawk::dynplaylist_ptr > autoPlaylists() override;
  47. QList< Tomahawk::dynplaylist_ptr > stations() override;
  48. Tomahawk::ArtistsRequest* requestArtists() override;
  49. Tomahawk::AlbumsRequest* requestAlbums( const Tomahawk::artist_ptr& artist ) override;
  50. Tomahawk::TracksRequest* requestTracks( const Tomahawk::album_ptr& album ) override;
  51. int trackCount() const override;
  52. QPixmap icon( const QSize& size ) const override;
  53. // Resolver interface
  54. unsigned int weight() const override;
  55. unsigned int timeout() const override;
  56. void resolve( const Tomahawk::query_ptr& query ) override;
  57. public slots:
  58. virtual void addTracks( const QList<QVariant>& newitems );
  59. virtual void removeTracks( const QDir& dir );
  60. private slots:
  61. void stationCreated( const Tomahawk::source_ptr& source, const QVariantList& data );
  62. void autoPlaylistCreated( const Tomahawk::source_ptr& source, const QVariantList& data );
  63. };
  64. }
  65. #endif // DATABASECOLLECTION_H