/src/libtomahawk/playlist/trackmodelitem.h

http://github.com/tomahawk-player/tomahawk · C Header · 66 lines · 35 code · 14 blank · 17 comment · 0 complexity · 8c829e6daf576bcd2d3578efe891351d 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. *
  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 PLITEM_H
  19. #define PLITEM_H
  20. #include <QHash>
  21. #include <QVector>
  22. #include <QPersistentModelIndex>
  23. #include <QAbstractItemModel>
  24. #include "typedefs.h"
  25. #include "dllmacro.h"
  26. class DLLEXPORT TrackModelItem : public QObject
  27. {
  28. Q_OBJECT
  29. public:
  30. virtual ~TrackModelItem();
  31. explicit TrackModelItem( TrackModelItem* parent = 0, QAbstractItemModel* model = 0 );
  32. explicit TrackModelItem( const Tomahawk::query_ptr& query, TrackModelItem* parent = 0, int row = -1 );
  33. explicit TrackModelItem( const Tomahawk::plentry_ptr& entry, TrackModelItem* parent = 0, int row = -1 );
  34. const Tomahawk::plentry_ptr& entry() const;
  35. const Tomahawk::query_ptr& query() const;
  36. bool isPlaying() { return m_isPlaying; }
  37. void setIsPlaying( bool b ) { m_isPlaying = b; emit dataChanged(); }
  38. TrackModelItem* parent;
  39. QVector<TrackModelItem*> children;
  40. int childCount;
  41. QPersistentModelIndex index;
  42. QAbstractItemModel* model;
  43. bool toberemoved;
  44. signals:
  45. void dataChanged();
  46. private:
  47. void setupItem( const Tomahawk::query_ptr& query, TrackModelItem* parent, int row = -1 );
  48. Tomahawk::plentry_ptr m_entry;
  49. Tomahawk::query_ptr m_query;
  50. bool m_isPlaying;
  51. };
  52. #endif // PLITEM_H