2020-09-27 18:38:33 +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
|
|
|
|
*/
|
|
|
|
|
2020-09-25 12:46:39 +00:00
|
|
|
import QtQuick 2.6
|
|
|
|
import Sailfish.Silica 1.0
|
|
|
|
|
2021-08-22 23:53:20 +00:00
|
|
|
import nl.netsoj.chris.Jellyfin 1.0 as J
|
2020-09-25 12:46:39 +00:00
|
|
|
|
|
|
|
import "../components"
|
2020-10-01 22:13:05 +00:00
|
|
|
import ".."
|
2020-09-25 12:46:39 +00:00
|
|
|
|
|
|
|
CoverBackground {
|
2021-08-22 23:53:20 +00:00
|
|
|
// Due QTBUG-10822, declarartions such as `property J.Item foo` are not possible.
|
2021-09-09 03:57:41 +00:00
|
|
|
property var mData: appWindow.playbackManager.item
|
2020-09-25 12:46:39 +00:00
|
|
|
RemoteImage {
|
|
|
|
anchors.fill: parent
|
2021-08-22 23:53:20 +00:00
|
|
|
source: mData === null ? "" : Utils.itemImageUrl(appWindow.apiClient.baseUrl, mData, "Primary", {"maxWidth": parent.width})
|
2020-09-25 12:46:39 +00:00
|
|
|
fillMode: Image.PreserveAspectCrop
|
2020-10-10 12:30:49 +00:00
|
|
|
onSourceChanged: console.log(source)
|
2020-09-25 12:46:39 +00:00
|
|
|
}
|
|
|
|
|
2020-10-01 22:13:05 +00:00
|
|
|
Shim {
|
|
|
|
// Movies usually show their name on the poster,
|
|
|
|
// so showing it here as well is a bit double
|
2021-02-13 20:42:57 +00:00
|
|
|
visible: mData.type !== "Movie"
|
2020-10-01 22:13:05 +00:00
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
top: parent.top
|
|
|
|
}
|
|
|
|
upsideDown: true
|
|
|
|
height: parent.height / 2
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
left: parent.left
|
|
|
|
}
|
2020-10-10 12:30:49 +00:00
|
|
|
width: itemData.userData.playedPercentage / 100 * parent.width
|
2020-10-01 22:13:05 +00:00
|
|
|
height: Theme.paddingSmall
|
|
|
|
color: Theme.highlightColor
|
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: infoColumn
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
anchors.margins: Theme.paddingMedium
|
|
|
|
Label {
|
|
|
|
id: itemName
|
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
color: Theme.primaryColor
|
2021-02-13 20:42:57 +00:00
|
|
|
text: mData.name
|
2020-10-01 22:13:05 +00:00
|
|
|
truncationMode: TruncationMode.Fade
|
|
|
|
}
|
|
|
|
Label {
|
2021-02-13 20:42:57 +00:00
|
|
|
visible: typeof mData.runTimeTicks !== "undefined"
|
2020-10-01 22:13:05 +00:00
|
|
|
color: Theme.secondaryColor
|
2021-09-09 03:57:41 +00:00
|
|
|
text: qsTr("%1/%2").arg(Utils.timeToText(appWindow.playbackManager.position)).arg(Utils.ticksToText(mData.runTimeTicks))
|
2020-10-01 22:13:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-25 12:46:39 +00:00
|
|
|
}
|