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
|
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
|
2020-10-09 00:33:08 +00:00
|
|
|
favourited: itemData.userData.isFavorite
|
|
|
|
playProgress: itemData.userData.playedPercentage / 100
|
2020-10-01 22:13:05 +00:00
|
|
|
onPlayPressed: pageStack.push(Qt.resolvedUrl("../VideoPage.qml"),
|
|
|
|
{"itemId": itemId, "itemData": itemData,
|
|
|
|
"audioTrack": trackSelector.audioTrack,
|
|
|
|
"subtitleTrack": trackSelector.subtitleTrack,
|
|
|
|
"startTicks": startFromBeginning ? 0.0
|
2020-10-09 00:33:08 +00:00
|
|
|
: _playbackProsition })
|
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
|
|
|
}
|