mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-04 01:42:44 +00:00
Add music library page
This commit is contained in:
parent
0c0b91dc4b
commit
dc9c3ea1b8
11 changed files with 284 additions and 102 deletions
|
@ -253,6 +253,8 @@ extern template void setRequestLimit(Loader::GetPublicUsersParams ¶ms, int l
|
|||
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 QList<DTO::UserDto> extractRecords(const QList<DTO::UserDto> &result);
|
||||
extern template int extractTotalRecordCount(const QList<DTO::UserDto> &result);
|
||||
|
|
|
@ -290,6 +290,42 @@ public:
|
|||
FWDPROP(QString, seriesId, SeriesId)
|
||||
};
|
||||
|
||||
using AlbumArtistLoaderBase = AbstractUserParameterLoader<Model::Item, DTO::BaseItemDto, DTO::BaseItemDtoQueryResult, Jellyfin::Loader::GetAlbumArtistsParams>;
|
||||
class AlbumArtistLoader : public AlbumArtistLoaderBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AlbumArtistLoader(QObject *parent = nullptr);
|
||||
|
||||
FWDLISTPROP(Jellyfin::DTO::ImageTypeClass::Value, enableImageTypes, EnableImageTypes);
|
||||
FWDPROP(bool, enableImages, EnableImages)
|
||||
FWDPROP(bool, enableTotalRecordCount, EnableTotalRecordCount)
|
||||
FWDPROP(bool, enableUserData, EnableUserData)
|
||||
FWDPROP(QStringList, excludeItemTypes, ExcludeItemTypes)
|
||||
FWDLISTPROP(Jellyfin::DTO::ItemFieldsClass::Value, fields, Fields)
|
||||
FWDLISTPROP(Jellyfin::DTO::ItemFilterClass::Value, filters, Filters)
|
||||
FWDPROP(QStringList, genreIds, GenreIds)
|
||||
FWDPROP(QStringList, genres, Genres)
|
||||
FWDPROP(qint32, imageTypeLimit, ImageTypeLimit)
|
||||
FWDPROP(QStringList, includeItemTypes, IncludeItemTypes)
|
||||
FWDPROP(bool, isFavorite, IsFavorite)
|
||||
FWDPROP(int, limit, Limit)
|
||||
FWDPROP(QStringList, mediaTypes, MediaTypes)
|
||||
FWDPROP(double, minCommunityRating, MinCommunityRating)
|
||||
FWDPROP(QString, nameLessThan, NameLessThan)
|
||||
FWDPROP(QString, nameStartsWith, NameStartsWith)
|
||||
FWDPROP(QString, nameStartsWithOrGreater, NameStartsWithOrGreater)
|
||||
FWDPROP(QStringList, officialRatings, OfficialRatings)
|
||||
FWDPROP(QString, parentId, ParentId)
|
||||
FWDPROP(QStringList, personIds, PersonIds)
|
||||
FWDPROP(QStringList, personTypes, PersonTypes)
|
||||
FWDPROP(QString, searchTerm, SearchTerm)
|
||||
FWDPROP(int, startIndex, StartIndex)
|
||||
FWDPROP(QStringList, studioIds, StudioIds)
|
||||
FWDPROP(QStringList, studios, Studios)
|
||||
FWDPROP(QStringList, tags, Tags)
|
||||
FWDPROP(QString, userId, UserId)
|
||||
FWDLISTPROP(int, years, Years);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Base class for each model that works with items.
|
||||
|
|
|
@ -184,6 +184,16 @@ bool setRequestStartIndex(Loader::GetNextUpParams ¶ms, int offset) {
|
|||
return true;
|
||||
}
|
||||
|
||||
template<>
|
||||
void setRequestLimit(Loader::GetAlbumArtistsParams ¶ms, int limit) {
|
||||
params.setLimit(limit);
|
||||
}
|
||||
template<>
|
||||
bool setRequestStartIndex(Loader::GetAlbumArtistsParams ¶ms, int offset) {
|
||||
params.setStartIndex(offset);
|
||||
return true;
|
||||
}
|
||||
|
||||
template<>
|
||||
QList<DTO::UserDto> extractRecords(const QList<DTO::UserDto> &result) {
|
||||
return result;
|
||||
|
|
|
@ -77,6 +77,7 @@ void JellyfinPlugin::registerTypes(const char *uri) {
|
|||
qmlRegisterType<ViewModel::ShowEpisodesLoader>(uri, 1, 0, "ShowEpisodesLoader");
|
||||
qmlRegisterType<ViewModel::NextUpLoader>(uri, 1, 0, "NextUpLoader");
|
||||
qmlRegisterType<ViewModel::PublicUsersLoader>(uri, 1, 0, "PublicUsersLoader");
|
||||
qmlRegisterType<ViewModel::AlbumArtistLoader>(uri, 1, 0, "AlbumArtistLoader");
|
||||
|
||||
// Enumerations
|
||||
qmlRegisterUncreatableType<Jellyfin::DTO::GeneralCommandTypeClass>(uri, 1, 0, "GeneralCommandType", "Is an enum");
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
#include "JellyfinQt/viewmodel/itemmodel.h"
|
||||
|
||||
#include "JellyfinQt/loader/http/artists.h"
|
||||
#include "JellyfinQt/loader/http/items.h"
|
||||
#include "JellyfinQt/loader/http/userlibrary.h"
|
||||
#include "JellyfinQt/loader/http/userviews.h"
|
||||
|
@ -57,6 +58,9 @@ ShowEpisodesLoader::ShowEpisodesLoader(QObject *parent)
|
|||
NextUpLoader::NextUpLoader(QObject *parent)
|
||||
: NextUpLoaderBase(new Jellyfin::Loader::HTTP::GetNextUpLoader(), parent) {}
|
||||
|
||||
AlbumArtistLoader::AlbumArtistLoader(QObject *parent)
|
||||
: AlbumArtistLoaderBase(new Jellyfin::Loader::HTTP::GetAlbumArtistsLoader(), parent) {}
|
||||
|
||||
ItemModel::ItemModel(QObject *parent)
|
||||
: ApiModel<Model::Item>(parent) {
|
||||
connect(this, &QAbstractItemModel::rowsInserted, this, &ItemModel::onInsertItems);
|
||||
|
@ -128,7 +132,7 @@ QSharedPointer<Model::Item> ItemModel::itemAt(int index) {
|
|||
|
||||
void ItemModel::onInsertItems(const QModelIndex &parent, int start, int end) {
|
||||
if (parent.isValid()) return;
|
||||
qDebug() << "Connecting " << (end - start + 1) << "items!";
|
||||
//qDebug() << "Connecting " << (end - start + 1) << "items!";
|
||||
for (int i = start; i <= end; i++) {
|
||||
connect(itemAt(i).data(), &Model::Item::userDataChanged, this, &ItemModel::onUserDataUpdated);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue