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

« back to all changes in this revision

Viewing changes to src/libtomahawk/playlist/PlayableItem.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
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 
2
 *
 
3
 *   Copyright 2010-2012, 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
 
 
19
#ifndef PLAYABLEITEM_H
 
20
#define PLAYABLEITEM_H
 
21
 
 
22
#include <QAbstractItemModel>
 
23
#include <QHash>
 
24
#include <QPersistentModelIndex>
 
25
#include <QPixmap>
 
26
 
 
27
#include "Typedefs.h"
 
28
#include "DllMacro.h"
 
29
 
 
30
class DLLEXPORT PlayableItem : public QObject
 
31
{
 
32
Q_OBJECT
 
33
 
 
34
public:
 
35
    ~PlayableItem();
 
36
 
 
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 );
 
43
 
 
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;
 
49
 
 
50
    PlayableItem* parent() const { return m_parent; }
 
51
 
 
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; }
 
56
 
 
57
    QString name() const;
 
58
    QString artistName() const;
 
59
    QString albumName() const;
 
60
 
 
61
    QList<PlayableItem*> children;
 
62
 
 
63
    QPersistentModelIndex index;
 
64
 
 
65
signals:
 
66
    void dataChanged();
 
67
 
 
68
private slots:
 
69
    void onResultsChanged();
 
70
 
 
71
private:
 
72
    void init( PlayableItem* parent, int row = -1 );
 
73
 
 
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;
 
79
 
 
80
    PlayableItem* m_parent;
 
81
    bool m_fetchingMore;
 
82
    bool m_isPlaying;
 
83
};
 
84
 
 
85
#endif // PLAYABLEITEM_H