~ubuntu-branches/ubuntu/trusty/tomahawk/trusty-proposed

« back to all changes in this revision

Viewing changes to src/sourcetree/items/SourceItem.h

  • Committer: Package Import Robot
  • Author(s): Harald Sitter
  • Date: 2013-03-07 21:50:13 UTC
  • Revision ID: package-import@ubuntu.com-20130307215013-6gdjkdds7i9uenvs
Tags: upstream-0.6.0+dfsg
ImportĀ upstreamĀ versionĀ 0.6.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *    Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
 
3
 *    Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
 
4
 *
 
5
 *    This program 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 2 of the License, or
 
8
 *    (at your option) any later version.
 
9
 *
 
10
 *    This program 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 along
 
16
 *    with this program; if not, write to the Free Software Foundation, Inc.,
 
17
 *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
18
 */
 
19
 
 
20
#ifndef SOURCE_ITEM_H
 
21
#define SOURCE_ITEM_H
 
22
 
 
23
#include "SourceTreeItem.h"
 
24
 
 
25
class TemporaryPageItem;
 
26
class GenericPageItem;
 
27
class CategoryItem;
 
28
 
 
29
namespace Tomahawk
 
30
{
 
31
    class ViewPage;
 
32
}
 
33
 
 
34
class SourceItem : public SourceTreeItem
 
35
{
 
36
    Q_OBJECT
 
37
public:
 
38
    SourceItem( SourcesModel* model, SourceTreeItem* parent, const Tomahawk::source_ptr& source );
 
39
 
 
40
    virtual QString text() const;
 
41
    virtual QString tooltip() const;
 
42
    virtual QIcon icon() const;
 
43
    virtual QPixmap pixmap( const QSize& size = QSize( 0, 0 ) ) const;
 
44
    virtual int peerSortValue() const;
 
45
    virtual int IDValue() const;
 
46
 
 
47
    virtual bool localLatchedOn() const;
 
48
    virtual Tomahawk::PlaylistModes::LatchMode localLatchMode() const;
 
49
 
 
50
    Tomahawk::source_ptr source() const;
 
51
 
 
52
    CategoryItem* stationsCategory() const;
 
53
    CategoryItem* playlistsCategory() const;
 
54
    void setStationsCategory( CategoryItem* item );
 
55
    void setPlaylistsCategory( CategoryItem* item );
 
56
 
 
57
public slots:
 
58
    virtual void activate();
 
59
 
 
60
private slots:
 
61
    void onPlaylistsAdded( const QList<Tomahawk::playlist_ptr>& playlists );
 
62
    void onPlaylistDeleted( const Tomahawk::playlist_ptr& playlists );
 
63
    void onAutoPlaylistsAdded( const QList<Tomahawk::dynplaylist_ptr>& playlists );
 
64
    void onAutoPlaylistDeleted( const Tomahawk::dynplaylist_ptr& playlists );
 
65
    void onStationsAdded( const QList<Tomahawk::dynplaylist_ptr>& stations );
 
66
    void onStationDeleted( const Tomahawk::dynplaylist_ptr& stations );
 
67
 
 
68
    void latchedOn( const Tomahawk::source_ptr&, const Tomahawk::source_ptr& );
 
69
    void latchedOff( const Tomahawk::source_ptr&, const Tomahawk::source_ptr& );
 
70
    void latchModeChanged( Tomahawk::PlaylistModes::LatchMode mode );
 
71
 
 
72
    void requestExpanding();
 
73
 
 
74
    Tomahawk::ViewPage* sourceInfoClicked();
 
75
    Tomahawk::ViewPage* getSourceInfoPage() const;
 
76
 
 
77
    Tomahawk::ViewPage* collectionClicked();
 
78
    Tomahawk::ViewPage* getCollectionPage() const;
 
79
 
 
80
    Tomahawk::ViewPage* coolPlaylistsClicked();
 
81
    Tomahawk::ViewPage* getCoolPlaylistsPage() const;
 
82
 
 
83
    Tomahawk::ViewPage* latestAdditionsClicked();
 
84
    Tomahawk::ViewPage* getLatestAdditionsPage() const;
 
85
 
 
86
    Tomahawk::ViewPage* recentPlaysClicked();
 
87
    Tomahawk::ViewPage* getRecentPlaysPage() const;
 
88
 
 
89
private:
 
90
    void playlistsAddedInternal( SourceTreeItem* parent, const QList< Tomahawk::dynplaylist_ptr >& playlists );
 
91
    template< typename T >
 
92
    void playlistDeletedInternal( SourceTreeItem* parent, const T& playlists );
 
93
 
 
94
    Tomahawk::source_ptr m_source;
 
95
    CategoryItem* m_playlists;
 
96
    CategoryItem* m_stations;
 
97
 
 
98
    bool m_latchedOn;
 
99
    Tomahawk::source_ptr m_latchedOnTo;
 
100
 
 
101
    GenericPageItem* m_collectionItem;
 
102
    GenericPageItem* m_sourceInfoItem;
 
103
    GenericPageItem* m_coolPlaylistsItem;
 
104
    GenericPageItem* m_latestAdditionsItem;
 
105
    GenericPageItem* m_recentPlaysItem;
 
106
 
 
107
    Tomahawk::ViewPage* m_collectionPage;
 
108
    Tomahawk::ViewPage* m_sourceInfoPage;
 
109
    Tomahawk::ViewPage* m_coolPlaylistsPage;
 
110
    Tomahawk::ViewPage* m_latestAdditionsPage;
 
111
    Tomahawk::ViewPage* m_recentPlaysPage;
 
112
    Tomahawk::ViewPage* m_whatsHotPage;
 
113
};
 
114
 
 
115
 
 
116
#endif