1
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
3
* Copyright 2010-2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
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.
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.
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/>.
19
#ifndef PLAYABLEITEM_H
20
#define PLAYABLEITEM_H
22
#include <QAbstractItemModel>
24
#include <QPersistentModelIndex>
30
class DLLEXPORT PlayableItem : public QObject
37
explicit PlayableItem( PlayableItem* parent = 0 );
38
explicit PlayableItem( const Tomahawk::artist_ptr& artist, PlayableItem* parent = 0, int row = -1 );
39
explicit PlayableItem( const Tomahawk::album_ptr& album, PlayableItem* parent = 0, int row = -1 );
40
explicit PlayableItem( const Tomahawk::result_ptr& result, PlayableItem* parent = 0, int row = -1 );
41
explicit PlayableItem( const Tomahawk::query_ptr& query, PlayableItem* parent = 0, int row = -1 );
42
explicit PlayableItem( const Tomahawk::plentry_ptr& entry, PlayableItem* parent = 0, int row = -1 );
44
const Tomahawk::artist_ptr& artist() const { return m_artist; }
45
const Tomahawk::album_ptr& album() const { return m_album; }
46
const Tomahawk::query_ptr& query() const { return m_query; }
47
const Tomahawk::plentry_ptr& entry() const { return m_entry; }
48
const Tomahawk::result_ptr& result() const;
50
PlayableItem* parent() const { return m_parent; }
52
bool isPlaying() const { return m_isPlaying; }
53
void setIsPlaying( bool b ) { m_isPlaying = b; emit dataChanged(); }
54
bool fetchingMore() const { return m_fetchingMore; }
55
void setFetchingMore( bool b ) { m_fetchingMore = b; }
58
QString artistName() const;
59
QString albumName() const;
61
QList<PlayableItem*> children;
63
QPersistentModelIndex index;
69
void onResultsChanged();
72
void init( PlayableItem* parent, int row = -1 );
74
Tomahawk::artist_ptr m_artist;
75
Tomahawk::album_ptr m_album;
76
Tomahawk::result_ptr m_result;
77
Tomahawk::query_ptr m_query;
78
Tomahawk::plentry_ptr m_entry;
80
PlayableItem* m_parent;
85
#endif // PLAYABLEITEM_H