-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtraktpeoplemodel.h
46 lines (35 loc) · 1.28 KB
/
traktpeoplemodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef TRAKTPEOPLEMODEL_H
#define TRAKTPEOPLEMODEL_H
#include "traktmodel.h"
#include "traktperson.h"
#include "traktpeoplefiltermodel.h"
class TraktPeopleModel : public TraktModel<TraktPerson*>
{
Q_OBJECT
Q_PROPERTY(TraktPeopleFilterModel *cast READ cast CONSTANT)
Q_PROPERTY(TraktPeopleFilterModel *crew READ crew CONSTANT)
public:
enum Roles {
RoleName = Qt::DisplayRole,
RoleBiography = TraktModel::RoleImage + 1,
RoleBirthday,
RoleDeath,
RoleBirthplace,
RoleHomepage
};
explicit TraktPeopleModel(TraktIds *ids, QObject *parent = 0);
QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
TraktPerson *convertItem(const QVariantMap &item) Q_DECL_OVERRIDE;
Q_INVOKABLE TraktPerson *at(int i) const Q_DECL_OVERRIDE;
TraktPeopleFilterModel *cast();
TraktPeopleFilterModel *crew();
protected slots:
virtual void onReplyReceived(TraktReply *reply) Q_DECL_OVERRIDE;
private:
TraktRequest *buildRequest(TraktIds *ids) const;
void addItems(QList<TraktPerson*> &list, const QVariantList &items, const QString &type);
TraktPeopleFilterModel *m_cast;
TraktPeopleFilterModel *m_crew;
};
#endif // TRAKTPEOPLEMODEL_H