PageRenderTime 69ms CodeModel.GetById 25ms RepoModel.GetById 9ms app.codeStats 0ms

/src/libtomahawk/playlist/treemodelitem.h

http://github.com/tomahawk-player/tomahawk
C Header | 80 lines | 47 code | 16 blank | 17 comment | 0 complexity | f5af959517a9fe67c3d7aea4d891d9b6 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, GPL-3.0, GPL-2.0
  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 TREEMODELITEM_H
  19. #define TREEMODELITEM_H
  20. #include <QAbstractItemModel>
  21. #include <QHash>
  22. #include <QPersistentModelIndex>
  23. #include <QPixmap>
  24. #include "typedefs.h"
  25. #include "dllmacro.h"
  26. class DLLEXPORT TreeModelItem : public QObject
  27. {
  28. Q_OBJECT
  29. public:
  30. ~TreeModelItem();
  31. explicit TreeModelItem( TreeModelItem* parent = 0, QAbstractItemModel* model = 0 );
  32. explicit TreeModelItem( const Tomahawk::artist_ptr& artist, TreeModelItem* parent = 0, int row = -1 );
  33. explicit TreeModelItem( const Tomahawk::album_ptr& album, TreeModelItem* parent = 0, int row = -1 );
  34. explicit TreeModelItem( const Tomahawk::result_ptr& result, TreeModelItem* parent = 0, int row = -1 );
  35. explicit TreeModelItem( const Tomahawk::query_ptr& query, TreeModelItem* parent = 0, int row = -1 );
  36. const Tomahawk::artist_ptr& artist() const { return m_artist; };
  37. const Tomahawk::album_ptr& album() const { return m_album; };
  38. const Tomahawk::query_ptr& query() const { return m_query; };
  39. const Tomahawk::result_ptr& result() const;
  40. bool isPlaying() { return m_isPlaying; }
  41. void setIsPlaying( bool b ) { m_isPlaying = b; emit dataChanged(); }
  42. QString name() const;
  43. QString artistName() const;
  44. QString albumName() const;
  45. TreeModelItem* parent;
  46. QList<TreeModelItem*> children;
  47. QHash<QString, TreeModelItem*> hash;
  48. int childCount;
  49. QPersistentModelIndex index;
  50. QAbstractItemModel* model;
  51. bool toberemoved;
  52. bool fetchingMore;
  53. signals:
  54. void dataChanged();
  55. private slots:
  56. void onResultsChanged();
  57. private:
  58. Tomahawk::artist_ptr m_artist;
  59. Tomahawk::album_ptr m_album;
  60. Tomahawk::result_ptr m_result;
  61. Tomahawk::query_ptr m_query;
  62. bool m_isPlaying;
  63. };
  64. #endif // TREEMODELITEM_H