mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-04 01:42:44 +00:00
sailfish: add LiveTvChannels page
This ocmmit adds a LiveTvChannels page for displaying the programs that are now playing. The section Live TV Channels on the main page now shows the TV channel list in order of the channel number. Additionally, it fixes an issue in ApiModel, where it would not reload when a new loader was assigned. This is now fixed and some code on pages that worked around this fix has been removed.
This commit is contained in:
parent
edcd3a93af
commit
57b67292fd
23 changed files with 344 additions and 54 deletions
|
@ -239,23 +239,33 @@ bool setRequestStartIndex(P ¶meters, int startIndex) {
|
|||
#ifndef JELLYFIN_APIMODEL_CPP
|
||||
extern template bool setRequestStartIndex(Loader::GetUserViewsParams ¶ms, int startIndex);
|
||||
extern template void setRequestLimit(Loader::GetUserViewsParams ¶ms, int limit);
|
||||
|
||||
extern template QList<DTO::BaseItemDto> extractRecords(const DTO::BaseItemDtoQueryResult &result);
|
||||
extern template int extractTotalRecordCount(const DTO::BaseItemDtoQueryResult &result);
|
||||
extern template QList<DTO::BaseItemDto> extractRecords(const QList<DTO::BaseItemDto> &result);
|
||||
extern template int extractTotalRecordCount(const QList<DTO::BaseItemDto> &result);
|
||||
|
||||
extern template void setRequestLimit(Loader::GetLatestMediaParams ¶ms, int limit);
|
||||
extern template bool setRequestStartIndex(Loader::GetLatestMediaParams ¶ms, int offset);
|
||||
|
||||
extern template void setRequestLimit(Loader::GetItemsByUserIdParams ¶ms, int limit);
|
||||
extern template bool setRequestStartIndex(Loader::GetItemsByUserIdParams ¶ms, int offset);
|
||||
|
||||
extern template void setRequestLimit(Loader::GetResumeItemsParams ¶ms, int limit);
|
||||
extern template bool setRequestStartIndex(Loader::GetResumeItemsParams ¶ms, int offset);
|
||||
|
||||
extern template void setRequestLimit(Loader::GetPublicUsersParams ¶ms, int limit);
|
||||
extern template bool setRequestStartIndex(Loader::GetPublicUsersParams ¶ms, int offset);
|
||||
|
||||
extern template void setRequestLimit(Loader::GetNextUpParams ¶ms, int limit);
|
||||
extern template bool setRequestStartIndex(Loader::GetNextUpParams ¶ms, int offset);
|
||||
|
||||
extern template void setRequestLimit(Loader::GetAlbumArtistsParams ¶ms, int limit);
|
||||
extern template bool setRequestStartIndex(Loader::GetAlbumArtistsParams ¶ms, int offset);
|
||||
|
||||
extern template void setRequestLimit(Loader::GetLiveTvChannelsParams ¶ms, int limit);
|
||||
extern template bool setRequestStartIndex(Loader::GetLiveTvChannelsParams ¶ms, int offset);
|
||||
|
||||
extern template QList<DTO::UserDto> extractRecords(const QList<DTO::UserDto> &result);
|
||||
extern template int extractTotalRecordCount(const QList<DTO::UserDto> &result);
|
||||
#endif
|
||||
|
@ -519,6 +529,7 @@ public:
|
|||
BaseApiModel::setLoader(newLoader);
|
||||
BaseApiModel::disconnectOldLoader(m_loader);
|
||||
m_loader = castedLoader;
|
||||
reload();
|
||||
} else {
|
||||
qWarning() << "Somehow set a BaseModelLoader on ApiModel instead of a ModelLoader<T>";
|
||||
}
|
||||
|
|
|
@ -178,9 +178,12 @@ public:
|
|||
Q_PROPERTY(int albumCount READ albumCount NOTIFY albumCountChanged)
|
||||
Q_PROPERTY(int artistCount READ artistCount NOTIFY artistCountChanged)
|
||||
Q_PROPERTY(int musicVideoCount READ musicVideoCount NOTIFY musicVideoCountChanged)
|
||||
Q_PROPERTY(QString mediaType READ mediaType READ mediaType NOTIFY mediaTypeChanged)
|
||||
Q_PROPERTY(QString mediaType READ mediaType NOTIFY mediaTypeChanged)
|
||||
Q_PROPERTY(QDateTime endDate READ endDate NOTIFY endDateChanged)
|
||||
Q_PROPERTY(QDateTime startDate READ startDate NOTIFY startDateChanged)
|
||||
Q_PROPERTY(int width READ width NOTIFY widthChanged)
|
||||
Q_PROPERTY(int height READ height NOTIFY heightChanged)
|
||||
Q_PROPERTY(Jellyfin::ViewModel::Item *currentProgram READ currentProgram NOTIFY currentProgramChanged)
|
||||
|
||||
QString jellyfinId() const { return m_data->jellyfinId(); }
|
||||
QString name() const { return m_data->name(); }
|
||||
|
@ -225,6 +228,9 @@ public:
|
|||
QStringList backdropImageTags() const { return m_data->backdropImageTags(); }
|
||||
QJsonObject imageBlurHashes() const { return m_data->imageBlurHashes(); }
|
||||
QString mediaType() const { return m_data->mediaType(); }
|
||||
QDateTime endDate() const { return m_data->endDate(); }
|
||||
QDateTime startDate() const { return m_data->startDate(); }
|
||||
Item *currentProgram() const { return m_currentProgram; }
|
||||
|
||||
int trailerCount() const { return m_data->trailerCount().value_or(0); }
|
||||
int movieCount() const { return m_data->movieCount().value_or(0); }
|
||||
|
@ -308,8 +314,11 @@ signals:
|
|||
void artistCountChanged(int newArtistCount);
|
||||
void musicVideoCountChanged(int newMusicVideoCount);
|
||||
void mediaTypeChanged(const QString &newMediaType);
|
||||
void endDateChanged();
|
||||
void startDateChanged();
|
||||
void widthChanged(int newWidth);
|
||||
void heightChanged(int newHeight);
|
||||
void currentProgramChanged();
|
||||
protected:
|
||||
void setUserData(DTO::UserItemDataDto &newData);
|
||||
void setUserData(QSharedPointer<DTO::UserItemDataDto> newData);
|
||||
|
@ -322,6 +331,7 @@ protected:
|
|||
QObjectList m_videoStreams;
|
||||
QObjectList m_subtitleStreams;
|
||||
QObjectList m_artistItems;
|
||||
Item *m_currentProgram = nullptr;
|
||||
private slots:
|
||||
void onUserDataChanged(const DTO::UserItemDataDto &userData);
|
||||
};
|
||||
|
|
|
@ -327,6 +327,32 @@ public:
|
|||
FWDLISTPROP(int, years, Years);
|
||||
};
|
||||
|
||||
using LiveTvChannelsLoaderBase = AbstractUserParameterLoader<Model::Item, DTO::BaseItemDto, DTO::BaseItemDtoQueryResult, Jellyfin::Loader::GetLiveTvChannelsParams>;
|
||||
class LiveTvChannelsLoader : public LiveTvChannelsLoaderBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LiveTvChannelsLoader(QObject *parent = nullptr);
|
||||
|
||||
FWDPROP(Jellyfin::DTO::ChannelTypeClass::Value, type, Type)
|
||||
FWDPROP(bool, isMovie, IsMovie)
|
||||
FWDPROP(bool, isSeries, IsSeries)
|
||||
FWDPROP(bool, isNews, IsNews)
|
||||
FWDPROP(bool, isKids, IsKids)
|
||||
FWDPROP(bool, isSports, IsSports)
|
||||
FWDPROP(bool, isFavorite, IsFavorite)
|
||||
FWDPROP(bool, isLiked, IsLiked)
|
||||
FWDPROP(bool, isDisliked, IsDisliked)
|
||||
FWDPROP(bool, enableImages, EnableImages)
|
||||
FWDPROP(int, imageTypeLimit, ImageTypeLimit)
|
||||
FWDLISTPROP(Jellyfin::DTO::ImageTypeClass::Value, enableImageTypes, EnableImageTypes)
|
||||
FWDLISTPROP(Jellyfin::DTO::ItemFieldsClass::Value, fields, Fields)
|
||||
FWDPROP(bool, enableUserData, EnableUserData)
|
||||
FWDPROP(QStringList, sortBy, SortBy)
|
||||
FWDPROP(Jellyfin::DTO::SortOrderClass::Value, sortOrder, SortOrder)
|
||||
FWDPROP(bool, enableFavoriteSorting, EnableFavoriteSorting)
|
||||
FWDPROP(bool, addCurrentProgram, AddCurrentProgram)
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Base class for each model that works with items.
|
||||
*/
|
||||
|
@ -369,6 +395,10 @@ public:
|
|||
userDataLastPlayedDate,
|
||||
userDataPlayed,
|
||||
userDataKey,
|
||||
currentProgramName,
|
||||
currentProgramOverview,
|
||||
currentProgramStartDate,
|
||||
currentProgramEndDate,
|
||||
|
||||
jellyfinExtendModelAfterHere = Qt::UserRole + 300 // Should be enough for now
|
||||
};
|
||||
|
@ -410,6 +440,10 @@ public:
|
|||
JFRN(userDataLastPlayedDate),
|
||||
JFRN(userDataPlayed),
|
||||
JFRN(userDataKey),
|
||||
JFRN(currentProgramName),
|
||||
JFRN(currentProgramOverview),
|
||||
JFRN(currentProgramStartDate),
|
||||
JFRN(currentProgramEndDate),
|
||||
};
|
||||
}
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue