PageRenderTime 58ms CodeModel.GetById 47ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/src/GetNewStuffModel.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 64 lines | 35 code | 10 blank | 19 comment | 0 complexity | 89f6575bdc17a8abcccf1d26dfbfce14 MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2010-2011, Leo Franchi <lfranchi@kde.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 GETNEWSTUFFMODEL_H
20#define GETNEWSTUFFMODEL_H
21
22#include <QModelIndex>
23
24#include <attica/content.h>
25#include <QPixmap>
26
27class GetNewStuffModel: public QAbstractListModel
28{
29    Q_OBJECT
30public:
31    enum NewStuffRoles {
32        // DisplayRole is title
33        // DecorationRole is qicon for item
34        DownloadUrlRole = Qt::UserRole + 1,
35        RatingRole = Qt::UserRole + 2,
36        DownloadCounterRole = Qt::UserRole + 3,
37        VersionRole = Qt::UserRole + 4,
38        DescriptionRole = Qt::UserRole + 5,
39        TypeRole = Qt::UserRole + 6, // Category in attica-speak. What sort of item this is (resolver, etc).
40        AuthorRole = Qt::UserRole + 7,
41        StateRole = Qt::UserRole + 8,
42        UserHasRatedRole = Qt::UserRole + 9
43    };
44
45    enum Types {
46        ResolverType = 0,
47    };
48
49    explicit GetNewStuffModel( QObject* parent = 0 );
50    virtual ~GetNewStuffModel();
51
52    virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
53    virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
54    virtual bool setData( const QModelIndex &index, const QVariant &value, int role );
55
56private slots:
57    void resolversReloaded( const Attica::Content::List& );
58    void resolverStateChanged( const QString& resolverId );
59
60private:
61    Attica::Content::List m_contentList;
62};
63
64#endif // GETNEWSTUFFMODEL_H