Small user interface tweaks

This commit is contained in:
Chris Josten 2021-09-10 05:18:05 +02:00
parent af99b39722
commit 17400a97e4
No known key found for this signature in database
GPG Key ID: A69C050E9FD9FF6A
8 changed files with 39 additions and 16 deletions

View File

@ -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

View File

@ -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()

View File

@ -51,10 +51,11 @@ Page {
anchors.rightMargin: Theme.horizontalPageMargin
wrapMode: Text.WordWrap
text: qsTr("<p><b>Sailfin version %1</b><br/>" +
"Copyright © Chris Josten 2020</p>" +
"Copyright © Chris Josten 2020%2</p>" +
"<p>Sailfin is Free Software licensed under the <a href='lgpl'>LGPL-v2.1</a> or later, at your choice. " +
"Parts of the code of Sailfin are from other libraries. <a href='3rdparty'>View their licenses here</a>.</p>")
.arg(apiClient.version)
.arg(2021)
textFormat: Text.StyledText
color: Theme.secondaryHighlightColor
linkColor: Theme.primaryColor

View File

@ -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
}
}

View File

@ -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; })
}

View File

@ -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!")
}

View File

@ -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 })
}

View File

@ -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)
}
}