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

WIP: HttpLoader seems to work, Model still borked

This commit is contained in:
Chris Josten 2021-03-28 04:00:00 +02:00
parent e421adf733
commit 729e343661
1412 changed files with 13967 additions and 33794 deletions

View file

@ -26,11 +26,18 @@ namespace Jellyfin {
namespace ViewModel {
UserViewsLoader::UserViewsLoader(QObject *parent)
: UserViewsLoaderBase(Loader::HTTP::GetUserViewsLoader(), parent) {}
: UserViewsLoaderBase(new Jellyfin::Loader::HTTP::GetUserViewsLoader(), parent) {
connect(this, &BaseModelLoader::apiClientChanged, this, &UserViewsLoader::apiClientChanged);
}
void UserViewsLoader::apiClientChanged(ApiClient *newApiClient) {
if (m_apiClient != nullptr) disconnect(m_apiClient, &ApiClient::userIdChanged, this, &UserViewsLoader::userIdChanged);
if (newApiClient != nullptr) connect(newApiClient, &ApiClient::userIdChanged, this, &UserViewsLoader::userIdChanged);
if (newApiClient != nullptr) {
connect(newApiClient, &ApiClient::userIdChanged, this, &UserViewsLoader::userIdChanged);
if (!newApiClient->userId().isNull()) {
m_parameters.setUserId(newApiClient->userId());
}
}
}
void UserViewsLoader::userIdChanged(const QString &newUserId) {
@ -47,6 +54,10 @@ void UserItemsLoader::userIdChanged(const QString &newUserId) {
autoReloadIfNeeded();
}
bool UserItemsLoader::canReload() const {
return BaseModelLoader::canReload() && !m_parameters.userId().isNull();
}
ItemModel::ItemModel(QObject *parent)
: ApiModel<Model::Item>(parent) { }