2021-02-16 17:01:17 +00:00
|
|
|
import QtQuick 2.12
|
2021-03-04 16:26:51 +00:00
|
|
|
import QtQuick.Controls 2.12
|
2021-02-16 17:01:17 +00:00
|
|
|
import QtQuick.Window 2.12
|
|
|
|
|
2021-07-31 13:06:17 +00:00
|
|
|
import QtMultimedia 5.12
|
|
|
|
|
2021-03-24 19:04:03 +00:00
|
|
|
import nl.netsoj.chris.Jellyfin 1.0 as J
|
2021-03-04 16:26:51 +00:00
|
|
|
|
2021-02-16 17:01:17 +00:00
|
|
|
import "components"
|
2021-03-07 15:26:13 +00:00
|
|
|
import ".."
|
2021-03-24 19:04:03 +00:00
|
|
|
import "."
|
2021-02-16 17:01:17 +00:00
|
|
|
|
2021-03-04 16:26:51 +00:00
|
|
|
ApplicationWindow {
|
2021-03-07 15:26:13 +00:00
|
|
|
id: appWindow
|
2021-02-16 17:01:17 +00:00
|
|
|
width: 600
|
|
|
|
height: 600
|
|
|
|
visible: true
|
2021-03-07 15:26:13 +00:00
|
|
|
property int _oldDepth: 0
|
2021-08-30 23:29:51 +00:00
|
|
|
property alias playbackManager: _playbackManager
|
2021-03-29 21:48:16 +00:00
|
|
|
|
|
|
|
J.PlaybackManager {
|
2021-08-30 23:29:51 +00:00
|
|
|
id: _playbackManager
|
2021-07-31 13:06:17 +00:00
|
|
|
apiClient: ApiClient
|
2021-03-29 21:48:16 +00:00
|
|
|
}
|
2021-02-16 17:01:17 +00:00
|
|
|
|
2021-08-30 23:29:51 +00:00
|
|
|
J.PlatformMediaControl {
|
|
|
|
playbackManager: appWindow.playbackManager
|
|
|
|
canQuit: true
|
|
|
|
onQuitRequested: appWindow.close()
|
|
|
|
desktopFile: "sailfin"
|
|
|
|
playerName: "Sailfin"
|
|
|
|
canRaise: true
|
|
|
|
onRaiseRequested: appWindow.raise()
|
|
|
|
}
|
|
|
|
|
2021-03-04 16:26:51 +00:00
|
|
|
background: Background {
|
2021-03-07 15:26:13 +00:00
|
|
|
id: background
|
2021-03-04 16:26:51 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
}
|
|
|
|
|
|
|
|
StackView {
|
|
|
|
id: pageStack
|
2021-02-16 17:01:17 +00:00
|
|
|
anchors.fill: parent
|
2021-03-07 15:26:13 +00:00
|
|
|
onDepthChanged: {
|
|
|
|
if (depth >= _oldDepth) {
|
|
|
|
background.enter();
|
|
|
|
} else {
|
|
|
|
background.exit();
|
|
|
|
}
|
|
|
|
_oldDepth = depth
|
|
|
|
}
|
2021-03-19 19:57:04 +00:00
|
|
|
initialItem: Qt.resolvedUrl("pages/MainPage.qml")
|
|
|
|
Keys.onEscapePressed: pop()
|
2021-02-16 17:01:17 +00:00
|
|
|
}
|
2021-03-04 16:26:51 +00:00
|
|
|
|
2021-09-09 00:18:10 +00:00
|
|
|
NotificationList {
|
|
|
|
id: notifList
|
|
|
|
anchors {
|
|
|
|
right: parent.right
|
|
|
|
bottom: parent.bottom
|
|
|
|
}
|
|
|
|
width: Math.min(parent.width, 400)
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: ApiClient.eventbus
|
|
|
|
onDisplayMessage: {
|
|
|
|
console.log("Displaying message: ", header, ": ", message)
|
|
|
|
notifList.addNotification(header, message, timeout)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-04 16:26:51 +00:00
|
|
|
Connections {
|
|
|
|
target: ApiClient
|
2021-03-28 02:00:00 +00:00
|
|
|
onSetupRequired: { pageStack.replace(Qt.resolvedUrl("pages/setup/ServerSelectPage.qml")); }
|
2021-03-04 16:26:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
ApiClient.restoreSavedSession()
|
|
|
|
}
|
2021-03-29 21:48:16 +00:00
|
|
|
|
2021-07-31 13:06:17 +00:00
|
|
|
footer: Item {
|
2021-03-29 21:48:16 +00:00
|
|
|
id: footer
|
2021-07-31 13:06:17 +00:00
|
|
|
height: Math.max(details.height, playButtons.height)
|
|
|
|
Column {
|
|
|
|
id: details
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
Text {
|
|
|
|
text: qsTr("Now playing")
|
|
|
|
color: "white"
|
|
|
|
}
|
|
|
|
Text {
|
2021-09-10 01:08:40 +00:00
|
|
|
text: "%1\n%2"
|
|
|
|
.arg(playbackManager.item.name ? playbackManager.item.name : "Nothing")
|
|
|
|
.arg(playbackManager.error === MediaPlayer.NoError ? playbackManager.streamUrl : playbackManager.errorString)
|
2021-07-31 13:06:17 +00:00
|
|
|
color: "white"
|
|
|
|
}
|
2021-03-29 21:48:16 +00:00
|
|
|
}
|
2021-07-31 13:06:17 +00:00
|
|
|
Row {
|
|
|
|
id: playButtons
|
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
text: "Previous"
|
|
|
|
onClicked: playbackManager.previous();
|
2021-08-30 23:29:51 +00:00
|
|
|
enabled: playbackManager.hasPrevious
|
2021-07-31 13:06:17 +00:00
|
|
|
}
|
|
|
|
Button {
|
2021-08-01 22:57:14 +00:00
|
|
|
readonly property bool _playing: playbackManager.playbackState === MediaPlayer.PlayingState;
|
2021-07-31 13:06:17 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
text: _playing ? "Pause" : "Play"
|
|
|
|
onClicked: _playing ? playbackManager.pause() : playbackManager.play()
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
text: "Next"
|
|
|
|
onClicked: playbackManager.next();
|
2021-08-30 23:29:51 +00:00
|
|
|
enabled: playbackManager.hasNext
|
2021-07-31 13:06:17 +00:00
|
|
|
}
|
2021-03-29 21:48:16 +00:00
|
|
|
}
|
2021-07-31 13:06:17 +00:00
|
|
|
|
2021-03-29 21:48:16 +00:00
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
color: "darkblue"
|
|
|
|
anchors.fill: footer
|
|
|
|
}
|
2021-02-16 17:01:17 +00:00
|
|
|
}
|