PageRenderTime 170ms CodeModel.GetById 74ms app.highlight 17ms RepoModel.GetById 73ms app.codeStats 1ms

/src/libtomahawk/playlist/trackmodelitem.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 66 lines | 35 code | 14 blank | 17 comment | 0 complexity | 8c829e6daf576bcd2d3578efe891351d MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2010-2011, 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 PLITEM_H
20#define PLITEM_H
21
22#include <QHash>
23#include <QVector>
24#include <QPersistentModelIndex>
25#include <QAbstractItemModel>
26
27#include "typedefs.h"
28
29#include "dllmacro.h"
30
31class DLLEXPORT TrackModelItem : public QObject
32{
33Q_OBJECT
34
35public:
36    virtual ~TrackModelItem();
37
38    explicit TrackModelItem( TrackModelItem* parent = 0, QAbstractItemModel* model = 0 );
39    explicit TrackModelItem( const Tomahawk::query_ptr& query, TrackModelItem* parent = 0, int row = -1 );
40    explicit TrackModelItem( const Tomahawk::plentry_ptr& entry, TrackModelItem* parent = 0, int row = -1 );
41
42    const Tomahawk::plentry_ptr& entry() const;
43    const Tomahawk::query_ptr& query() const;
44
45    bool isPlaying() { return m_isPlaying; }
46    void setIsPlaying( bool b ) { m_isPlaying = b; emit dataChanged(); }
47
48    TrackModelItem* parent;
49    QVector<TrackModelItem*> children;
50    int childCount;
51    QPersistentModelIndex index;
52    QAbstractItemModel* model;
53    bool toberemoved;
54
55signals:
56    void dataChanged();
57
58private:
59    void setupItem( const Tomahawk::query_ptr& query, TrackModelItem* parent, int row = -1 );
60
61    Tomahawk::plentry_ptr m_entry;
62    Tomahawk::query_ptr m_query;
63    bool m_isPlaying;
64};
65
66#endif // PLITEM_H