Jellyfin Qt
QML Library for interacting with the Jellyfin multimedia server
Toggle main menu visibility
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
"
27
#include "
../loader/requesttypes.h
"
28
#include "
../model/user.h
"
29
#include "
../apimodel.h
"
30
#include "
propertyhelper.h
"
31
32
33
namespace
Jellyfin
{
34
namespace
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
39
class
UserModel
:
public
ApiModel
<Model::User> {
40
Q_OBJECT
41
public
:
42
enum
RoleNames
{
43
userId
= Qt::UserRole + 1,
44
name
,
45
hasPassword
,
46
primaryImageTag
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
62
using
PublicUsersLoaderBase
=
LoaderModelLoader<Model::User, DTO::UserDto, QList<DTO::UserDto>
,
Jellyfin::Loader::GetPublicUsersParams
>;
63
class
PublicUsersLoader
:
public
PublicUsersLoaderBase
{
64
Q_OBJECT
65
public
:
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
apimodel.h
Jellyfin::ApiModel< Model::User >::ApiModel
ApiModel(QObject *parent=nullptr)
Definition
apimodel.h:434
Jellyfin::LoaderModelLoader
Definition
apimodel.h:282
Jellyfin::Loader::GetPublicUsersParams
Definition
requesttypes.h:13448
Jellyfin::ViewModel::PublicUsersLoader::PublicUsersLoader
PublicUsersLoader(QObject *parent=nullptr)
Definition
usermodel.cpp:47
Jellyfin::ViewModel::PublicUsersLoader::canReload
bool canReload() const override
Determines if this model is able to reload.
Definition
usermodel.cpp:50
Jellyfin::ViewModel::UserModel::roleNames
virtual QHash< int, QByteArray > roleNames() const override
Definition
usermodel.h:51
Jellyfin::ViewModel::UserModel::UserModel
UserModel(QObject *parent=nullptr)
Definition
usermodel.cpp:24
Jellyfin::ViewModel::UserModel::RoleNames
RoleNames
Definition
usermodel.h:42
Jellyfin::ViewModel::UserModel::name
@ name
Definition
usermodel.h:44
Jellyfin::ViewModel::UserModel::userId
@ userId
Definition
usermodel.h:43
Jellyfin::ViewModel::UserModel::hasPassword
@ hasPassword
Definition
usermodel.h:45
Jellyfin::ViewModel::UserModel::primaryImageTag
@ primaryImageTag
Definition
usermodel.h:46
Jellyfin::ViewModel::UserModel::data
QVariant data(const QModelIndex &index, int role) const override
Definition
usermodel.cpp:27
user.h
user.h
Jellyfin::ViewModel
Contains all types exposed to QML.
Jellyfin::ViewModel::PublicUsersLoaderBase
LoaderModelLoader< Model::User, DTO::UserDto, QList< DTO::UserDto >, Jellyfin::Loader::GetPublicUsersParams > PublicUsersLoaderBase
Definition
usermodel.h:62
Jellyfin
propertyhelper.h
requesttypes.h
core
include
JellyfinQt
viewmodel
usermodel.h
Generated by
1.17.0