/src/libtomahawk/database/DatabaseCommand_AllAlbums.h

http://github.com/tomahawk-player/tomahawk · C Header · 89 lines · 53 code · 18 blank · 18 comment · 0 complexity · f2eb72bc745953ea61845bb4e0d8aef6 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 2013, Teo Mrnjavac <teo@kde.org>
  5. *
  6. * Tomahawk is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Tomahawk is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef DATABASECOMMAND_ALLALBUMS_H
  20. #define DATABASECOMMAND_ALLALBUMS_H
  21. #include <QObject>
  22. #include <QVariantMap>
  23. #include "Album.h"
  24. #include "Artist.h"
  25. #include "collection/Collection.h"
  26. #include "collection/AlbumsRequest.h"
  27. #include "Typedefs.h"
  28. #include "DatabaseCommand.h"
  29. #include "Database.h"
  30. #include "DatabaseCollection.h"
  31. #include "DllMacro.h"
  32. namespace Tomahawk
  33. {
  34. class DLLEXPORT DatabaseCommand_AllAlbums : public DatabaseCommand, public Tomahawk::AlbumsRequest
  35. {
  36. Q_OBJECT
  37. public:
  38. enum SortOrder {
  39. None = 0,
  40. ModificationTime = 1
  41. };
  42. explicit DatabaseCommand_AllAlbums( const Tomahawk::collection_ptr& collection = Tomahawk::collection_ptr(),
  43. const Tomahawk::artist_ptr& artist = Tomahawk::artist_ptr(),
  44. QObject* parent = 0 );
  45. virtual ~DatabaseCommand_AllAlbums();
  46. virtual void exec( DatabaseImpl* );
  47. virtual bool doesMutates() const { return false; }
  48. virtual QString commandname() const { return "allalbums"; }
  49. virtual void enqueue() { Database::instance()->enqueue( Tomahawk::dbcmd_ptr( this ) ); }
  50. Tomahawk::collection_ptr collection() const { return m_collection; }
  51. void execForCollection( DatabaseImpl* );
  52. void execForArtist( DatabaseImpl* );
  53. void setArtist( const Tomahawk::artist_ptr& artist );
  54. void setLimit( unsigned int amount ) { m_amount = amount; }
  55. void setSortOrder( DatabaseCommand_AllAlbums::SortOrder order ) { m_sortOrder = order; }
  56. void setSortDescending( bool descending ) { m_sortDescending = descending; }
  57. void setFilter( const QString& filter ) { m_filter = filter; }
  58. signals:
  59. void albums( const QList<Tomahawk::album_ptr>&, const QVariant& data );
  60. void albums( const QList<Tomahawk::album_ptr>& );
  61. void done();
  62. private:
  63. QSharedPointer< DatabaseCollection > m_collection;
  64. Tomahawk::artist_ptr m_artist;
  65. unsigned int m_amount;
  66. DatabaseCommand_AllAlbums::SortOrder m_sortOrder;
  67. bool m_sortDescending;
  68. QString m_filter;
  69. };
  70. }
  71. #endif // DATABASECOMMAND_ALLALBUMS_H