mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2024-11-01 07:35:17 +00:00
Chris Josten
a35d8026be
A setting has been added to allow users to select which page should be opened first. This allows for using Sailfin as a music player exclusively, as proposed in #34 Special care has been taken to avoid the user being locked out from the app, for when the library selected as home has been deleted on the server side. It is real tricky to guide the user to delete dconf keys. Therefore, a pulley menu with access to settings has been added to all collection pages and to the unknown page. Additionally, when the setting is changed, it throws away the entire pagestack and replaces it with the new home page + the settings page, so the user can always navigate back. The navigation history of the user will get lost, but otherwise the implementation gets to complex for a feature that is expected to be used not that often. This uses more timers than I hoped for, because otherwise things are undefined for some reason which I do not know and using timers solves it. :(
185 lines
7.5 KiB
QML
185 lines
7.5 KiB
QML
/*
|
|
Sailfin: a Jellyfin client written using Qt
|
|
Copyright (C) 2022-2024 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 as J
|
|
|
|
import "../../components"
|
|
import "../.."
|
|
|
|
BaseDetailPage {
|
|
id: musicLibraryPage
|
|
property bool _firstTimeLoaded: false
|
|
|
|
onStatusChanged: {
|
|
if (status == PageStatus.Active) {
|
|
_firstTimeLoaded = true
|
|
}
|
|
}
|
|
|
|
SilicaFlickable {
|
|
anchors.fill: parent
|
|
contentHeight: content.height
|
|
|
|
PullDownMenu {
|
|
MenuItem {
|
|
//: Pulley menu item: navigate to application settings page
|
|
text: qsTr("Settings")
|
|
onClicked: pageStack.push(Qt.resolvedUrl("../SettingsPage.qml"))
|
|
}
|
|
MenuItem {
|
|
//: Pulley menu item: shows controllable device page
|
|
text: qsTr("Remote control")
|
|
onClicked: pageStack.push(Qt.resolvedUrl("../ControllableDevicesPage.qml"))
|
|
}
|
|
}
|
|
|
|
Component {
|
|
id: latestMediaLoaderComponent
|
|
J.LatestMediaLoader {
|
|
apiClient: appWindow.apiClient
|
|
parentId: itemData.jellyfinId
|
|
includeItemTypes: "Audio"
|
|
autoReload: false
|
|
}
|
|
}
|
|
|
|
Component {
|
|
id: albumArtistLoaderComponent
|
|
J.AlbumArtistLoader {
|
|
apiClient: appWindow.apiClient
|
|
parentId: itemData.jellyfinId
|
|
autoReload: false
|
|
}
|
|
}
|
|
Component {
|
|
id: albumLoaderComponent
|
|
J.UserItemsLoader {
|
|
apiClient: appWindow.apiClient
|
|
parentId: itemData.jellyfinId
|
|
includeItemTypes: "MusicAlbum"
|
|
recursive: true
|
|
sortBy: "SortName"
|
|
autoReload: false
|
|
}
|
|
}
|
|
Component {
|
|
id: playlistLoaderComponent
|
|
J.UserItemsLoader {
|
|
apiClient: appWindow.apiClient
|
|
parentId: itemData.jellyfinId
|
|
includeItemTypes: "Playlist"
|
|
recursive: true
|
|
sortBy: "SortName"
|
|
autoReload: false
|
|
}
|
|
}
|
|
|
|
Column {
|
|
id: content
|
|
width: parent.width
|
|
|
|
PageHeader {
|
|
title: itemData.name
|
|
}
|
|
|
|
ItemChildrenShowcase {
|
|
//: Header on music library: Recently added music albums
|
|
text: qsTr("Recently added")
|
|
//collapseWhenEmpty: false
|
|
extraBusy: !_firstTimeLoaded
|
|
loader: J.LatestMediaLoader {
|
|
apiClient: appWindow.apiClient
|
|
parentId: itemData.jellyfinId
|
|
autoReload: _firstTimeLoaded && itemData.jellyfinId.length > 0
|
|
includeItemTypes: "Audio"
|
|
limit: 12
|
|
}
|
|
onHeaderClicked: pageStack.push(Qt.resolvedUrl("CollectionPage.qml"), {
|
|
"loader": latestMediaLoaderComponent.createObject(musicLibraryPage),
|
|
//: Page title for the list of all albums within the music library
|
|
"pageTitle": qsTr("Latest media"),
|
|
"allowSort": false
|
|
})
|
|
|
|
}
|
|
|
|
ItemChildrenShowcase {
|
|
text: qsTr("Albums")
|
|
//collapseWhenEmpty: false
|
|
extraBusy: !_firstTimeLoaded
|
|
loader: J.UserItemsLoader {
|
|
apiClient: appWindow.apiClient
|
|
parentId: itemData.jellyfinId
|
|
includeItemTypes: "MusicAlbum"
|
|
autoReload: _firstTimeLoaded && itemData.jellyfinId.length > 0
|
|
sortBy: "Random"
|
|
recursive: true
|
|
limit: 12
|
|
}
|
|
onHeaderClicked: pageStack.push(Qt.resolvedUrl("CollectionPage.qml"), {
|
|
"loader": albumLoaderComponent.createObject(musicLibraryPage),
|
|
//: Page title for the list of all albums within the music library
|
|
"pageTitle": qsTr("Albums")
|
|
})
|
|
}
|
|
|
|
ItemChildrenShowcase {
|
|
text: qsTr("Playlists")
|
|
//collapseWhenEmpty: false
|
|
extraBusy: !_firstTimeLoaded
|
|
loader: J.UserItemsLoader {
|
|
apiClient: appWindow.apiClient
|
|
parentId: itemData.jellyfinId
|
|
includeItemTypes: "Playlist"
|
|
autoReload: _firstTimeLoaded && itemData.jellyfinId.length > 0
|
|
sortBy: "Random"
|
|
recursive: true
|
|
limit: 12
|
|
}
|
|
onHeaderClicked: pageStack.push(Qt.resolvedUrl("CollectionPage.qml"), {
|
|
"loader": playlistLoaderComponent.createObject(musicLibraryPage),
|
|
//: Page title for the list of all playlists within the music library
|
|
"pageTitle": qsTr("Playlists")
|
|
})
|
|
}
|
|
|
|
ItemChildrenShowcase {
|
|
//: Header for music artists
|
|
text: qsTr("Artists")
|
|
//collapseWhenEmpty: false
|
|
extraBusy: !_firstTimeLoaded
|
|
loader: J.AlbumArtistLoader {
|
|
apiClient: appWindow.apiClient
|
|
parentId: itemData.jellyfinId
|
|
autoReload: _firstTimeLoaded && itemData.jellyfinId.length > 0
|
|
limit: 12
|
|
}
|
|
onHeaderClicked: pageStack.push(Qt.resolvedUrl("CollectionPage.qml"), {
|
|
"loader": albumArtistLoaderComponent.createObject(musicLibraryPage),
|
|
"allowSort": false,
|
|
//: Page title for the list of all artists within the music library
|
|
"pageTitle": qsTr("Artists")
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|