2020-10-01 09:56:02 +00:00
|
|
|
/*
|
|
|
|
Sailfin: a Jellyfin client written using Qt
|
|
|
|
Copyright (C) 2020 Chris Josten
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
import nl.netsoj.chris.Jellyfin 1.0
|
|
|
|
|
|
|
|
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 {
|
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-02-20 22:20:39 +00:00
|
|
|
readonly property bool _userdataReady: itemData.status == JellyfinItem.Ready && itemData.userData != null
|
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
|
2020-10-10 13:56:04 +00:00
|
|
|
visible: itemData.status !== JellyfinItem.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
|
|
|
|
imageSource: Utils.itemImageUrl(ApiClient.baseUrl, itemData, "Primary", {"maxWidth": parent.width})
|
|
|
|
imageAspectRatio: Constants.horizontalVideoAspectRatio
|
2021-02-12 02:32:28 +00:00
|
|
|
imageBlurhash: itemData.imageBlurHashes["Primary"][itemData.imageTags["Primary"]]
|
2021-02-20 22:20:39 +00:00
|
|
|
Binding on favourited {
|
|
|
|
when: _userdataReady
|
|
|
|
value: itemData.userData.isFavorite
|
|
|
|
}
|
|
|
|
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
|
2020-10-04 21:03:58 +00:00
|
|
|
tracks: itemData.mediaStreams
|
2020-10-01 09:56:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-08 01:00:08 +00:00
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: itemData
|
|
|
|
onStatusChanged: {
|
|
|
|
if (status == JellyfinItem.Ready) {
|
|
|
|
console.log(itemData.mediaStreams)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-01 09:56:02 +00:00
|
|
|
}
|