Jellyfin Qt
QML Library for interacting with the Jellyfin multimedia server
Loading...
Searching...
No Matches
usermodel.h
Go to the documentation of this file.
1/*
2 * Sailfin: a Jellyfin client written using Qt
3 * Copyright (C) 2021 Chris Josten and the Sailfin Contributors.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#ifndef JELLYFIN_VIEWMODEL_USERMODEL_H
20#define JELLYFIN_VIEWMODEL_USERMODEL_H
21
22#include <QAbstractListModel>
23#include <QByteArray>
24#include <QHash>
25
26#include "../loader/http/user.h"
28#include "../model/user.h"
29#include "../apimodel.h"
30#include "propertyhelper.h"
31
32
33namespace Jellyfin {
34namespace ViewModel {
35
36// Jellyfin Forward Read/Write Property
37#define FWDPROP(type, propName, propSetName) JF_FWD_RW_PROP(type, propName, propSetName, this->m_parameters)
38
39class UserModel : public ApiModel<Model::User> {
40 Q_OBJECT
41public:
42 enum RoleNames {
43 userId = Qt::UserRole + 1,
47 };
48
49 explicit UserModel (QObject *parent = nullptr);
50
51 virtual QHash<int, QByteArray> roleNames() const override {
52 return {
53 { RoleNames::userId, "userId" },
54 { RoleNames::name, "name" },
55 { RoleNames::hasPassword, "hasPassword" },
56 { RoleNames::primaryImageTag, "primaryImageTag" }
57 };
58 }
59 QVariant data(const QModelIndex &index, int role) const override;
60};
61
64 Q_OBJECT
65public:
66 explicit PublicUsersLoader(QObject *parent = nullptr);
67 bool canReload() const override;
68};
69
70#undef FWDPROP
71
72} // NS ViewModel
73} // NS Jellyfin
74
75#endif // JELLYFIN_VIEWMODEL_USERMODEL_H
Abstract model for displaying collections.
Definition apimodel.h:405
Definition apimodel.h:282
Definition requesttypes.h:14514
PublicUsersLoader(QObject *parent=nullptr)
Definition usermodel.cpp:47
bool canReload() const override
Determines if this model is able to reload.
Definition usermodel.cpp:50
Definition usermodel.h:39
virtual QHash< int, QByteArray > roleNames() const override
Definition usermodel.h:51
UserModel(QObject *parent=nullptr)
Definition usermodel.cpp:24
RoleNames
Definition usermodel.h:42
@ name
Definition usermodel.h:44
@ userId
Definition usermodel.h:43
@ hasPassword
Definition usermodel.h:45
@ primaryImageTag
Definition usermodel.h:46
QVariant data(const QModelIndex &index, int role) const override
Definition usermodel.cpp:27