/src/libtomahawk/database/DatabaseCommand_CreateDynamicPlaylist.h

http://github.com/tomahawk-player/tomahawk · C Header · 70 lines · 32 code · 15 blank · 23 comment · 0 complexity · 8dbb03f64173e6b2db7e162b3f790218 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_CREATEDYNAMICPLAYLIST_H
  19. #define DATABASECOMMAND_CREATEDYNAMICPLAYLIST_H
  20. #include "Typedefs.h"
  21. #include "DatabaseCommand_CreatePlaylist.h"
  22. namespace Tomahawk
  23. {
  24. /**
  25. * Create a new dynamic playlist in the database, based on an existing playlist.
  26. *
  27. * If autoLoad is true, this playlist will *not* show up in the sidebar under the playlist tree, and
  28. * it will *not* be replicated to peers. It is useful to show a "specially crafted" playlist in other places
  29. */
  30. class DatabaseCommand_CreateDynamicPlaylist : public DatabaseCommand_CreatePlaylist
  31. {
  32. Q_OBJECT
  33. Q_PROPERTY( QVariant playlist READ playlistV WRITE setPlaylistV )
  34. public:
  35. explicit DatabaseCommand_CreateDynamicPlaylist( QObject* parent = 0 );
  36. explicit DatabaseCommand_CreateDynamicPlaylist( const Tomahawk::source_ptr& author, const Tomahawk::dynplaylist_ptr& playlist, bool autoLoad = true );
  37. virtual ~DatabaseCommand_CreateDynamicPlaylist();
  38. QString commandname() const { return "createdynamicplaylist"; }
  39. virtual void exec( DatabaseImpl* lib );
  40. virtual void postCommitHook();
  41. virtual bool doesMutates() const { return true; }
  42. virtual bool loggable() const { return m_autoLoad; }
  43. QVariant playlistV() const;
  44. void setPlaylistV( const QVariant& v )
  45. {
  46. m_v = v;
  47. }
  48. protected:
  49. virtual bool report() { return m_autoLoad; }
  50. private:
  51. Tomahawk::dynplaylist_ptr m_playlist;
  52. bool m_autoLoad;
  53. };
  54. }
  55. #endif // DATABASECOMMAND_CREATEDYNAMICPLAYLIST_H