/src/sourcetree/items/collectionitem.h

http://github.com/tomahawk-player/tomahawk · C Header · 104 lines · 64 code · 23 blank · 17 comment · 0 complexity · 58ccd34909edf05501b7aa39b36b1440 MD5 · raw file

  1. /*
  2. * Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. */
  18. #ifndef COLLECTION_ITEM_H
  19. #define COLLECTION_ITEM_H
  20. #include "sourcetreeitem.h"
  21. class TemporaryPageItem;
  22. class GenericPageItem;
  23. class CategoryItem;
  24. namespace Tomahawk
  25. {
  26. class ViewPage;
  27. }
  28. class CollectionItem : public SourceTreeItem
  29. {
  30. Q_OBJECT
  31. public:
  32. CollectionItem( SourcesModel* model, SourceTreeItem* parent, const Tomahawk::source_ptr& source );
  33. virtual QString text() const;
  34. virtual void activate();
  35. virtual QIcon icon() const;
  36. virtual int peerSortValue() const;
  37. virtual int IDValue() const;
  38. virtual bool localLatchedOn() const;
  39. Tomahawk::source_ptr source() const;
  40. CategoryItem* stationsCategory() const { return m_stations; }
  41. CategoryItem* playlistsCategory() const { return m_playlists; }
  42. void setStationsCategory( CategoryItem* item ) { m_stations = item; }
  43. void setPlaylistsCategory( CategoryItem* item ) { m_playlists = item; }
  44. private slots:
  45. void onPlaylistsAdded( const QList<Tomahawk::playlist_ptr>& playlists );
  46. void onPlaylistDeleted( const Tomahawk::playlist_ptr& playlists );
  47. void onAutoPlaylistsAdded( const QList<Tomahawk::dynplaylist_ptr>& playlists );
  48. void onAutoPlaylistDeleted( const Tomahawk::dynplaylist_ptr& playlists );
  49. void onStationsAdded( const QList<Tomahawk::dynplaylist_ptr>& stations );
  50. void onStationDeleted( const Tomahawk::dynplaylist_ptr& stations );
  51. void latchedOn( const Tomahawk::source_ptr&, const Tomahawk::source_ptr& );
  52. void latchedOff( const Tomahawk::source_ptr&, const Tomahawk::source_ptr& );
  53. void requestExpanding();
  54. void tempPageActivated( Tomahawk::ViewPage* );
  55. void temporaryPageDestroyed();
  56. Tomahawk::ViewPage* sourceInfoClicked();
  57. Tomahawk::ViewPage* getSourceInfoPage() const;
  58. Tomahawk::ViewPage* coolPlaylistsClicked();
  59. Tomahawk::ViewPage* getCoolPlaylistsPage() const;
  60. Tomahawk::ViewPage* lovedTracksClicked();
  61. Tomahawk::ViewPage* getLovedTracksPage() const;
  62. private:
  63. void playlistsAddedInternal( SourceTreeItem* parent, const QList< Tomahawk::dynplaylist_ptr >& playlists );
  64. template< typename T >
  65. void playlistDeletedInternal( SourceTreeItem* parent, const T& playlists );
  66. Tomahawk::source_ptr m_source;
  67. QPixmap m_superCol, m_defaultAvatar;
  68. CategoryItem* m_playlists;
  69. CategoryItem* m_stations;
  70. bool m_latchedOn;
  71. Tomahawk::source_ptr m_latchedOnTo;
  72. QList< TemporaryPageItem* > m_tempItems;
  73. GenericPageItem* m_sourceInfoItem;
  74. GenericPageItem* m_coolPlaylistsItem;
  75. GenericPageItem* m_lovedTracksItem;
  76. Tomahawk::ViewPage* m_sourceInfoPage;
  77. Tomahawk::ViewPage* m_coolPlaylistsPage;
  78. Tomahawk::ViewPage* m_lovedTracksPage;
  79. Tomahawk::ViewPage* m_whatsHotPage;
  80. };
  81. #endif