mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-05 18:22:46 +00:00
Give fallback images random background colours
[UI] Added: if an image cannot be loaded, it will have a random background colour.
This commit is contained in:
parent
5057867ade
commit
7221fda1d5
4 changed files with 26 additions and 19 deletions
|
@ -59,6 +59,7 @@ BaseDetailPage {
|
|||
id: itemImage
|
||||
anchors.fill: parent
|
||||
source: Utils.itemModelImageUrl(ApiClient.baseUrl, model.id, model.imageTags["Primary"], "Primary", {"maxWidth": width})
|
||||
fallbackColor: Utils.colorFromString(model.name)
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
clip: true
|
||||
}
|
||||
|
@ -68,7 +69,7 @@ BaseDetailPage {
|
|||
bottom: parent.bottom
|
||||
right: parent.right
|
||||
}
|
||||
height: itemName.height + Theme.paddingSmall * 2
|
||||
height: itemName.height + Theme.paddingMedium * 2
|
||||
visible: itemImage.status !== Image.Null
|
||||
}
|
||||
Label {
|
||||
|
@ -86,15 +87,7 @@ BaseDetailPage {
|
|||
horizontalAlignment: Text.AlignLeft
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
onClicked: {
|
||||
switch(model.type) {
|
||||
case "Folder":
|
||||
pageStack.push(Qt.resolvedUrl("CollectionPage.qml"), {"itemId": model.id})
|
||||
break;
|
||||
default:
|
||||
pageStack.push(Utils.getPageUrl(model.mediaType, model.type), {"itemId": model.id})
|
||||
}
|
||||
}
|
||||
onClicked: pageStack.push(Utils.getPageUrl(model.mediaType, model.type), {"itemId": model.id})
|
||||
}
|
||||
|
||||
ViewPlaceholder {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue