/src/libtomahawk/database/DatabaseCommand_AllArtists.h

http://github.com/tomahawk-player/tomahawk · C Header · 78 lines · 45 code · 15 blank · 18 comment · 0 complexity · c562900033398fcf1d20ec7ce9a2773f 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_ALLARTISTS_H
  20. #define DATABASECOMMAND_ALLARTISTS_H
  21. #include <QObject>
  22. #include <QVariantMap>
  23. #include "Artist.h"
  24. #include "collection/ArtistsRequest.h"
  25. #include "collection/Collection.h"
  26. #include "Typedefs.h"
  27. #include "DatabaseCommand.h"
  28. #include "Database.h"
  29. #include "DatabaseCollection.h"
  30. #include "DllMacro.h"
  31. namespace Tomahawk
  32. {
  33. class DLLEXPORT DatabaseCommand_AllArtists : public DatabaseCommand, public Tomahawk::ArtistsRequest
  34. {
  35. Q_OBJECT
  36. public:
  37. enum SortOrder
  38. {
  39. None = 0,
  40. ModificationTime = 1
  41. };
  42. explicit DatabaseCommand_AllArtists( const Tomahawk::collection_ptr& collection = Tomahawk::collection_ptr(), QObject* parent = 0 );
  43. virtual ~DatabaseCommand_AllArtists();
  44. void exec( DatabaseImpl* ) Q_DECL_OVERRIDE;
  45. bool doesMutates() const Q_DECL_OVERRIDE { return false; }
  46. QString commandname() const Q_DECL_OVERRIDE { return "allartists"; }
  47. void enqueue() Q_DECL_OVERRIDE { Database::instance()->enqueue( Tomahawk::dbcmd_ptr( this ) ); }
  48. void setLimit( unsigned int amount ) { m_amount = amount; }
  49. void setSortOrder( DatabaseCommand_AllArtists::SortOrder order ) { m_sortOrder = order; }
  50. void setSortDescending( bool descending ) { m_sortDescending = descending; }
  51. void setFilter( const QString& filter ) override { m_filter = filter; }
  52. signals:
  53. void artists( const QList<Tomahawk::artist_ptr>& ) override;
  54. void done();
  55. private:
  56. QSharedPointer< DatabaseCollection > m_collection;
  57. unsigned int m_amount;
  58. DatabaseCommand_AllArtists::SortOrder m_sortOrder;
  59. bool m_sortDescending;
  60. QString m_filter;
  61. };
  62. }
  63. #endif // DATABASECOMMAND_ALLARTISTS_H