Jellyfin Qt
QML Library for interacting with the Jellyfin multimedia server
Loading...
Searching...
No Matches
item.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
20#ifndef JELLYFIN_MODEL_ITEM
21#define JELLYFIN_MODEL_ITEM
22
23#include <functional>
24#include <map>
25
26#include <QObject>
27#include <QList>
28
29#include "../dto/baseitemdto.h"
30#include "../support/loader.h"
31#include "../apiclient.h"
32
33namespace Jellyfin {
34namespace Model {
35
36class Item : public QObject, public DTO::BaseItemDto {
37 Q_OBJECT
38public:
39 using UserDataChangedCallback = std::function<void(DTO::UserItemDataDto)>;
49 Item(ApiClient *apiClient = nullptr, QObject *parent = nullptr);
50
56 Item(const DTO::BaseItemDto &data, ApiClient *apiClient = nullptr, QObject *parent = nullptr);
57 //virtual ~Item();
58
68 bool sameAs(const DTO::BaseItemDto &other);
69
70 void setApiClient(ApiClient *apiClient);
71
72signals:
73 void userDataChanged(const DTO::UserItemDataDto &newUserData);
74private:
75 ApiClient *m_apiClient = nullptr;
76 void updateUserData(const QString &itemId, const DTO::UserItemDataDto &userData);
77
78};
79
80}
81}
82
83#endif // JELLYFIN_MODEL_ITEM
An Api client for Jellyfin. Handles requests and authentication.
Definition apiclient.h:90
Definition baseitemdto.h:70
QSharedPointer< UserItemDataDto > userData() const
Definition baseitemdto.cpp:2036
Definition useritemdatadto.h:49
Definition item.h:36
void setApiClient(ApiClient *apiClient)
Definition item.cpp:54
bool sameAs(const DTO::BaseItemDto &other)
sameAs Returns true if this item represents the same item as other
Definition item.cpp:50
QSharedPointer< UserItemDataDto > userData() const
Definition baseitemdto.cpp:2036
Item(ApiClient *apiClient=nullptr, QObject *parent=nullptr)
Constructor that creates an empty item.
Definition item.cpp:26
std::function< void(DTO::UserItemDataDto)> UserDataChangedCallback
Definition item.h:39
void userDataChanged(const DTO::UserItemDataDto &newUserData)