From 17400a97e44de746e22e72ebac8798a7956b3078 Mon Sep 17 00:00:00 2001 From: Henk Kalkwater Date: Fri, 10 Sep 2021 05:18:05 +0200 Subject: [PATCH] Small user interface tweaks --- .../qml/components/music/NarrowAlbumCover.qml | 3 ++- sailfish/qml/cover/CollectionPage.qml | 7 +++--- sailfish/qml/pages/AboutPage.qml | 3 ++- sailfish/qml/pages/LegalPage.qml | 1 - .../qml/pages/itemdetails/BaseDetailPage.qml | 6 ++--- .../qml/pages/itemdetails/CollectionPage.qml | 25 ++++++++++++++++--- .../qml/pages/itemdetails/MusicAlbumPage.qml | 6 +++-- sailfish/qml/pages/itemdetails/VideoPage.qml | 4 +++ 8 files changed, 39 insertions(+), 16 deletions(-) diff --git a/sailfish/qml/components/music/NarrowAlbumCover.qml b/sailfish/qml/components/music/NarrowAlbumCover.qml index 5c2d8bb..4b854b2 100644 --- a/sailfish/qml/components/music/NarrowAlbumCover.qml +++ b/sailfish/qml/components/music/NarrowAlbumCover.qml @@ -36,9 +36,10 @@ Item { property string name property alias blurhash : albumArtImage.blurhash property bool twoColumns + property real aspectRatio readonly property real smallSize: albumHeader.height - readonly property real bigSize: listHeader.width + readonly property real bigSize: listHeader.width / aspectRatio id: listHeader width: parent.width //spacing: Theme.paddingLarge diff --git a/sailfish/qml/cover/CollectionPage.qml b/sailfish/qml/cover/CollectionPage.qml index c215ac9..b81178b 100644 --- a/sailfish/qml/cover/CollectionPage.qml +++ b/sailfish/qml/cover/CollectionPage.qml @@ -42,7 +42,7 @@ CoverBackground { limit: cover.rowCount * 2 - 2 imageTypes: [J.ImageType.Primary] sortBy: "IsFavoriteOrLiked,Random" - recursive: false + recursive: true parentId: itemId autoReload: false onParentIdChanged: { @@ -53,6 +53,7 @@ CoverBackground { PathView { id: pathView model: randomItems + visible: count === randomItemsLoader.limit path: Path { startX: -rowHeight * rowOffset startY: rowHeight * 0.5 @@ -107,7 +108,7 @@ CoverBackground { Column { anchors.centerIn: parent width: parent.width - opacity: randomItemsLoader.status === J.ModelStatus.Ready ? 0.0 : 1.0 + opacity: randomItemsLoader.status === J.ModelStatus.Ready && pathView.visible ? 0.0 : 1.0 Behavior on opacity { NumberAnimation {} } @@ -137,7 +138,7 @@ CoverBackground { Timer { running: true - interval: 5000 + interval: 10000 repeat: true onTriggered: { pathView.incrementCurrentIndex() diff --git a/sailfish/qml/pages/AboutPage.qml b/sailfish/qml/pages/AboutPage.qml index 6ee3b26..69ccb2c 100644 --- a/sailfish/qml/pages/AboutPage.qml +++ b/sailfish/qml/pages/AboutPage.qml @@ -51,10 +51,11 @@ Page { anchors.rightMargin: Theme.horizontalPageMargin wrapMode: Text.WordWrap text: qsTr("

Sailfin version %1
" + - "Copyright © Chris Josten 2020

" + + "Copyright © Chris Josten 2020–%2

" + "

Sailfin is Free Software licensed under the LGPL-v2.1 or later, at your choice. " + "Parts of the code of Sailfin are from other libraries. View their licenses here.

") .arg(apiClient.version) + .arg(2021) textFormat: Text.StyledText color: Theme.secondaryHighlightColor linkColor: Theme.primaryColor diff --git a/sailfish/qml/pages/LegalPage.qml b/sailfish/qml/pages/LegalPage.qml index f64caec..cc2779f 100644 --- a/sailfish/qml/pages/LegalPage.qml +++ b/sailfish/qml/pages/LegalPage.qml @@ -110,7 +110,6 @@ Page { xhr.onreadystatechange = function () { if (xhr.readyState === XMLHttpRequest.DONE){ // if request_status == DONE var response = model.copyright + "\n\n" + xhr.responseText; - console.log(response); licenseLabel.text = response } } diff --git a/sailfish/qml/pages/itemdetails/BaseDetailPage.qml b/sailfish/qml/pages/itemdetails/BaseDetailPage.qml index ec85461..223aa90 100644 --- a/sailfish/qml/pages/itemdetails/BaseDetailPage.qml +++ b/sailfish/qml/pages/itemdetails/BaseDetailPage.qml @@ -41,7 +41,7 @@ Page { readonly property string parentId: itemData.parentId || "" function updateBackdrop() { - var rand = 0; + /*var rand = 0; if (itemData.backdropImageTags.length > 0) { rand = Math.floor(Math.random() * (itemData.backdropImageTags.length - 0.001)) console.log("Random: ", rand) @@ -49,7 +49,7 @@ Page { } else if (itemData.parentBackdropImageTags.length > 0) { rand = Math.floor(Math.random() * (itemData.parentBackdropImageTags.length - 0.001)) _chosenBackdropImage = apiClient.baseUrl + "/Items/" + itemData.parentBackdropItemId + "/Images/Backdrop/" + rand + "?tag=" + itemData.parentBackdropImageTags[0] - } + }*/ } allowedOrientations: Orientation.All @@ -89,7 +89,6 @@ Page { itemId: pageRoot.itemId autoReload: false onStatusChanged: { - console.log("Status changed: " + newStatus, JSON.stringify(jItemLoader.data)) if (status === J.ItemLoader.Ready) { updateBackdrop() } @@ -101,7 +100,6 @@ Page { //appWindow.itemData = ({}) } if (status === PageStatus.Active) { - console.log("Page ready, ItemID: ", itemId, ", UserID: ", apiClient.userId) jItemLoader.autoReload = true appWindow.itemData = Qt.binding(function() { return jItemLoader.data; }) } diff --git a/sailfish/qml/pages/itemdetails/CollectionPage.qml b/sailfish/qml/pages/itemdetails/CollectionPage.qml index 8ae0f17..9a1a33c 100644 --- a/sailfish/qml/pages/itemdetails/CollectionPage.qml +++ b/sailfish/qml/pages/itemdetails/CollectionPage.qml @@ -27,15 +27,22 @@ import "../../components" BaseDetailPage { id: pageRoot + property bool _collectionModelLoaded: false + J.ItemModel { id: collectionModel loader: J.UserItemsLoader { id: collectionLoader apiClient: appWindow.apiClient parentId: itemData.jellyfinId - autoReload: itemData.jellyfinId.length > 0 - onParentIdChanged: if (parentId.length > 0) reload() + autoReload: itemData.jellyfinId.length > 0 && (pageRoot.status == PageStatus.Active || _collectionModelLoaded) + //onParentIdChanged: if (parentId.length > 0) reload() sortBy: "SortName" + onStatusChanged: { + if (status === J.ModelStatus.Ready) { + _collectionModelLoaded = true + } + } } } @@ -58,7 +65,17 @@ BaseDetailPage { text: qsTr("Sort by") onClicked: pageStack.push(sortPageComponent) } - busy: collectionModel.status === J.ModelStatus.Loading + busy: collectionLoader.status === J.ModelStatus.Loading + } + add: Transition { + id: trans + SequentialAnimation { + + PropertyAction { + property: "opacity"; value: 0 } + PauseAnimation { duration: trans.ViewTransition.index * 3;} + NumberAnimation { properties: "opacity"; from: 0; to: 1.0; } + } // properties: "opacity"; from: 0; to: 1.0; } } delegate: GridItem { RemoteImage { @@ -98,7 +115,7 @@ BaseDetailPage { } ViewPlaceholder { - enabled: gridView.count == 0 && !pageRoot._loading + enabled: gridView.count == 0 && !pageRoot._loading && collectionModel.status === J.ModelStatus.Ready text: qsTr("Empty collection") hintText: qsTr("Add some items to this collection!") } diff --git a/sailfish/qml/pages/itemdetails/MusicAlbumPage.qml b/sailfish/qml/pages/itemdetails/MusicAlbumPage.qml index e1c1ba5..a44bec7 100644 --- a/sailfish/qml/pages/itemdetails/MusicAlbumPage.qml +++ b/sailfish/qml/pages/itemdetails/MusicAlbumPage.qml @@ -31,6 +31,7 @@ BaseDetailPage { readonly property int _songIndexWidth: 100 width: 800 * Theme.pixelRatio + property bool _collectionModelLoaded: false readonly property bool _twoColumns: albumPageRoot.width / Theme.pixelRatio >= 800 J.ItemModel { @@ -38,10 +39,10 @@ BaseDetailPage { loader: J.UserItemsLoader { apiClient: appWindow.apiClient sortBy: "SortName" - //fields: ["ItemCounts","PrimaryImageAspectRatio","BasicSyncInfo","CanDelete","MediaSourceCount"] + fields: [J.ItemFields.ItemCounts, J.ItemFields.PrimaryImageAspectRatio] parentId: itemData.jellyfinId autoReload: itemData.jellyfinId.length > 0 - onParentIdChanged: if (parentId.length > 0) reload() + //onParentIdChanged: if (parentId.length > 0) reload() } } RowLayout { @@ -95,6 +96,7 @@ BaseDetailPage { item.duration = Qt.binding(function() { return itemData.runTimeTicks}) item.songCount = Qt.binding(function() { return itemData.childCount}) item.listview = Qt.binding(function() { return list}) + item.aspectRatio = Qt.binding(function() { return itemData.primaryImageAspectRatio}) item.blurhash = Qt.binding(function() { return itemData.imageBlurHashes["Primary"][itemData.imageTags["Primary"]]; }) item.twoColumns = Qt.binding(function() { return _twoColumns }) } diff --git a/sailfish/qml/pages/itemdetails/VideoPage.qml b/sailfish/qml/pages/itemdetails/VideoPage.qml index fe80dec..639a7be 100644 --- a/sailfish/qml/pages/itemdetails/VideoPage.qml +++ b/sailfish/qml/pages/itemdetails/VideoPage.qml @@ -82,6 +82,10 @@ BaseDetailPage { } Label { + visible: appWindow.showDebugInfo + leftPadding: Theme.horizontalPageMargin + rightPadding: Theme.horizontalPageMargin + width: parent.width text: "Video %1, audio %2, subtitle %3".arg(trackSelector.videoTrack).arg(trackSelector.audioTrack).arg(trackSelector.subtitleTrack) } }