2020-10-01 09:56:02 +00:00
|
|
|
/*
|
|
|
|
Sailfin: a Jellyfin client written using Qt
|
2024-01-02 21:42:35 +00:00
|
|
|
Copyright (C) 2020-2024 Chris Josten
|
2020-10-01 09:56:02 +00:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
import QtQuick 2.6
|
|
|
|
import Sailfish.Silica 1.0
|
|
|
|
|
2021-07-31 13:06:17 +00:00
|
|
|
import nl.netsoj.chris.Jellyfin 1.0 as J
|
2020-10-01 09:56:02 +00:00
|
|
|
|
|
|
|
import "../../components"
|
|
|
|
import "../.."
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fallback page for everything that's a video, but we haven't a more specific page for, like
|
|
|
|
* the FilmPage or EpisodePage.
|
|
|
|
*/
|
|
|
|
BaseDetailPage {
|
2024-01-02 21:42:35 +00:00
|
|
|
id: detailPage
|
2020-10-01 22:13:05 +00:00
|
|
|
property alias subtitle: pageHeader.description
|
|
|
|
default property alias _data: content.data
|
2020-10-09 00:33:08 +00:00
|
|
|
property real _playbackProsition: itemData.userData.playbackPositionTicks
|
2021-08-17 14:43:17 +00:00
|
|
|
readonly property bool _userdataReady: itemLoader.status === J.ItemLoader.Ready && itemData.userData !== null
|
2024-01-02 21:42:35 +00:00
|
|
|
|
|
|
|
property string imageSource: Utils.itemImageUrl(apiClient.baseUrl, itemData, "Primary", {"maxWidth": parent.width})
|
|
|
|
property string imageBlurhash: itemData.imageBlurHashes["Primary"][itemData.imageTags["Primary"]]
|
|
|
|
|
2020-10-01 09:56:02 +00:00
|
|
|
SilicaFlickable {
|
|
|
|
anchors.fill: parent
|
2020-10-01 22:13:05 +00:00
|
|
|
contentHeight: content.height + Theme.paddingLarge
|
2021-07-31 13:06:17 +00:00
|
|
|
visible: itemData.status !== J.ItemLoader.Error
|
2020-10-01 22:13:05 +00:00
|
|
|
|
|
|
|
VerticalScrollDecorator {}
|
2020-10-01 09:56:02 +00:00
|
|
|
|
|
|
|
Column {
|
|
|
|
id: content
|
|
|
|
width: parent.width
|
|
|
|
spacing: Theme.paddingMedium
|
|
|
|
|
|
|
|
PageHeader {
|
2020-10-01 22:13:05 +00:00
|
|
|
id: pageHeader
|
2020-10-04 21:03:58 +00:00
|
|
|
title: itemData.name
|
2020-10-08 01:00:08 +00:00
|
|
|
description: qsTr("Run time: %2").arg(Utils.ticksToText(itemData.runTimeTicks))
|
2020-10-01 09:56:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PlayToolbar {
|
2020-10-01 22:13:05 +00:00
|
|
|
id: toolbar
|
2020-10-01 09:56:02 +00:00
|
|
|
width: parent.width
|
2024-01-02 21:42:35 +00:00
|
|
|
imageSource: detailPage.imageSource
|
2020-10-01 09:56:02 +00:00
|
|
|
imageAspectRatio: Constants.horizontalVideoAspectRatio
|
2024-01-02 21:42:35 +00:00
|
|
|
imageBlurhash: detailPage.imageBlurhash
|
2021-02-20 22:20:39 +00:00
|
|
|
Binding on favourited {
|
|
|
|
when: _userdataReady
|
2021-08-17 14:43:17 +00:00
|
|
|
value: itemData.userData.favorite
|
2021-02-20 22:20:39 +00:00
|
|
|
}
|
|
|
|
Binding on playProgress {
|
|
|
|
when: _userdataReady
|
|
|
|
value: itemData.userData.playedPercentage / 100
|
|
|
|
}
|
2020-10-01 22:13:05 +00:00
|
|
|
onPlayPressed: pageStack.push(Qt.resolvedUrl("../VideoPage.qml"),
|
2021-02-13 23:21:49 +00:00
|
|
|
{"itemData": itemData,
|
2020-10-01 22:13:05 +00:00
|
|
|
"audioTrack": trackSelector.audioTrack,
|
|
|
|
"subtitleTrack": trackSelector.subtitleTrack,
|
2021-02-13 23:21:49 +00:00
|
|
|
"resume": resume})
|
2020-10-01 09:56:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VideoTrackSelector {
|
|
|
|
id: trackSelector
|
|
|
|
width: parent.width
|
2021-08-22 23:46:57 +00:00
|
|
|
audioTracks: itemData.audioStreams
|
|
|
|
videoTracks: itemData.videoStreams
|
|
|
|
subtitleTracks: itemData.subtitleStreams
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
2021-09-10 03:18:05 +00:00
|
|
|
visible: appWindow.showDebugInfo
|
|
|
|
leftPadding: Theme.horizontalPageMargin
|
|
|
|
rightPadding: Theme.horizontalPageMargin
|
|
|
|
width: parent.width
|
2021-08-22 23:46:57 +00:00
|
|
|
text: "Video %1, audio %2, subtitle %3".arg(trackSelector.videoTrack).arg(trackSelector.audioTrack).arg(trackSelector.subtitleTrack)
|
2020-10-01 09:56:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-08 01:00:08 +00:00
|
|
|
|
|
|
|
Connections {
|
2021-08-17 14:43:17 +00:00
|
|
|
target: itemLoader
|
2020-10-08 01:00:08 +00:00
|
|
|
onStatusChanged: {
|
2021-07-31 13:06:17 +00:00
|
|
|
if (status === J.ItemLoader.Ready) {
|
2020-10-08 01:00:08 +00:00
|
|
|
console.log(itemData.mediaStreams)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-01 09:56:02 +00:00
|
|
|
}
|