1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2025-09-05 18:22:46 +00:00

Add artist overview page

This commit is contained in:
Chris Josten 2022-07-28 19:55:33 +02:00 committed by Henk Kalkwater
parent 2398cc2997
commit 0c0b91dc4b
12 changed files with 399 additions and 23 deletions

View file

@ -28,6 +28,10 @@ BaseDetailPage {
id: pageRoot
property bool _collectionModelLoaded: false
property bool allowSort: true
property var modelStatus: collectionModel.loader.modelStatus
property string pageTitle: itemData.name
property alias loader: collectionModel.loader
J.ItemModel {
id: collectionModel
@ -35,13 +39,22 @@ BaseDetailPage {
id: collectionLoader
apiClient: appWindow.apiClient
parentId: itemData.jellyfinId
autoReload: itemData.jellyfinId.length > 0 && (pageRoot.status == PageStatus.Active || _collectionModelLoaded)
//onParentIdChanged: if (parentId.length > 0) reload()
sortBy: "SortName"
onStatusChanged: {
if (status === J.ModelStatus.Ready) {
_collectionModelLoaded = true
}
autoReload: itemData.jellyfinId.length > 0 && (pageRoot.status == PageStatus.Active || _collectionModelLoaded)
}
}
Binding {
target: collectionModel.loader
property: "autoReload"
value: (pageRoot.status == PageStatus.Active || pageRoot._collectionModelLoaded)
}
Connections {
target: collectionModel.loader
onStatusChanged: {
if (status === J.ModelStatus.Ready) {
_collectionModelLoaded = true
}
}
}
@ -56,16 +69,19 @@ BaseDetailPage {
visible: itemData.status !== J.ItemLoader.Error
header: PageHeader {
title: itemData.name || qsTr("Loading")
title: pageTitle || qsTr("Loading")
}
PullDownMenu {
id: downMenu
visible: visibleChildren.length > 0
MenuItem {
id: sortMenuItem
visible: pageRoot.allowSort
//: Menu item for selecting the sort order of a collection
text: qsTr("Sort by")
onClicked: pageStack.push(sortPageComponent)
}
busy: collectionLoader.status === J.ModelStatus.Loading
busy: modelStatus === J.ModelStatus.Loading
}
add: Transition {
id: trans
@ -169,9 +185,9 @@ BaseDetailPage {
onClicked: openMenu()
function apply(field, order) {
collectionLoader.sortBy = field;
collectionLoader.sortOrder = order;
collectionLoader.reload()
collectionModel.loader.sortBy = field;
collectionModel.loader.sortOrder = order;
collectionModel.loader.reload()
pageStack.pop()
}
}