1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2024-11-22 09:15:18 +00:00

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 string name
property alias blurhash : albumArtImage.blurhash property alias blurhash : albumArtImage.blurhash
property bool twoColumns property bool twoColumns
property real aspectRatio
readonly property real smallSize: albumHeader.height readonly property real smallSize: albumHeader.height
readonly property real bigSize: listHeader.width readonly property real bigSize: listHeader.width / aspectRatio
id: listHeader id: listHeader
width: parent.width width: parent.width
//spacing: Theme.paddingLarge //spacing: Theme.paddingLarge

View file

@ -42,7 +42,7 @@ CoverBackground {
limit: cover.rowCount * 2 - 2 limit: cover.rowCount * 2 - 2
imageTypes: [J.ImageType.Primary] imageTypes: [J.ImageType.Primary]
sortBy: "IsFavoriteOrLiked,Random" sortBy: "IsFavoriteOrLiked,Random"
recursive: false recursive: true
parentId: itemId parentId: itemId
autoReload: false autoReload: false
onParentIdChanged: { onParentIdChanged: {
@ -53,6 +53,7 @@ CoverBackground {
PathView { PathView {
id: pathView id: pathView
model: randomItems model: randomItems
visible: count === randomItemsLoader.limit
path: Path { path: Path {
startX: -rowHeight * rowOffset startX: -rowHeight * rowOffset
startY: rowHeight * 0.5 startY: rowHeight * 0.5
@ -107,7 +108,7 @@ CoverBackground {
Column { Column {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width 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 { Behavior on opacity {
NumberAnimation {} NumberAnimation {}
} }
@ -137,7 +138,7 @@ CoverBackground {
Timer { Timer {
running: true running: true
interval: 5000 interval: 10000
repeat: true repeat: true
onTriggered: { onTriggered: {
pathView.incrementCurrentIndex() pathView.incrementCurrentIndex()

View file

@ -51,10 +51,11 @@ Page {
anchors.rightMargin: Theme.horizontalPageMargin anchors.rightMargin: Theme.horizontalPageMargin
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: qsTr("<p><b>Sailfin version %1</b><br/>" + 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. " + "<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>") "Parts of the code of Sailfin are from other libraries. <a href='3rdparty'>View their licenses here</a>.</p>")
.arg(apiClient.version) .arg(apiClient.version)
.arg(2021)
textFormat: Text.StyledText textFormat: Text.StyledText
color: Theme.secondaryHighlightColor color: Theme.secondaryHighlightColor
linkColor: Theme.primaryColor linkColor: Theme.primaryColor

View file

@ -110,7 +110,6 @@ Page {
xhr.onreadystatechange = function () { xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE){ // if request_status == DONE if (xhr.readyState === XMLHttpRequest.DONE){ // if request_status == DONE
var response = model.copyright + "\n\n" + xhr.responseText; var response = model.copyright + "\n\n" + xhr.responseText;
console.log(response);
licenseLabel.text = response licenseLabel.text = response
} }
} }

View file

@ -41,7 +41,7 @@ Page {
readonly property string parentId: itemData.parentId || "" readonly property string parentId: itemData.parentId || ""
function updateBackdrop() { function updateBackdrop() {
var rand = 0; /*var rand = 0;
if (itemData.backdropImageTags.length > 0) { if (itemData.backdropImageTags.length > 0) {
rand = Math.floor(Math.random() * (itemData.backdropImageTags.length - 0.001)) rand = Math.floor(Math.random() * (itemData.backdropImageTags.length - 0.001))
console.log("Random: ", rand) console.log("Random: ", rand)
@ -49,7 +49,7 @@ Page {
} else if (itemData.parentBackdropImageTags.length > 0) { } else if (itemData.parentBackdropImageTags.length > 0) {
rand = Math.floor(Math.random() * (itemData.parentBackdropImageTags.length - 0.001)) rand = Math.floor(Math.random() * (itemData.parentBackdropImageTags.length - 0.001))
_chosenBackdropImage = apiClient.baseUrl + "/Items/" + itemData.parentBackdropItemId + "/Images/Backdrop/" + rand + "?tag=" + itemData.parentBackdropImageTags[0] _chosenBackdropImage = apiClient.baseUrl + "/Items/" + itemData.parentBackdropItemId + "/Images/Backdrop/" + rand + "?tag=" + itemData.parentBackdropImageTags[0]
} }*/
} }
allowedOrientations: Orientation.All allowedOrientations: Orientation.All
@ -89,7 +89,6 @@ Page {
itemId: pageRoot.itemId itemId: pageRoot.itemId
autoReload: false autoReload: false
onStatusChanged: { onStatusChanged: {
console.log("Status changed: " + newStatus, JSON.stringify(jItemLoader.data))
if (status === J.ItemLoader.Ready) { if (status === J.ItemLoader.Ready) {
updateBackdrop() updateBackdrop()
} }
@ -101,7 +100,6 @@ Page {
//appWindow.itemData = ({}) //appWindow.itemData = ({})
} }
if (status === PageStatus.Active) { if (status === PageStatus.Active) {
console.log("Page ready, ItemID: ", itemId, ", UserID: ", apiClient.userId)
jItemLoader.autoReload = true jItemLoader.autoReload = true
appWindow.itemData = Qt.binding(function() { return jItemLoader.data; }) appWindow.itemData = Qt.binding(function() { return jItemLoader.data; })
} }

View file

@ -27,15 +27,22 @@ import "../../components"
BaseDetailPage { BaseDetailPage {
id: pageRoot id: pageRoot
property bool _collectionModelLoaded: false
J.ItemModel { J.ItemModel {
id: collectionModel id: collectionModel
loader: J.UserItemsLoader { loader: J.UserItemsLoader {
id: collectionLoader id: collectionLoader
apiClient: appWindow.apiClient apiClient: appWindow.apiClient
parentId: itemData.jellyfinId parentId: itemData.jellyfinId
autoReload: itemData.jellyfinId.length > 0 autoReload: itemData.jellyfinId.length > 0 && (pageRoot.status == PageStatus.Active || _collectionModelLoaded)
onParentIdChanged: if (parentId.length > 0) reload() //onParentIdChanged: if (parentId.length > 0) reload()
sortBy: "SortName" sortBy: "SortName"
onStatusChanged: {
if (status === J.ModelStatus.Ready) {
_collectionModelLoaded = true
}
}
} }
} }
@ -58,7 +65,17 @@ BaseDetailPage {
text: qsTr("Sort by") text: qsTr("Sort by")
onClicked: pageStack.push(sortPageComponent) 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 { delegate: GridItem {
RemoteImage { RemoteImage {
@ -98,7 +115,7 @@ BaseDetailPage {
} }
ViewPlaceholder { ViewPlaceholder {
enabled: gridView.count == 0 && !pageRoot._loading enabled: gridView.count == 0 && !pageRoot._loading && collectionModel.status === J.ModelStatus.Ready
text: qsTr("Empty collection") text: qsTr("Empty collection")
hintText: qsTr("Add some items to this collection!") hintText: qsTr("Add some items to this collection!")
} }

View file

@ -31,6 +31,7 @@ BaseDetailPage {
readonly property int _songIndexWidth: 100 readonly property int _songIndexWidth: 100
width: 800 * Theme.pixelRatio width: 800 * Theme.pixelRatio
property bool _collectionModelLoaded: false
readonly property bool _twoColumns: albumPageRoot.width / Theme.pixelRatio >= 800 readonly property bool _twoColumns: albumPageRoot.width / Theme.pixelRatio >= 800
J.ItemModel { J.ItemModel {
@ -38,10 +39,10 @@ BaseDetailPage {
loader: J.UserItemsLoader { loader: J.UserItemsLoader {
apiClient: appWindow.apiClient apiClient: appWindow.apiClient
sortBy: "SortName" sortBy: "SortName"
//fields: ["ItemCounts","PrimaryImageAspectRatio","BasicSyncInfo","CanDelete","MediaSourceCount"] fields: [J.ItemFields.ItemCounts, J.ItemFields.PrimaryImageAspectRatio]
parentId: itemData.jellyfinId parentId: itemData.jellyfinId
autoReload: itemData.jellyfinId.length > 0 autoReload: itemData.jellyfinId.length > 0
onParentIdChanged: if (parentId.length > 0) reload() //onParentIdChanged: if (parentId.length > 0) reload()
} }
} }
RowLayout { RowLayout {
@ -95,6 +96,7 @@ BaseDetailPage {
item.duration = Qt.binding(function() { return itemData.runTimeTicks}) item.duration = Qt.binding(function() { return itemData.runTimeTicks})
item.songCount = Qt.binding(function() { return itemData.childCount}) item.songCount = Qt.binding(function() { return itemData.childCount})
item.listview = Qt.binding(function() { return list}) 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.blurhash = Qt.binding(function() { return itemData.imageBlurHashes["Primary"][itemData.imageTags["Primary"]]; })
item.twoColumns = Qt.binding(function() { return _twoColumns }) item.twoColumns = Qt.binding(function() { return _twoColumns })
} }

View file

@ -82,6 +82,10 @@ BaseDetailPage {
} }
Label { 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) text: "Video %1, audio %2, subtitle %3".arg(trackSelector.videoTrack).arg(trackSelector.audioTrack).arg(trackSelector.subtitleTrack)
} }
} }