mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-04 01:42:44 +00:00
WIP: Slowly bringing back viewmodels
This commit is contained in:
parent
9abee12658
commit
228f81984b
17 changed files with 292 additions and 96 deletions
|
@ -14,6 +14,11 @@ ApplicationWindow {
|
|||
height: 600
|
||||
visible: true
|
||||
property int _oldDepth: 0
|
||||
property alias playbackManager: playbackManager
|
||||
|
||||
J.PlaybackManager {
|
||||
id: playbackManager
|
||||
}
|
||||
|
||||
background: Background {
|
||||
id: background
|
||||
|
@ -43,4 +48,20 @@ ApplicationWindow {
|
|||
Component.onCompleted: {
|
||||
ApiClient.restoreSavedSession()
|
||||
}
|
||||
|
||||
footer: Column {
|
||||
id: footer
|
||||
Text {
|
||||
text: qsTr("Now playing")
|
||||
color: "white"
|
||||
}
|
||||
Text {
|
||||
text: playbackManager.item.name ? playbackManager.item.name : "Nothing"
|
||||
color: "white"
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
color: "darkblue"
|
||||
anchors.fill: footer
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,12 +6,14 @@ import nl.netsoj.chris.Jellyfin 1.0 as J
|
|||
|
||||
import "../components"
|
||||
import "../.."
|
||||
import ".."
|
||||
|
||||
Page {
|
||||
id: detailPage
|
||||
property bool _modelsLoaded: false
|
||||
property StackView stackView: StackView.view
|
||||
property string itemId
|
||||
property alias jellyfinItem: jellyfinItem.data
|
||||
property alias jellyfinItem: jellyfinItemLoader.data
|
||||
header: ToolBar {
|
||||
Label {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
@ -25,13 +27,33 @@ Page {
|
|||
onClicked: stackView.pop()
|
||||
}
|
||||
J.ItemLoader {
|
||||
id: jellyfinItem
|
||||
jellyfinId: itemId
|
||||
id: jellyfinItemLoader
|
||||
itemId: detailPage.itemId
|
||||
apiClient: ApiClient
|
||||
}
|
||||
|
||||
Image {
|
||||
anchors.centerIn: parent
|
||||
anchors.top: parent.top
|
||||
width: parent.width
|
||||
height: parent.height / 3
|
||||
source: ApiClient.baseUrl + "/Items/" + itemId + "/Images/Primary?tag=" + jellyfinItem.tag
|
||||
}
|
||||
|
||||
ListView {
|
||||
width: parent.width
|
||||
height: parent.height / 3 * 2
|
||||
anchors.bottom: parent.bottom
|
||||
model: J.ItemModel {
|
||||
loader: J.UserItemsLoader {
|
||||
apiClient: ApiClient
|
||||
parentId: detailPage.itemId
|
||||
}
|
||||
}
|
||||
delegate: ItemDelegate{
|
||||
icon.source: ApiClient.baseUrl + "/Items/" + model.jellyfinId + "/Images/Primary?tag=" + model.tag
|
||||
text: model.name
|
||||
width: parent.width
|
||||
onClicked: playbackManager.play(model.jellyfinId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ Page {
|
|||
|
||||
J.ItemModel {
|
||||
id: mediaLibraryModel
|
||||
loader: J.UsersViewLoader {
|
||||
loader: J.UsersViewsLoader {
|
||||
id: mediaLibraryModelLoader
|
||||
apiClient: ApiClient
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ Page {
|
|||
ScrollView {
|
||||
anchors.fill: parent
|
||||
contentHeight: content.height
|
||||
contentWidth: availableWidth
|
||||
Column {
|
||||
id: content
|
||||
width: parent.width
|
||||
|
@ -37,12 +38,15 @@ Page {
|
|||
model: mediaLibraryModel
|
||||
Column {
|
||||
width: parent.width
|
||||
/*J.UserItemLatestModel {
|
||||
J.ItemModel{
|
||||
id: userItemModel
|
||||
apiClient: ApiClient
|
||||
parentId: model.id
|
||||
limit: 16
|
||||
}*/
|
||||
loader: J.LatestMediaLoader {
|
||||
id: latestMediaLoader
|
||||
apiClient: ApiClient
|
||||
parentId: model.jellyfinId
|
||||
//limit: 16
|
||||
}
|
||||
}
|
||||
Label {
|
||||
text: model.name ? model.name : "<Model without name>"
|
||||
}
|
||||
|
@ -51,13 +55,14 @@ Page {
|
|||
width: parent.width
|
||||
height: SailfinStyle.unit * 20
|
||||
orientation: ListView.Horizontal
|
||||
model: 10 // userItemModel
|
||||
model: userItemModel
|
||||
delegate: ItemDelegate {
|
||||
width: 12 * SailfinStyle.unit
|
||||
height: 20 * SailfinStyle.unit
|
||||
Image {
|
||||
anchors.fill: parent
|
||||
source: ApiClient.baseUrl + "/Items/" + model.id + "/Images/Primary?tag=" + model.tag
|
||||
source: ApiClient.baseUrl + "/Items/" + model.jellyfinId
|
||||
+ "/Images/Primary?tag=" + model.imageTags["Primary"] //model.tag
|
||||
}
|
||||
Label {
|
||||
anchors.left: parent.left
|
||||
|
@ -65,14 +70,18 @@ Page {
|
|||
anchors.right: parent.right
|
||||
text: model.name
|
||||
}
|
||||
onClicked: stackView.push(Qt.resolvedUrl("DetailPage.qml"), {"itemId": model.id})
|
||||
onClicked: stackView.push(Qt.resolvedUrl(
|
||||
"DetailPage.qml"), {
|
||||
"itemId": model.jellyfinId
|
||||
})
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: mediaLibraryModelLoader
|
||||
onReady: {
|
||||
if (mediaLibraryModelLoader.status === ModelStatus.Ready) {
|
||||
//userItemModel.reload()
|
||||
|
||||
latestMediaLoader.reload()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,13 +90,14 @@ Page {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads models if not laoded. Set force to true to reload models
|
||||
* even if loaded.
|
||||
*/
|
||||
function loadModels(force) {
|
||||
if (force || (ApiClient.authenticated && !_modelsLoaded)) {
|
||||
_modelsLoaded = true;
|
||||
_modelsLoaded = true
|
||||
mediaLibraryModel.reload()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue