2021-02-14 17:40:46 +00:00
|
|
|
|
/*
|
|
|
|
|
Sailfin: a Jellyfin client written using Qt
|
|
|
|
|
Copyright (C) 2021 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 QtMultimedia 5.6
|
|
|
|
|
import Sailfish.Silica 1.0
|
|
|
|
|
|
2021-08-11 21:35:33 +00:00
|
|
|
|
import nl.netsoj.chris.Jellyfin 1.0 as J
|
2021-02-14 17:40:46 +00:00
|
|
|
|
|
|
|
|
|
import "../"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* +---+--------------------------------------+
|
|
|
|
|
* |\ /| +---+ |
|
|
|
|
|
* | \ / | Media title | | |
|
2021-08-11 21:35:33 +00:00
|
|
|
|
* | X | | ⏸︎ | |
|
2021-02-14 17:40:46 +00:00
|
|
|
|
* | / \ | Artist 1, artist 2 | | |
|
|
|
|
|
* |/ \| +---+ |
|
|
|
|
|
* +-----+------------------------------------+
|
|
|
|
|
*/
|
2021-02-14 23:27:36 +00:00
|
|
|
|
PanelBackground {
|
|
|
|
|
id: playbackBar
|
|
|
|
|
height: Theme.itemSizeLarge
|
2021-02-14 17:40:46 +00:00
|
|
|
|
width: parent.width
|
2021-02-16 16:25:11 +00:00
|
|
|
|
y: parent.height - height
|
2021-08-11 21:35:33 +00:00
|
|
|
|
//FIXME: Once QTBUG-10822 is resolved, change to J.PlaybackManager
|
|
|
|
|
property var manager
|
2021-02-14 23:27:36 +00:00
|
|
|
|
property bool open
|
|
|
|
|
property real visibleSize: height
|
2021-02-20 22:20:39 +00:00
|
|
|
|
property bool isFullPage: false
|
|
|
|
|
property bool showQueue: false
|
2021-02-14 17:40:46 +00:00
|
|
|
|
|
2021-02-14 23:27:36 +00:00
|
|
|
|
property bool _pageWasShowingNavigationIndicator
|
core: Split PlaybackManager up into smaller parts
The PlaybackManager was a giant class that handled UI bindings, fetching
stream URLS, playback logic.
It now has been split up into:
- ViewModel::PlaybackManager, which handles UI interfacing and allowing
to swap out the Model::Playback implementation on the fly.
- Model::PlaybackManager, which is an interface for what a
PlaybackManager must do, handling queues/playlists, and controlling a
player.
- Model::LocalPlaybackManager, which is an Model::PlaybackManager
implementation for playing back Jellyfin media within the application.
- Model::PlaybackReporter, which reports the current playback state to
the Jellyfin server, for keeping track of played items.
- Model::Player, which handles playing back media from an URL and
the usual play/pause et cetera.
In a future commit, this would allow for introducing a
Model::RemoteJellyfinPlaybackManager, to control other Jellyfin
instances.
2022-01-05 20:24:52 +00:00
|
|
|
|
readonly property bool mediaLoading: [J.MediaStatus.Loading, J.MediaStatus.Buffering].indexOf(manager.mediaStatus) >= 0
|
2021-02-14 23:27:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
transform: Translate {id: playbackBarTranslate; y: 0}
|
|
|
|
|
|
|
|
|
|
BackgroundItem {
|
|
|
|
|
id: backgroundItem
|
2021-02-14 17:40:46 +00:00
|
|
|
|
width: parent.width
|
2021-02-14 23:27:36 +00:00
|
|
|
|
height: parent.height
|
2021-02-20 22:20:39 +00:00
|
|
|
|
onClicked: playbackBar.state = "large"
|
2021-02-14 23:27:36 +00:00
|
|
|
|
|
2021-02-14 17:40:46 +00:00
|
|
|
|
RemoteImage {
|
2021-02-14 23:27:36 +00:00
|
|
|
|
id: albumArt
|
|
|
|
|
anchors {
|
|
|
|
|
left: parent.left
|
|
|
|
|
bottom: parent.bottom
|
|
|
|
|
top: parent.top
|
|
|
|
|
}
|
|
|
|
|
width: height
|
2021-02-20 22:20:39 +00:00
|
|
|
|
Binding on blurhash {
|
2022-04-26 17:53:12 +00:00
|
|
|
|
when: manager.item !== null && "Primary" in manager.item.imageBlurHashes && "Primary" in manager.item.imageTags
|
2021-02-20 22:20:39 +00:00
|
|
|
|
value: manager.item.imageBlurHashes["Primary"][manager.item.imageTags["Primary"]]
|
|
|
|
|
}
|
2021-02-14 23:27:36 +00:00
|
|
|
|
source: largeAlbumArt.source
|
2021-02-14 17:40:46 +00:00
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
2021-08-11 21:35:33 +00:00
|
|
|
|
opacity: 1
|
2021-02-14 23:27:36 +00:00
|
|
|
|
|
|
|
|
|
Image {
|
|
|
|
|
id: largeAlbumArt
|
2021-08-11 21:35:33 +00:00
|
|
|
|
source: Utils.itemImageUrl(apiClient.baseUrl, manager.item, "Primary")
|
2021-02-14 23:27:36 +00:00
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
opacity: 0
|
|
|
|
|
Behavior on opacity { FadeAnimation {} }
|
|
|
|
|
}
|
2021-02-14 17:40:46 +00:00
|
|
|
|
}
|
2021-08-21 22:29:44 +00:00
|
|
|
|
Rectangle {
|
|
|
|
|
id: playQueueShim
|
2021-08-22 12:47:21 +00:00
|
|
|
|
anchors.fill: albumArt
|
2021-09-09 03:57:41 +00:00
|
|
|
|
color: Theme.rgba(Theme.overlayBackgroundColor, Theme.opacityOverlay)
|
2021-08-21 22:29:44 +00:00
|
|
|
|
opacity: 0
|
|
|
|
|
}
|
2021-02-20 22:20:39 +00:00
|
|
|
|
Loader {
|
|
|
|
|
id: queueLoader
|
|
|
|
|
source: Qt.resolvedUrl("PlayQueue.qml")
|
|
|
|
|
anchors.fill: albumArt
|
|
|
|
|
active: false
|
|
|
|
|
visible: false
|
2021-08-21 22:29:44 +00:00
|
|
|
|
opacity: 0
|
2021-02-20 22:20:39 +00:00
|
|
|
|
Binding {
|
|
|
|
|
when: queueLoader.item !== null
|
|
|
|
|
target: queueLoader.item
|
|
|
|
|
property: "model"
|
|
|
|
|
value: manager.queue
|
|
|
|
|
//currentIndex: manager.queueIndex
|
|
|
|
|
}
|
2021-08-21 20:33:23 +00:00
|
|
|
|
Binding {
|
|
|
|
|
when: queueLoader.item !== null
|
|
|
|
|
target: queueLoader.item
|
|
|
|
|
property: "playbackManager"
|
|
|
|
|
value: manager
|
|
|
|
|
}
|
2021-02-20 22:20:39 +00:00
|
|
|
|
}
|
2021-02-14 23:27:36 +00:00
|
|
|
|
|
2021-02-14 17:40:46 +00:00
|
|
|
|
Column {
|
2021-02-14 23:27:36 +00:00
|
|
|
|
id: artistInfo
|
|
|
|
|
height: Theme.fontSizeMedium + Theme.fontSizeLarge
|
|
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
|
left: albumArt.right
|
|
|
|
|
leftMargin: Theme.paddingMedium
|
|
|
|
|
right: playButton.left
|
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-14 17:40:46 +00:00
|
|
|
|
Label {
|
2021-02-14 23:27:36 +00:00
|
|
|
|
id: name
|
2021-08-21 22:29:44 +00:00
|
|
|
|
text: manager.item === null ? qsTr("No media selected") : manager.item.name
|
2021-02-14 23:27:36 +00:00
|
|
|
|
width: Math.min(contentWidth, parent.width)
|
2021-02-14 17:40:46 +00:00
|
|
|
|
font.pixelSize: Theme.fontSizeMedium
|
2021-02-14 23:27:36 +00:00
|
|
|
|
maximumLineCount: 1
|
2021-02-14 17:40:46 +00:00
|
|
|
|
truncationMode: TruncationMode.Fade
|
|
|
|
|
}
|
|
|
|
|
Label {
|
2021-02-14 23:27:36 +00:00
|
|
|
|
id: artists
|
2021-02-14 17:40:46 +00:00
|
|
|
|
text: {
|
2021-08-11 21:35:33 +00:00
|
|
|
|
if (manager.item === null) return qsTr("Play some media!")
|
|
|
|
|
switch(manager.item.mediaType) {
|
2021-02-14 17:40:46 +00:00
|
|
|
|
case "Audio":
|
core: Split PlaybackManager up into smaller parts
The PlaybackManager was a giant class that handled UI bindings, fetching
stream URLS, playback logic.
It now has been split up into:
- ViewModel::PlaybackManager, which handles UI interfacing and allowing
to swap out the Model::Playback implementation on the fly.
- Model::PlaybackManager, which is an interface for what a
PlaybackManager must do, handling queues/playlists, and controlling a
player.
- Model::LocalPlaybackManager, which is an Model::PlaybackManager
implementation for playing back Jellyfin media within the application.
- Model::PlaybackReporter, which reports the current playback state to
the Jellyfin server, for keeping track of played items.
- Model::Player, which handles playing back media from an URL and
the usual play/pause et cetera.
In a future commit, this would allow for introducing a
Model::RemoteJellyfinPlaybackManager, to control other Jellyfin
instances.
2022-01-05 20:24:52 +00:00
|
|
|
|
var links = [];
|
|
|
|
|
var items = manager.item.artistItems;
|
|
|
|
|
console.log(items)
|
|
|
|
|
for (var i = 0; i < items.length; i++) {
|
|
|
|
|
links.push("<a href=\"%1\" style=\"text-decoration:none;color:%3\">%2</a>"
|
|
|
|
|
.arg(items[i].jellyfinId)
|
|
|
|
|
.arg(items[i].name)
|
|
|
|
|
.arg(Theme.secondaryColor)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
return links.join(", ")
|
2021-02-14 17:40:46 +00:00
|
|
|
|
}
|
2021-08-21 22:29:44 +00:00
|
|
|
|
return qsTr("No audio")
|
2021-02-14 17:40:46 +00:00
|
|
|
|
}
|
core: Split PlaybackManager up into smaller parts
The PlaybackManager was a giant class that handled UI bindings, fetching
stream URLS, playback logic.
It now has been split up into:
- ViewModel::PlaybackManager, which handles UI interfacing and allowing
to swap out the Model::Playback implementation on the fly.
- Model::PlaybackManager, which is an interface for what a
PlaybackManager must do, handling queues/playlists, and controlling a
player.
- Model::LocalPlaybackManager, which is an Model::PlaybackManager
implementation for playing back Jellyfin media within the application.
- Model::PlaybackReporter, which reports the current playback state to
the Jellyfin server, for keeping track of played items.
- Model::Player, which handles playing back media from an URL and
the usual play/pause et cetera.
In a future commit, this would allow for introducing a
Model::RemoteJellyfinPlaybackManager, to control other Jellyfin
instances.
2022-01-05 20:24:52 +00:00
|
|
|
|
|
2021-02-14 23:27:36 +00:00
|
|
|
|
width: Math.min(contentWidth, parent.width)
|
2021-02-14 17:40:46 +00:00
|
|
|
|
font.pixelSize: Theme.fontSizeSmall
|
2021-02-14 23:27:36 +00:00
|
|
|
|
maximumLineCount: 1
|
2021-02-14 17:40:46 +00:00
|
|
|
|
truncationMode: TruncationMode.Fade
|
|
|
|
|
color: highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
|
2022-07-29 23:16:40 +00:00
|
|
|
|
linkColor: Theme.secondaryColor
|
|
|
|
|
onLinkActivated: {
|
|
|
|
|
appWindow.navigateToItem(link, "Audio", "MusicArtist", true)
|
|
|
|
|
}
|
core: Split PlaybackManager up into smaller parts
The PlaybackManager was a giant class that handled UI bindings, fetching
stream URLS, playback logic.
It now has been split up into:
- ViewModel::PlaybackManager, which handles UI interfacing and allowing
to swap out the Model::Playback implementation on the fly.
- Model::PlaybackManager, which is an interface for what a
PlaybackManager must do, handling queues/playlists, and controlling a
player.
- Model::LocalPlaybackManager, which is an Model::PlaybackManager
implementation for playing back Jellyfin media within the application.
- Model::PlaybackReporter, which reports the current playback state to
the Jellyfin server, for keeping track of played items.
- Model::Player, which handles playing back media from an URL and
the usual play/pause et cetera.
In a future commit, this would allow for introducing a
Model::RemoteJellyfinPlaybackManager, to control other Jellyfin
instances.
2022-01-05 20:24:52 +00:00
|
|
|
|
textFormat: Text.StyledText
|
2021-02-14 17:40:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-14 23:27:36 +00:00
|
|
|
|
IconButton {
|
|
|
|
|
id: playModeButton
|
|
|
|
|
anchors {
|
|
|
|
|
right: previousButton.left
|
|
|
|
|
rightMargin: Theme.paddingLarge
|
|
|
|
|
verticalCenter: playButton.verticalCenter
|
|
|
|
|
}
|
|
|
|
|
icon.source: "image://theme/icon-m-shuffle"
|
|
|
|
|
opacity: 0
|
2021-09-09 03:57:41 +00:00
|
|
|
|
enabled: false
|
2021-09-08 19:57:23 +00:00
|
|
|
|
onClicked: Notices.show(qsTr("Shuffle not yet implemented"))
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IconButton {
|
|
|
|
|
id: previousButton
|
|
|
|
|
anchors {
|
|
|
|
|
right: playButton.left
|
|
|
|
|
rightMargin: Theme.paddingLarge
|
|
|
|
|
verticalCenter: playButton.verticalCenter
|
|
|
|
|
}
|
|
|
|
|
icon.source: "image://theme/icon-m-previous"
|
|
|
|
|
enabled: false
|
|
|
|
|
opacity: 0
|
2021-08-11 21:35:33 +00:00
|
|
|
|
onClicked: manager.previous()
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-14 17:40:46 +00:00
|
|
|
|
IconButton {
|
|
|
|
|
id: playButton
|
2021-02-14 23:27:36 +00:00
|
|
|
|
anchors {
|
|
|
|
|
right: parent.right
|
|
|
|
|
rightMargin: Theme.paddingMedium
|
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
|
}
|
2021-02-20 22:20:39 +00:00
|
|
|
|
icon.source: manager.playbackState === MediaPlayer.PlayingState
|
2021-02-14 17:40:46 +00:00
|
|
|
|
? "image://theme/icon-m-pause" : "image://theme/icon-m-play"
|
2021-02-20 22:20:39 +00:00
|
|
|
|
onClicked: manager.playbackState === MediaPlayer.PlayingState
|
|
|
|
|
? manager.pause()
|
|
|
|
|
: manager.play()
|
2021-02-14 17:40:46 +00:00
|
|
|
|
}
|
2021-02-14 23:27:36 +00:00
|
|
|
|
IconButton {
|
|
|
|
|
id: nextButton
|
|
|
|
|
anchors {
|
|
|
|
|
left: playButton.right
|
|
|
|
|
leftMargin: Theme.paddingLarge
|
|
|
|
|
verticalCenter: playButton.verticalCenter
|
|
|
|
|
}
|
|
|
|
|
icon.source: "image://theme/icon-m-next"
|
|
|
|
|
enabled: false
|
|
|
|
|
opacity: 0
|
2021-08-11 21:35:33 +00:00
|
|
|
|
onClicked: manager.next()
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
IconButton {
|
|
|
|
|
id: queueButton
|
|
|
|
|
anchors {
|
|
|
|
|
left: nextButton.right
|
|
|
|
|
leftMargin: Theme.paddingLarge
|
|
|
|
|
verticalCenter: playButton.verticalCenter
|
|
|
|
|
}
|
|
|
|
|
icon.source: "image://theme/icon-m-menu"
|
2021-02-20 22:20:39 +00:00
|
|
|
|
icon.highlighted: showQueue
|
2021-02-14 23:27:36 +00:00
|
|
|
|
enabled: false
|
|
|
|
|
opacity: 0
|
2021-02-20 22:20:39 +00:00
|
|
|
|
onClicked: showQueue = !showQueue
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProgressBar {
|
|
|
|
|
id: progressBar
|
|
|
|
|
anchors.verticalCenter: parent.top
|
|
|
|
|
width: parent.width
|
|
|
|
|
leftMargin: Theme.itemSizeLarge
|
|
|
|
|
rightMargin: 0
|
|
|
|
|
minimumValue: 0
|
2021-02-20 22:20:39 +00:00
|
|
|
|
value: manager.position
|
|
|
|
|
maximumValue: manager.duration
|
2021-08-11 21:35:33 +00:00
|
|
|
|
indeterminate: mediaLoading
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Slider {
|
|
|
|
|
id: seekBar
|
|
|
|
|
animateValue: false
|
|
|
|
|
anchors.verticalCenter: progressBar.top
|
|
|
|
|
minimumValue: 0
|
2021-02-20 22:20:39 +00:00
|
|
|
|
value: manager.position
|
|
|
|
|
maximumValue: manager.duration
|
2021-02-14 23:27:36 +00:00
|
|
|
|
width: parent.width
|
|
|
|
|
stepSize: 1000
|
|
|
|
|
valueText: Utils.timeToText(value)
|
|
|
|
|
enabled: false
|
|
|
|
|
visible: false
|
|
|
|
|
onDownChanged: { if (!down) {
|
2021-02-20 22:20:39 +00:00
|
|
|
|
manager.seek(value);
|
2021-02-14 23:27:36 +00:00
|
|
|
|
// For some reason, the binding breaks when dragging the slider.
|
2021-02-20 22:20:39 +00:00
|
|
|
|
value = Qt.binding(function() { return manager.position})
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-14 17:40:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-14 23:27:36 +00:00
|
|
|
|
states: [
|
|
|
|
|
State {
|
|
|
|
|
name: ""
|
core: Split PlaybackManager up into smaller parts
The PlaybackManager was a giant class that handled UI bindings, fetching
stream URLS, playback logic.
It now has been split up into:
- ViewModel::PlaybackManager, which handles UI interfacing and allowing
to swap out the Model::Playback implementation on the fly.
- Model::PlaybackManager, which is an interface for what a
PlaybackManager must do, handling queues/playlists, and controlling a
player.
- Model::LocalPlaybackManager, which is an Model::PlaybackManager
implementation for playing back Jellyfin media within the application.
- Model::PlaybackReporter, which reports the current playback state to
the Jellyfin server, for keeping track of played items.
- Model::Player, which handles playing back media from an URL and
the usual play/pause et cetera.
In a future commit, this would allow for introducing a
Model::RemoteJellyfinPlaybackManager, to control other Jellyfin
instances.
2022-01-05 20:24:52 +00:00
|
|
|
|
when: manager.playbackState !== J.PlayerState.Stopped && !isFullPage && !("__hidePlaybackBar" in pageStack.currentPage)
|
2021-02-14 23:27:36 +00:00
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: "large"
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: playbackBar
|
2021-02-16 16:25:11 +00:00
|
|
|
|
height: pageStack.currentOrientation & Orientation.LandscapeMask ? Screen.width : Screen.height
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: albumArt
|
2021-08-21 22:29:44 +00:00
|
|
|
|
forceBlurhash: true
|
2021-02-14 23:27:36 +00:00
|
|
|
|
width: parent.width
|
|
|
|
|
anchors.bottomMargin: Theme.paddingLarge
|
|
|
|
|
}
|
|
|
|
|
AnchorChanges {
|
|
|
|
|
target: albumArt
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.bottom: artistInfo.top
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: artistInfo
|
|
|
|
|
anchors.leftMargin: Theme.horizontalPageMargin
|
|
|
|
|
anchors.rightMargin: Theme.horizontalPageMargin
|
|
|
|
|
anchors.bottomMargin: Theme.paddingLarge + seekBar.height - progressBar.height
|
|
|
|
|
height: Theme.fontSizeLarge + Theme.fontSizeMedium
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AnchorChanges {
|
|
|
|
|
target: artistInfo
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.bottom: progressBar.top
|
|
|
|
|
anchors.verticalCenter: undefined
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: progressBar
|
|
|
|
|
leftMargin: Screen.width / 8
|
|
|
|
|
rightMargin: Screen.width / 8
|
|
|
|
|
anchors.bottomMargin: Theme.paddingLarge
|
|
|
|
|
opacity: 0
|
|
|
|
|
visible: false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AnchorChanges {
|
|
|
|
|
target: progressBar
|
|
|
|
|
anchors.verticalCenter: undefined
|
|
|
|
|
anchors.bottom: playButton.top
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: playButton
|
|
|
|
|
anchors.bottomMargin: Theme.paddingLarge * 2
|
|
|
|
|
/*icon.source: appWindow.mediaPlayer.playbackState === MediaPlayer.PlayingState
|
|
|
|
|
? "image://theme/icon-l-pause" : "image://theme/icon-l-play"*/
|
|
|
|
|
width: Theme.itemSizeMedium
|
|
|
|
|
height: Theme.itemSizeMedium
|
|
|
|
|
icon.width: icon.implicitWidth * 1.5
|
|
|
|
|
icon.height: icon.implicitWidth * 1.5
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AnchorChanges {
|
|
|
|
|
target: playButton
|
|
|
|
|
anchors.right: undefined
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
anchors.verticalCenter: undefined
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PropertyChanges {
|
2021-09-10 01:08:40 +00:00
|
|
|
|
target: previousButton; opacity: 1; enabled: playbackManager.hasPrevious;
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
2021-09-10 01:08:40 +00:00
|
|
|
|
target: nextButton; opacity: 1; enabled: playbackManager.hasNext;
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
2021-09-09 03:57:41 +00:00
|
|
|
|
target: playModeButton; opacity: 1; enabled: true;
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: queueButton; opacity: 1; enabled: true;
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: seekBar
|
|
|
|
|
enabled: true
|
|
|
|
|
visible: true
|
|
|
|
|
animateValue: true
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: largeAlbumArt
|
|
|
|
|
opacity: status == Image.Ready ? 1.0 : 0.0
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: artists
|
|
|
|
|
font.pixelSize: Theme.fontSizeMedium
|
2022-07-29 23:16:40 +00:00
|
|
|
|
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
AnchorChanges {
|
|
|
|
|
target: artists
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: name
|
|
|
|
|
font.pixelSize: Theme.fontSizeLarge
|
|
|
|
|
}
|
|
|
|
|
AnchorChanges {
|
|
|
|
|
target: name
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: backgroundItem
|
|
|
|
|
enabled: false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
2021-02-20 22:20:39 +00:00
|
|
|
|
State {
|
|
|
|
|
name: "hidden"
|
core: Split PlaybackManager up into smaller parts
The PlaybackManager was a giant class that handled UI bindings, fetching
stream URLS, playback logic.
It now has been split up into:
- ViewModel::PlaybackManager, which handles UI interfacing and allowing
to swap out the Model::Playback implementation on the fly.
- Model::PlaybackManager, which is an interface for what a
PlaybackManager must do, handling queues/playlists, and controlling a
player.
- Model::LocalPlaybackManager, which is an Model::PlaybackManager
implementation for playing back Jellyfin media within the application.
- Model::PlaybackReporter, which reports the current playback state to
the Jellyfin server, for keeping track of played items.
- Model::Player, which handles playing back media from an URL and
the usual play/pause et cetera.
In a future commit, this would allow for introducing a
Model::RemoteJellyfinPlaybackManager, to control other Jellyfin
instances.
2022-01-05 20:24:52 +00:00
|
|
|
|
when: ((manager.playbackState === J.PlayerState.Stopped && !mediaLoading) || "__hidePlaybackBar" in pageStack.currentPage) && !isFullPage
|
2021-02-20 22:20:39 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: playbackBarTranslate
|
|
|
|
|
// + small padding since the ProgressBar otherwise would stick out
|
2021-08-21 22:29:44 +00:00
|
|
|
|
y: playbackBar.height + Theme.paddingMedium
|
2021-02-20 22:20:39 +00:00
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: playbackBar
|
|
|
|
|
visibleSize: 0
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: albumArt
|
|
|
|
|
source: ""
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: "page"
|
|
|
|
|
when: isFullPage && !showQueue
|
|
|
|
|
extend: "large"
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: queueLoader
|
|
|
|
|
active: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: "pageQueue"
|
|
|
|
|
when: isFullPage && showQueue
|
|
|
|
|
extend: "page"
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: queueLoader
|
|
|
|
|
visible: true
|
2021-08-21 22:29:44 +00:00
|
|
|
|
opacity: 1
|
2021-02-20 22:20:39 +00:00
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: largeAlbumArt
|
|
|
|
|
opacity: 0
|
|
|
|
|
visible: false
|
|
|
|
|
}
|
2021-08-21 22:29:44 +00:00
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: playQueueShim
|
|
|
|
|
opacity: 1
|
|
|
|
|
}
|
2021-02-20 22:20:39 +00:00
|
|
|
|
}
|
2021-02-14 23:27:36 +00:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: fullPage
|
|
|
|
|
Page {
|
|
|
|
|
property bool __hidePlaybackBar: true
|
2022-07-29 23:16:40 +00:00
|
|
|
|
property bool __isPlaybackBar: true
|
2021-02-14 23:27:36 +00:00
|
|
|
|
showNavigationIndicator: true
|
2021-02-16 16:25:11 +00:00
|
|
|
|
allowedOrientations: appWindow.allowedOrientations
|
|
|
|
|
SilicaFlickable {
|
2021-02-14 23:27:36 +00:00
|
|
|
|
anchors.fill: parent
|
2021-09-10 01:08:40 +00:00
|
|
|
|
PullDownMenu {
|
|
|
|
|
/*MenuItem {
|
2021-02-16 16:25:11 +00:00
|
|
|
|
//: Pulley menu item to view detailed media information of a song
|
|
|
|
|
text: qsTr("Info")
|
|
|
|
|
}
|
|
|
|
|
MenuItem {
|
|
|
|
|
//: Pulley menu item: add music to a playlist
|
|
|
|
|
text: qsTr("Add to playlist")
|
2021-09-10 01:08:40 +00:00
|
|
|
|
}*/
|
|
|
|
|
MenuItem {
|
|
|
|
|
//: Pulley menu item: stops playback of music
|
|
|
|
|
text: qsTr("Stop")
|
|
|
|
|
onClicked: {
|
|
|
|
|
playbackManager.stop()
|
|
|
|
|
pageStack.pop()
|
|
|
|
|
}
|
2021-02-16 16:25:11 +00:00
|
|
|
|
}
|
2021-09-10 01:08:40 +00:00
|
|
|
|
}
|
2021-02-16 16:25:11 +00:00
|
|
|
|
Loader {
|
|
|
|
|
Component.onCompleted: setSource(Qt.resolvedUrl("PlaybackBar.qml"),
|
2021-02-20 22:20:39 +00:00
|
|
|
|
{"isFullPage": true, "manager": manager, "y": 0})
|
2021-02-16 16:25:11 +00:00
|
|
|
|
anchors.fill: parent
|
|
|
|
|
}
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-02-14 17:40:46 +00:00
|
|
|
|
}
|
2021-02-14 23:27:36 +00:00
|
|
|
|
|
|
|
|
|
transitions: [
|
|
|
|
|
Transition {
|
2021-08-21 22:29:44 +00:00
|
|
|
|
from: ""
|
2021-02-14 23:27:36 +00:00
|
|
|
|
to: "large"
|
|
|
|
|
// We animate this object to a large size and then quickly swap out this component
|
|
|
|
|
// with a page containing this component.
|
|
|
|
|
SequentialAnimation {
|
|
|
|
|
ScriptAction {
|
|
|
|
|
script: {
|
|
|
|
|
_pageWasShowingNavigationIndicator = pageStack.currentPage.showNavigationIndicator
|
|
|
|
|
appWindow.pageStack.currentPage.showNavigationIndicator = false
|
|
|
|
|
seekBar.enabled = true
|
|
|
|
|
seekBar.visible = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ParallelAnimation {
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
properties: "width,height,targetX,targetY,leftMargin,rightMargin,font.pixelSize"
|
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
|
duration: 300 // Long, but avoids stutters
|
|
|
|
|
}
|
|
|
|
|
AnchorAnimation {
|
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
|
duration: 300
|
|
|
|
|
}
|
|
|
|
|
FadeAnimation {
|
|
|
|
|
duration: 300
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ScriptAction {
|
|
|
|
|
script: {
|
|
|
|
|
pageStack.currentPage.showNavigationIndicator = _pageWasShowingNavigationIndicator
|
|
|
|
|
pageStack.push(fullPage, {"background": pageStack.currentPage.background}, PageStackAction.Immediate)
|
2021-08-21 22:29:44 +00:00
|
|
|
|
/*playbackBarTranslate.y = playbackBar.height + Theme.paddingMedium
|
|
|
|
|
appWindow.bottomMargin = 0*/
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Transition {
|
|
|
|
|
from: "*"
|
|
|
|
|
to: "page"
|
|
|
|
|
},
|
|
|
|
|
Transition {
|
|
|
|
|
from: "hidden"
|
2021-08-21 22:29:44 +00:00
|
|
|
|
to: ""
|
2021-02-20 22:20:39 +00:00
|
|
|
|
NumberAnimation {
|
|
|
|
|
targets: [playbackBarTranslate, playbackBar]
|
2021-08-21 22:29:44 +00:00
|
|
|
|
properties: "y,visibleSize"
|
2021-02-20 22:20:39 +00:00
|
|
|
|
duration: 250
|
|
|
|
|
easing.type: Easing.OutQuad
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
target: appWindow
|
|
|
|
|
property: "bottomMargin"
|
|
|
|
|
duration: 250
|
|
|
|
|
to: Theme.itemSizeLarge
|
|
|
|
|
easing.type: Easing.OutQuad
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Transition {
|
|
|
|
|
from: ""
|
|
|
|
|
to: "hidden"
|
|
|
|
|
SequentialAnimation {
|
|
|
|
|
ParallelAnimation {
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
targets: [playbackBarTranslate, playbackBar]
|
2021-08-21 22:29:44 +00:00
|
|
|
|
properties: "y,visibleSize"
|
2021-02-14 23:27:36 +00:00
|
|
|
|
duration: 250
|
|
|
|
|
easing.type: Easing.OutQuad
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
target: appWindow
|
|
|
|
|
property: "bottomMargin"
|
|
|
|
|
duration: 250
|
|
|
|
|
to: 0
|
|
|
|
|
easing.type: Easing.OutQuad
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-21 22:29:44 +00:00
|
|
|
|
},
|
|
|
|
|
Transition {
|
|
|
|
|
from: "page"
|
|
|
|
|
to: "pageQueue"
|
|
|
|
|
reversible: false
|
|
|
|
|
|
|
|
|
|
SequentialAnimation {
|
|
|
|
|
FadeAnimation {
|
|
|
|
|
targets: [playQueueShim, largeAlbumArt, queueLoader]
|
|
|
|
|
property: "opacity"
|
|
|
|
|
}
|
|
|
|
|
PropertyAction { target: largeAlbumArt; property: "visible"; value: false }
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Transition {
|
|
|
|
|
from: "pageQueue"
|
|
|
|
|
to: "page"
|
|
|
|
|
reversible: false
|
|
|
|
|
SequentialAnimation {
|
|
|
|
|
PropertyAction { target: largeAlbumArt; property: "visible"; value: true }
|
|
|
|
|
PropertyAction { target: largeAlbumArt; property: "opacity"; value: 0 }
|
|
|
|
|
|
|
|
|
|
FadeAnimation {
|
|
|
|
|
targets: [playQueueShim, largeAlbumArt, queueLoader]
|
|
|
|
|
property: "opacity"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PropertyAction { target: queueLoader; property: "visible"; value: false }
|
|
|
|
|
}
|
2021-02-14 23:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
]
|
2021-02-14 17:40:46 +00:00
|
|
|
|
}
|