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

Initial step towards the QObject rewrite

This commit is contained in:
Chris Josten 2020-10-04 23:03:58 +02:00
parent 7c7d2ba195
commit 4e3395c4e5
13 changed files with 498 additions and 29 deletions

View file

@ -31,9 +31,11 @@ import "../../components"
*/
Page {
id: pageRoot
property string itemId: ""
property var itemData: ({})
property bool _loading: true
property alias itemId: jItem.jellyfinId
property alias itemData: jItem
//property string itemId: ""
//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
@ -66,11 +68,11 @@ Page {
running: pageRoot._loading
}
onItemIdChanged: {
itemData = {}
if (itemId.length && PageStatus.Active) {
pageRoot._loading = true
ApiClient.fetchItem(itemId)
JellyfinItem {
id: jItem
apiClient: ApiClient
onStatusChanged: {
console.log("Status changed: " + newStatus, JSON.stringify(jItem))
}
}
@ -81,7 +83,7 @@ Page {
}
if (status == PageStatus.Active) {
if (itemId) {
ApiClient.fetchItem(itemId)
//ApiClient.fetchItem(itemId)
}
}
@ -92,7 +94,7 @@ Page {
onItemFetched: {
if (itemId === pageRoot.itemId) {
//console.log(JSON.stringify(result))
pageRoot.itemData = result
//pageRoot.itemData = result
pageRoot._loading = false
if (status == PageStatus.Active) {
if (itemData.Type === "CollectionFolder") {

View file

@ -26,12 +26,12 @@ import "../../"
VideoPage {
subtitle: {
if (typeof itemData.IndexNumberEnd !== "undefined") {
qsTr("Episode %1%2 | %3").arg(itemData.IndexNumber)
.arg(itemData.IndexNumberEnd)
.arg(itemData.SeasonName)
if (typeof itemData.indexNumberEnd !== "undefined") {
qsTr("Episode %1%2 | %3").arg(itemData.indexNumber)
.arg(itemData.indexNumberEnd)
.arg(itemData.seasonName)
} else {
qsTr("Episode %1 | %2").arg(itemData.IndexNumber).arg(itemData.SeasonName)
qsTr("Episode %1 | %2").arg(itemData.indexNumber).arg(itemData.seasonName)
}
}
@ -41,7 +41,7 @@ VideoPage {
PlainLabel {
id: overviewText
text: itemData.Overview || qsTr("No overview available")
text: itemData.overview || qsTr("No overview available")
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryHighlightColor
}

View file

@ -26,7 +26,7 @@ import "../../components"
import "../.."
VideoPage {
subtitle: qsTr("Released: %1 — Run time: %2").arg(itemData.ProductionYear).arg(Utils.ticksToText(itemData.RunTimeTicks))
subtitle: qsTr("Released: %1 — Run time: %2").arg(itemData.productionYear).arg(Utils.ticksToText(itemData.runTimeTicks))
SectionHeader {
text: qsTr("Overview")
@ -34,7 +34,7 @@ VideoPage {
PlainLabel {
id: overviewText
text: itemData.Overview
text: itemData.overview
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryHighlightColor
}

View file

@ -35,7 +35,7 @@ BaseDetailPage {
PageHeader {
id: header
title: itemData.Name
title: itemData.name
visible: !hasLogo
}
@ -52,7 +52,7 @@ BaseDetailPage {
PlainLabel {
id: overviewText
text: itemData.Overview
text: itemData.overview
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryHighlightColor
}
@ -65,7 +65,7 @@ BaseDetailPage {
ShowSeasonsModel {
id: showSeasonsModel
apiClient: ApiClient
show: itemData.Id
show: itemData.jellyfinId
}
SilicaListView {
@ -87,7 +87,7 @@ BaseDetailPage {
}
}
onItemDataChanged: {
showSeasonsModel.show = itemData.Id
showSeasonsModel.show = itemData.jellyfinId
showSeasonsModel.reload()
}
}

View file

@ -24,12 +24,12 @@ BaseDetailPage {
SilicaFlickable {
anchors.fill: parent
PageHeader {
title: itemData.Name
title: itemData.name
}
ViewPlaceholder {
enabled: true
text: qsTr("Item type (%1) unsupported").arg(itemData.Type)
text: qsTr("Item type (%1) unsupported").arg(itemData.type)
hintText: qsTr("This is still an alpha version :)")
}
}

View file

@ -45,7 +45,7 @@ BaseDetailPage {
PageHeader {
id: pageHeader
title: itemData.Name
title: itemData.name
description: qsTr("Run time: %2").arg(Utils.ticksToText(itemData.RunTimeTicks))
}
@ -66,7 +66,7 @@ BaseDetailPage {
VideoTrackSelector {
id: trackSelector
width: parent.width
tracks: itemData.MediaStreams
tracks: itemData.mediaStreams
}
}
}