PageRenderTime 185ms CodeModel.GetById 56ms app.highlight 9ms RepoModel.GetById 47ms app.codeStats 0ms

/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
 19#ifndef COLLECTION_ITEM_H
 20#define COLLECTION_ITEM_H
 21
 22#include "sourcetreeitem.h"
 23
 24class TemporaryPageItem;
 25class GenericPageItem;
 26class CategoryItem;
 27
 28namespace Tomahawk
 29{
 30    class ViewPage;
 31}
 32
 33class CollectionItem : public SourceTreeItem
 34{
 35    Q_OBJECT
 36public:
 37    CollectionItem( SourcesModel* model, SourceTreeItem* parent, const Tomahawk::source_ptr& source );
 38
 39    virtual QString text() const;
 40    virtual void activate();
 41    virtual QIcon icon() const;
 42    virtual int peerSortValue() const;
 43    virtual int IDValue() const;
 44
 45    virtual bool localLatchedOn() const;
 46
 47    Tomahawk::source_ptr source() const;
 48
 49    CategoryItem* stationsCategory() const { return m_stations; }
 50    CategoryItem* playlistsCategory() const { return m_playlists; }
 51    void setStationsCategory( CategoryItem* item ) { m_stations = item; }
 52    void setPlaylistsCategory( CategoryItem* item ) { m_playlists = item; }
 53
 54private slots:
 55    void onPlaylistsAdded( const QList<Tomahawk::playlist_ptr>& playlists );
 56    void onPlaylistDeleted( const Tomahawk::playlist_ptr& playlists );
 57    void onAutoPlaylistsAdded( const QList<Tomahawk::dynplaylist_ptr>& playlists );
 58    void onAutoPlaylistDeleted( const Tomahawk::dynplaylist_ptr& playlists );
 59    void onStationsAdded( const QList<Tomahawk::dynplaylist_ptr>& stations );
 60    void onStationDeleted( const Tomahawk::dynplaylist_ptr& stations );
 61
 62    void latchedOn( const Tomahawk::source_ptr&, const Tomahawk::source_ptr& );
 63    void latchedOff( const Tomahawk::source_ptr&, const Tomahawk::source_ptr& );
 64
 65    void requestExpanding();
 66
 67    void tempPageActivated( Tomahawk::ViewPage* );
 68    void temporaryPageDestroyed();
 69
 70    Tomahawk::ViewPage* sourceInfoClicked();
 71    Tomahawk::ViewPage* getSourceInfoPage() const;
 72
 73    Tomahawk::ViewPage* coolPlaylistsClicked();
 74    Tomahawk::ViewPage* getCoolPlaylistsPage() const;
 75
 76    Tomahawk::ViewPage* lovedTracksClicked();
 77    Tomahawk::ViewPage* getLovedTracksPage() const;
 78
 79private:
 80    void playlistsAddedInternal( SourceTreeItem* parent, const QList< Tomahawk::dynplaylist_ptr >& playlists );
 81    template< typename T >
 82    void playlistDeletedInternal( SourceTreeItem* parent, const T& playlists );
 83
 84    Tomahawk::source_ptr m_source;
 85    QPixmap m_superCol, m_defaultAvatar;
 86    CategoryItem* m_playlists;
 87    CategoryItem* m_stations;
 88
 89    bool m_latchedOn;
 90    Tomahawk::source_ptr m_latchedOnTo;
 91
 92    QList< TemporaryPageItem* > m_tempItems;
 93    GenericPageItem* m_sourceInfoItem;
 94    GenericPageItem* m_coolPlaylistsItem;
 95    GenericPageItem* m_lovedTracksItem;
 96
 97    Tomahawk::ViewPage* m_sourceInfoPage;
 98    Tomahawk::ViewPage* m_coolPlaylistsPage;
 99    Tomahawk::ViewPage* m_lovedTracksPage;
100    Tomahawk::ViewPage* m_whatsHotPage;
101};
102
103
104#endif