From d6a1f431b4e71dda3ba2f630e1518968d7d4086b Mon Sep 17 00:00:00 2001 From: Chris Josten Date: Sat, 10 Oct 2020 16:26:08 +0200 Subject: [PATCH] Implement nextUp endpoint and UI * [UI] Added: The next up section now actually loads items --- core/include/jellyfinapimodel.h | 6 ++++++ core/src/jellyfinapimodel.cpp | 1 + sailfish/qml/pages/MainPage.qml | 15 +++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/core/include/jellyfinapimodel.h b/core/include/jellyfinapimodel.h index 6257ff3..1541524 100644 --- a/core/include/jellyfinapimodel.h +++ b/core/include/jellyfinapimodel.h @@ -292,6 +292,12 @@ public: : ItemModel ("/Users/{{user}}/Items/Latest", false, false, parent) {} }; +class ShowNextUpModel : public ItemModel { +public: + explicit ShowNextUpModel (QObject *parent = nullptr) + : ItemModel("/Shows/NextUp", true, true, parent) {} +}; + class ShowSeasonsModel : public ItemModel { public: explicit ShowSeasonsModel (QObject *parent = nullptr) diff --git a/core/src/jellyfinapimodel.cpp b/core/src/jellyfinapimodel.cpp index 6e1ae05..e93c2d8 100644 --- a/core/src/jellyfinapimodel.cpp +++ b/core/src/jellyfinapimodel.cpp @@ -249,6 +249,7 @@ void registerModels(const char *URI) { qmlRegisterType(URI, 1, 0, "UserItemModel"); qmlRegisterType(URI, 1, 0, "UserItemLatestModel"); qmlRegisterType(URI, 1, 0, "UserItemResumeModel"); + qmlRegisterType(URI, 1, 0, "ShowNextUpModel"); qmlRegisterType(URI, 1, 0, "ShowSeasonsModel"); qmlRegisterType(URI, 1, 0, "ShowEpisodesModel"); } diff --git a/sailfish/qml/pages/MainPage.qml b/sailfish/qml/pages/MainPage.qml index 21fef97..c99ddcc 100644 --- a/sailfish/qml/pages/MainPage.qml +++ b/sailfish/qml/pages/MainPage.qml @@ -87,6 +87,20 @@ Page { MoreSection { text: qsTr("Next up") clickable: false + busy: showNextUpModel.status == ApiModel.Loading + + Loader { + width: parent.width + sourceComponent: carrouselView + property alias itemModel: showNextUpModel + property string collectionType: "series" + + ShowNextUpModel { + id: showNextUpModel + apiClient: ApiClient + limit: 12 + } + } } UserViewModel { @@ -174,6 +188,7 @@ Page { _modelsLoaded = true; mediaLibraryModel.reload() userResumeModel.reload() + showNextUpModel.reload() } }