1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2025-09-06 10:32:44 +00:00

Implemented collections + misc UI improvements

* There is a basic collection page, allowing the user to browse through
  collections. It has a sort function, that sort of works
* Item cards now show a bar indicating play time
* Item cards now have a black/white (depending on theme) shim, improving
  readability.
* The resume watching section now actually loads items
This commit is contained in:
Chris Josten 2020-09-27 16:54:45 +02:00
parent 5ea17070fe
commit 5d395ad7b6
15 changed files with 363 additions and 73 deletions

View file

@ -9,19 +9,13 @@ ApiModel::ApiModel(QString path, bool hasRecordResponse, bool addUserId, QObject
}
void ApiModel::reload() {
this->setStatus(Loading);
m_startIndex = 0;
load(RELOAD);
}
void ApiModel::load(LoadType type) {
qDebug() << (type == RELOAD ? "RELOAD" : "LOAD_MORE");
switch(type) {
case RELOAD:
this->setStatus(Loading);
break;
case LOAD_MORE:
this->setStatus(LoadingMore);
break;
}
if (m_apiClient == nullptr) {
qWarning() << "Please set the apiClient property before (re)loading";
return;
@ -187,6 +181,7 @@ bool ApiModel::canFetchMore(const QModelIndex &parent) const {
void ApiModel::fetchMore(const QModelIndex &parent) {
if (parent.isValid()) return;
this->setStatus(LoadingMore);
load(LOAD_MORE);
}
@ -200,6 +195,7 @@ void registerModels(const char *URI) {
qmlRegisterType<UserViewModel>(URI, 1, 0, "UserViewModel");
qmlRegisterType<UserItemModel>(URI, 1, 0, "UserItemModel");
qmlRegisterType<UserItemLatestModel>(URI, 1, 0, "UserItemLatestModel");
qmlRegisterType<UserItemResumeModel>(URI, 1, 0, "UserItemResumeModel");
qmlRegisterType<ShowSeasonsModel>(URI, 1, 0, "ShowSeasonsModel");
qmlRegisterType<ShowEpisodesModel>(URI, 1, 0, "ShowEpisodesModel");
}

View file

@ -195,7 +195,7 @@ protected:
QList<QString> m_fields;
QList<QString> m_imageTypes;
QList<QString> m_sortBy = {};
bool m_recursive;
bool m_recursive = false;
QHash<int, QByteArray> m_roles;
@ -218,13 +218,13 @@ private:
class PublicUserModel : public ApiModel {
public:
explicit PublicUserModel (QObject *parent = nullptr)
: ApiModel ("/users/public", "", false, parent) { }
: ApiModel ("/users/public", false, false, parent) { }
};
class UserViewModel : public ApiModel {
public:
explicit UserViewModel (QObject *parent = nullptr)
: ApiModel ("/Users/{{user}}/Views", "Items", false, parent) {}
: ApiModel ("/Users/{{user}}/Views", true, false, parent) {}
};
class UserItemModel : public ApiModel {
@ -232,6 +232,13 @@ public:
explicit UserItemModel (QObject *parent = nullptr)
: ApiModel ("/Users/{{user}}/Items", true, false, parent) {}
};
class UserItemResumeModel : public ApiModel {
public:
explicit UserItemResumeModel (QObject *parent = nullptr)
: ApiModel ("/Users/{{user}}/Items/Resume", true, false, parent) {}
};
class UserItemLatestModel : public ApiModel {
public:
explicit UserItemLatestModel (QObject *parent = nullptr)