/src/libtomahawk/database/DatabaseCommand_SetCollectionAttributes.h

http://github.com/tomahawk-player/tomahawk · C Header · 68 lines · 38 code · 12 blank · 18 comment · 0 complexity · 9bc0208b556a2e8631ed64aa15a0a789 MD5 · raw file

  1. /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
  2. *
  3. * Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
  4. *
  5. * Tomahawk is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * Tomahawk is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef DATABASECOMMAND_SETCOLLECTIONATTRIBUTES
  19. #define DATABASECOMMAND_SETCOLLECTIONATTRIBUTES
  20. #include "Typedefs.h"
  21. #include "DatabaseCommandLoggable.h"
  22. #include <QByteArray>
  23. namespace Tomahawk
  24. {
  25. class DatabaseCommand_SetCollectionAttributes : public DatabaseCommandLoggable
  26. {
  27. Q_OBJECT
  28. Q_PROPERTY( QByteArray id READ id WRITE setId )
  29. Q_PROPERTY( int type READ type WRITE setType )
  30. Q_PROPERTY( bool del READ del WRITE setDel )
  31. public:
  32. enum AttributeType {
  33. EchonestSongCatalog = 0,
  34. EchonestArtistCatalog = 1
  35. };
  36. DatabaseCommand_SetCollectionAttributes( AttributeType type, const QByteArray& id );
  37. // Delete all attributes for the source+type
  38. DatabaseCommand_SetCollectionAttributes( AttributeType type, bool toDelete );
  39. DatabaseCommand_SetCollectionAttributes() : m_delete( false ) {} // JSON
  40. virtual void exec( DatabaseImpl* lib );
  41. virtual bool doesMutates() const { return true; }
  42. virtual void postCommitHook();
  43. virtual QString commandname() const { return "setcollectionattributes"; }
  44. void setId( const QByteArray& id ) { m_id = id; }
  45. QByteArray id() const { return m_id; }
  46. void setType( int type ) { m_type = (AttributeType)type; }
  47. int type() const { return (int)m_type; }
  48. void setDel( bool del ) { m_delete = del; }
  49. bool del() const { return m_delete; }
  50. private:
  51. bool m_delete;
  52. AttributeType m_type;
  53. QByteArray m_id;
  54. };
  55. }
  56. #endif // DATABASECOMMAND_SETCOLLECTIONATTRIBUTES