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

Minor UI tweaks

This commit is contained in:
Chris Josten 2021-02-12 03:32:28 +01:00
parent 382af84846
commit eda4994aac
9 changed files with 139 additions and 22 deletions

View file

@ -39,22 +39,18 @@ Page {
//property var itemData: ({})
property bool _loading: jItem.status === "Loading"
readonly property bool hasLogo: (typeof itemData.ImageTags !== "undefined") && (typeof itemData.ImageTags["Logo"] !== "undefined")
readonly property var _backdropImages: itemData.backdropImageTags
readonly property var _parentBackdropImages: itemData.parentBackdropImageTags
property string _chosenBackdropImage: ""
readonly property string parentId: itemData.ParentId || ""
on_BackdropImagesChanged: updateBackdrop()
on_ParentBackdropImagesChanged: updateBackdrop()
function updateBackdrop() {
var rand = 0;
if (itemData.backdropImageTags.length > 0) {
var rand = Math.floor(Math.random() * (_backdropImages.length - 0.001))
rand = Math.floor(Math.random() * (itemData.backdropImageTags.length - 0.001))
console.log("Random: ", rand)
_chosenBackdropImage = ApiClient.baseUrl + "/Items/" + itemId + "/Images/Backdrop/" + rand + "?tag=" + _backdropImages[rand] + "&maxHeight" + height
//_chosenBackdropImage = Utils.itemImageUrl(ApiClient.baseUrl, itemData, "Backdrop/" + rand)
_chosenBackdropImage = ApiClient.baseUrl + "/Items/" + itemId + "/Images/Backdrop/" + rand + "?tag=" +itemData.backdropImageTags[rand] + "&maxHeight" + height
} else if (itemData.parentBackdropImageTags.length > 0) {
_chosenBackdropImage = ApiClient.baseUrl + "/Items/" + itemData.parentBackdropItemId + "/Images/Backdrop/0?tag=" + _parentBackdropImages[0]
rand = Math.floor(Math.random() * (itemData.parentBackdropImageTags.length - 0.001))
_chosenBackdropImage = ApiClient.baseUrl + "/Items/" + itemData.parentBackdropItemId + "/Images/Backdrop/" + rand + "?tag=" + itemData.parentBackdropImageTags[0]
}
}
@ -76,11 +72,6 @@ Page {
visible: false
}
Text {
color: "red"
text: _chosenBackdropImage || "No backdrop"
}
PageBusyIndicator {
running: pageRoot._loading
}
@ -116,6 +107,9 @@ Page {
onStatusChanged: {
console.log("Status changed: " + newStatus, JSON.stringify(jItem))
console.log(jItem.mediaStreams)
if (status == JellyfinItem.Ready) {
updateBackdrop()
}
}
}

View file

@ -40,7 +40,7 @@ BaseDetailPage {
anchors.fill: parent
model: collectionModel
cellWidth: Constants.libraryDelegateWidth
cellHeight: Utils.usePortraitCover(itemData.collectionType) ? Constants.libraryDelegatePosterHeight
cellHeight: Utils.usePortraitCover(itemData.type) ? Constants.libraryDelegatePosterHeight
: Constants.libraryDelegateHeight
visible: itemData.status !== JellyfinItem.Error
@ -90,7 +90,7 @@ BaseDetailPage {
horizontalAlignment: Text.AlignLeft
font.pixelSize: Theme.fontSizeSmall
}
onClicked: pageStack.push(Utils.getPageUrl(model.mediaType, model.type), {"itemId": model.id})
onClicked: pageStack.push(Utils.getPageUrl(model.mediaType, model.type, model.isFolder), {"itemId": model.id})
}
ViewPlaceholder {

View file

@ -78,13 +78,14 @@ BaseDetailPage {
model: showSeasonsModel
clip: true
width: parent.width
height: Screen.width / 2
height: Constants.libraryDelegatePosterHeight
orientation: ListView.Horizontal
spacing: Theme.paddingLarge
leftMargin: Theme.horizontalPageMargin
rightMargin: Theme.horizontalPageMargin
delegate: LibraryItemDelegate {
poster: Utils.itemModelImageUrl(ApiClient.baseUrl, model.id, model.imageTags.primary, "Primary", {"maxHeight": height})
blurhash: model.imageBlurHashes["primary"][model.imageTags.primary]
title: model.name
onClicked: pageStack.push(Utils.getPageUrl(model.mediaType, model.type), {"itemId": model.id})
}

View file

@ -56,6 +56,7 @@ BaseDetailPage {
width: parent.width
imageSource: Utils.itemImageUrl(ApiClient.baseUrl, itemData, "Primary", {"maxWidth": parent.width})
imageAspectRatio: Constants.horizontalVideoAspectRatio
imageBlurhash: itemData.imageBlurHashes["Primary"][itemData.imageTags["Primary"]]
favourited: itemData.userData.isFavorite
playProgress: itemData.userData.playedPercentage / 100
onPlayPressed: pageStack.push(Qt.resolvedUrl("../VideoPage.qml"),