19#ifndef JELLYFIN_VIEWMODEL_ITEM_H
20#define JELLYFIN_VIEWMODEL_ITEM_H
23#include <QJsonDocument>
31#include <QQmlListProperty>
32#include <QSharedPointer>
61 void qqmlistproperty_qlist_append(QQmlListProperty<T> *prop, T *data) {
62 static_cast<QList<T> *
>(prop->data())->append(data);
66 void qqmlistproperty_qlist_clear(QQmlListProperty<T> *prop) {
67 static_cast<QList<T> *
>(prop->data())->clear();
71 T *qqmlistproperty_qlist_at(QQmlListProperty<T> *prop, qint32 idx) {
72 return &
static_cast<QList<T> *
>(prop->data())->at(idx);
76 void qqmlistproperty_qlist_count(QQmlListProperty<T> *prop) {
77 static_cast<QList<T> *
>(prop->data())->count();
83 return QQmlListProperty<T>(
object, list, &qqmlistproperty_qlist_append<T>, &qqmlistproperty_qlist_count<T>, &qqmlistproperty_qlist_at<T>, &qqmlistproperty_qlist_clear<T>);
92 explicit
NameGuidPair(QSharedPointer<DTO::
NameGuidPair> data = QSharedPointer<DTO::
NameGuidPair>::create(QStringLiteral("00000000000000000000000000000000")), QObject *parent =
nullptr);
94 QString
name()
const {
return m_data->name(); }
95 QString
jellyfinId()
const {
return m_data->jellyfinId(); }
101 QSharedPointer<DTO::NameGuidPair> m_data;
107 explicit Item(QObject *parent =
nullptr, QSharedPointer<Model::Item>
data = QSharedPointer<Model::Item>::create());
249 void setData(QSharedPointer<Model::Item> newData);
324 void setUserData(QSharedPointer<DTO::UserItemDataDto> newData);
339class ItemLoader :
public Loader<ViewModel::Item, DTO::BaseItemDto, Jellyfin::Loader::GetItemParams> {
343 explicit ItemLoader(QObject *parent =
nullptr);
354 void onApiClientChanged(
ApiClient *newApiClient);
356 void setUserId(
const QString &newUserId);
An Api client for Jellyfin. Handles requests and authentication.
Definition apiclient.h:90
Definition useritemdatadto.h:49
const QString & itemId() const
Item id.
Definition requesttypes.cpp:11292
virtual bool canReload() const override
Subclasses should implement this to determine if they can load data from the server.
Definition item.cpp:140
ItemLoader(QObject *parent=nullptr)
Definition item.cpp:118
QString itemId
Definition item.h:344
void itemIdChanged(const QString &newItemId) const
void setItemId(QString newItemId)
Definition item.cpp:147
QString seriesId
Definition item.h:155
int indexNumber
Definition item.h:143
QDateTime dateCreated() const
Definition item.h:195
int movieCount() const
Definition item.h:236
QSharedPointer< Model::Item > m_data
Definition item.h:327
void currentProgramChanged()
QString seasonId() const
Definition item.h:216
QString name() const
Definition item.h:189
void sourceTypeChanged(const QString &sourceType)
QString sourceType() const
Definition item.h:193
int childCount() const
Definition item.h:212
int width
Definition item.h:184
QObjectList subtitleStreams() const
Definition item.h:222
QObjectList audioStreams() const
Definition item.h:220
void videoStreamsChanged(QVariantList &newVideoStreams)
double primaryImageAspectRatio
Definition item.h:163
void premiereDateChanged(QDateTime newPremiereDate)
int episodeCount() const
Definition item.h:239
void preferredMetadataCountryCodeChanged(const QString &newPreferredMetadataCountryCode)
void imageBlurHashesChanged()
void widthChanged(int newWidth)
int songCount
Definition item.h:177
QString seriesId() const
Definition item.h:215
QString jellyfinId
Definition item.h:110
void userDataChanged(UserData *newUserData)
QString extraType
Definition item.h:119
QJsonObject imageBlurHashes() const
Definition item.h:229
int albumCount
Definition item.h:178
int seriesCount() const
Definition item.h:237
QString seasonId
Definition item.h:156
QDateTime startDate() const
Definition item.h:232
QList< QObject * > artistItems
Definition item.h:165
void albumArtistChanged(const QString &newAlbumArtist)
int artistCount() const
Definition item.h:242
QObjectList m_audioStreams
Definition item.h:330
int episodeCount
Definition item.h:176
QString seriesName() const
Definition item.h:214
bool isFolder
Definition item.h:145
void backdropImageTagsChanged()
void hasSubtitlesChanged(bool newHasSubtitles)
QString serverId
Definition item.h:113
QString originalTitle
Definition item.h:112
void trailerCountChanged(int newTrailerCount)
QJsonObject imageTags() const
Definition item.h:227
QString seriesName
Definition item.h:154
void indexNumberChanged(int newIndexNumber)
void movieCountChanged(int newMovieCount)
void setData(QSharedPointer< Model::Item > newData)
Definition item.cpp:40
int width() const
Definition item.h:245
QObjectList m_videoStreams
Definition item.h:331
bool isFolder() const
Definition item.h:206
void runTimeTicksChanged(qint64 newRunTimeTicks)
void artistsChanged(const QStringList &newArtists)
void airsBeforeEpisodeNumberChanged(int newAirsAfterEpisodeNumber)
int airsBeforeEpisodeNumber
Definition item.h:122
QList< QObject * > audioStreams
Definition item.h:160
void supportsSyncChanged(bool newSupportsSync)
QString collectionType() const
Definition item.h:226
QString sourceType
Definition item.h:115
int programCount
Definition item.h:175
void nameChanged(const QString &newName)
int programCount() const
Definition item.h:238
int airsBeforeEpisodeNumber() const
Definition item.h:200
QStringList parentBackdropImageTags() const
Definition item.h:209
QStringList backdropImageTags() const
Definition item.h:228
void subtitleStreamsChanged(QVariantList &newSubtitleStreams)
int indexNumberEnd
Definition item.h:144
void forcedSortNameChanged(const QString &newForcedSortName)
QSharedPointer< Model::Item > data() const
Definition item.h:248
void seriesCountChanged(int newSeriesCount)
QString playlistItemId() const
Definition item.h:194
Item * currentProgram() const
Definition item.h:233
void artistItemsChanged()
QString overview() const
Definition item.h:202
QDateTime startDate
Definition item.h:183
void parentBackdropImageTagsChanged()
int airsBeforeSeasonNumber
Definition item.h:120
void setUserData(DTO::UserItemDataDto &newData)
Definition item.cpp:98
QString mediaType() const
Definition item.h:230
void containerChanged(const QString &newContainer)
int indexNumberEnd() const
Definition item.h:205
QJsonObject imageTags
Definition item.h:169
void songCountChanged(int newSongCount)
void overviewChanged(const QString &newOverview)
int childCount
Definition item.h:151
int airsBeforeSeasonNumber() const
Definition item.h:198
Jellyfin::ViewModel::Item * currentProgram
Definition item.h:186
int airsAfterSeasonNumber() const
Definition item.h:199
QString parentBackdropItemId() const
Definition item.h:208
void programCountChanged(int newProgramCount)
void serverIdChanged(const QString &newServerId)
QString seasonName
Definition item.h:157
QString parentBackdropItemId
Definition item.h:147
void dateLastMediaAddedChanged(QDateTime newDateLastMediaAdded)
void playlistItemIdChanged(const QString &playlistItemIdChanged)
void criticRatingChanged(float newCriticRating)
void episodeCountChanged(int newEpisodeCount)
void isFolderChanged(bool newIsFolder)
QObjectList m_allMediaStreams
Definition item.h:329
QObjectList m_artistItems
Definition item.h:333
QString type
Definition item.h:146
int musicVideoCount() const
Definition item.h:243
QStringList artists
Definition item.h:164
void albumCountChanged(int newAlbumCount)
qint64 runTimeTicks
Definition item.h:140
void heightChanged(int newHeight)
QString overview
Definition item.h:141
int artistCount
Definition item.h:179
QStringList backdropImageTags
Definition item.h:170
bool canDeleteChanged(bool newCanDelete)
QString type() const
Definition item.h:207
QString seasonName() const
Definition item.h:217
void etagChanged(const QString &newEtag)
void seasonIdChanged(const QString &newSeasonId)
Item(QObject *parent=nullptr, QSharedPointer< Model::Item > data=QSharedPointer< Model::Item >::create())
Definition item.cpp:33
int seriesCount
Definition item.h:174
void seriesIdChanged(const QString &newSeriesId)
void jellyfinIdChanged(const QString &newId)
void airsAfterSeasonNumberChanged(int newAirsAfterSeasonNumber)
QString etag
Definition item.h:114
int movieCount
Definition item.h:173
void originalTitleChanged(const QString &newOriginalTitle)
QList< QObject * > artistItems() const
Definition item.h:225
void productionYearChanged(int newProductionYear)
QJsonObject imageBlurHashes
Definition item.h:171
void canDownloadChanged(bool newCanDownload)
void primaryImageAspectRatioChanged(double newPrimaryImageAspectRatio)
void extraTypeChanged(const QString &newExtraType)
QObjectList m_subtitleStreams
Definition item.h:332
void indexNumberEndChanged(int newIndexNumberEnd)
void sortNameChanged(const QString &newSortName)
void musicVideoCountChanged(int newMusicVideoCount)
QStringList parentBackdropImageTags
Definition item.h:148
QList< QObject * > subtitleStreams
Definition item.h:162
QList< QObject * > videoStreams
Definition item.h:161
int trailerCount
Definition item.h:172
QString mediaType
Definition item.h:181
UserData * m_userData
Definition item.h:328
void recursiveItemCountChanged(int newRecursiveItemCount)
UserData * userData() const
Definition item.h:210
void collectionTypeChanged()
int height
Definition item.h:185
QString etag() const
Definition item.h:192
int musicVideoCount
Definition item.h:180
qint64 runTimeTicks() const
Definition item.h:201
QString extraType() const
Definition item.h:197
void preferredMetadataLanguageChanged(const QString &newPreferredMetadataLanguage)
void mediaTypeChanged(const QString &newMediaType)
void dateCreatedChanged(QDateTime newDateCreatedChanged)
int airsAfterSeasonNumber
Definition item.h:121
int songCount() const
Definition item.h:240
void childCountChanged(int newChildCount)
QList< QObject * > mediaStreams
Definition item.h:159
void artistCountChanged(int newArtistCount)
int height() const
Definition item.h:246
QDateTime dateLastMediaAdded
Definition item.h:118
double primaryImageAspectRatio() const
Definition item.h:223
QDateTime dateLastMediaAdded() const
Definition item.h:196
QString collectionType
Definition item.h:166
QString playlistItemId
Definition item.h:116
void productionLocationsChanged(QStringList newProductionLocations)
int indexNumber() const
Definition item.h:204
QString name
Definition item.h:111
int recursiveItemCount() const
Definition item.h:211
void seriesNameChanged(const QString &newSeriesName)
void audioStreamsChanged(QVariantList &newAudioStreams)
Jellyfin::ViewModel::UserData * userData
Definition item.h:149
void updateMediaStreams()
Definition item.cpp:66
void mediaStreamsChanged(QVariantList &newMediaStreams)
QString originalTitle() const
Definition item.h:190
QObjectList videoStreams() const
Definition item.h:221
QObjectList mediaStreams() const
Definition item.h:219
int albumCount() const
Definition item.h:241
QDateTime endDate
Definition item.h:182
int productionYear() const
Definition item.h:203
int trailerCount() const
Definition item.h:235
int productionYear
Definition item.h:142
void airsBeforeSeasonNumberChanged(int newAirsBeforeSeasonNumber)
QString albumArtist() const
Definition item.h:213
QDateTime dateCreated
Definition item.h:117
Item * m_currentProgram
Definition item.h:334
int recursiveItemCount
Definition item.h:150
void typeChanged(const QString &newType)
QStringList artists() const
Definition item.h:224
void parentBackdropItemIdChanged()
void seasonNameChanged(const QString &newSeasonName)
QString serverId() const
Definition item.h:191
QString albumArtist
Definition item.h:152
QDateTime endDate() const
Definition item.h:231
Jellyfin::Loader::GetItemParams m_parameters
Definition loader.h:177
void jellyfinIdChanged(const QString &newJellyfinId)
void nameChanged(const QString &newName)
QString jellyfinId
Definition item.h:90
QString jellyfinId() const
Definition item.h:95
QString name
Definition item.h:89
Definition mediaplayer2.h:20
UserItemDataDto UserData
Definition apiclient.h:58
Jellyfin::DTO::UserItemDataDto UserItemDataDto
Definition useritemdatadto.h:207
QQmlListProperty< T > qQmlListPropertyFromQList(QObject *object, QList< T > *list)
Definition item.h:82