1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2025-09-01 08:52:45 +00:00

Added user details and somewhat imporved error handling

* [UI] Improved: error handling should be slightly better
* [UI] Improved: settings now show the user name and picture instead of the user id if network is available.
This commit is contained in:
Chris Josten 2020-10-10 15:56:04 +02:00
parent 8a683df2a2
commit d3a7c17586
11 changed files with 240 additions and 80 deletions

View file

@ -51,12 +51,13 @@ Page {
}
// Tell SilicaFlickable the height of its content.
contentHeight: column.height
contentHeight: column.visible ? column.height : errorColumn.height
// Place our content in a Column. The PageHeader is always placed at the top
// of the page, followed by our content.
Column {
id: column
visible: mediaLibraryModel.status != ApiModel.Error
width: page.width
//spacing: Theme.paddingLarge
@ -123,25 +124,31 @@ Page {
}
}
}
Column {
width: parent.width
visible: mediaLibraryModel.status == ApiModel.Error
PageHeader {
title: qsTr("Network error")
//clickable: false
}
}
PlainLabel {
text: qsTr("An error has occurred. Please try again.")
}
Item { width: 1; height: Theme.paddingLarge }
Button {
text: qsTr("Retry")
anchors.horizontalCenter: parent.horizontalCenter
onClicked: loadModels(true)
}
Item { width: 1; height: Theme.paddingLarge }
Column {
id: errorColumn
width: parent.width
visible: mediaLibraryModel.status == ApiModel.Error
PageHeader {
title: qsTr("Network error")
}
Item {
width: 1
height: page.height / 3
}
PlainLabel {
text: qsTr("An error has occurred. Please try again.")
}
Item { width: 1; height: Theme.paddingLarge }
Button {
text: qsTr("Retry")
anchors.horizontalCenter: parent.horizontalCenter
onClicked: loadModels(true)
}
Item { width: 1; height: Theme.paddingLarge }
}
}

View file

@ -48,24 +48,54 @@ Page {
text: qsTr("Session")
}
PlainLabel {
text: qsTr("Server")
}
Item {
anchors {
left: parent.left
leftMargin: Theme.horizontalPageMargin
right: parent.right
rightMargin: Theme.horizontalPageMargin
}
height: user.implicitHeight + server.implicitHeight + Theme.paddingMedium
User {
id: loggedInUser
apiClient: ApiClient
}
Image {
id: userIcon
width: height
anchors {
left: parent.left
top: parent.top
bottom: parent.bottom
}
source: ApiClient.baseUrl + "/Users/" + ApiClient.userId + "/Images/Primary?tag=" + loggedInUser.primaryImageTag
}
PlainLabel {
text: ApiClient.baseUrl
color: Theme.secondaryHighlightColor
}
Label {
id: user
anchors {
left: userIcon.right
leftMargin: Theme.paddingLarge
bottom: parent.verticalCenter
right: parent.right
}
text: loggedInUser.status == User.Ready ? loggedInUser.name : ApiClient.userId
color: Theme.highlightColor
}
Item { width: 1; height: Theme.paddingMedium; }
Label {
id: server
anchors {
left: userIcon.right
leftMargin: Theme.paddingLarge
top: parent.verticalCenter
right: parent.right
}
text: ApiClient.baseUrl
color: Theme.secondaryHighlightColor
}
PlainLabel {
text: qsTr("User id")
}
PlainLabel {
text: ApiClient.userId
color: Theme.secondaryHighlightColor
}
Item { width: 1; height: Theme.paddingLarge; }

View file

@ -68,6 +68,31 @@ Page {
running: pageRoot._loading
}
SilicaFlickable {
anchors.fill: parent
contentHeight: errorContent.height
visible: jItem.status == JellyfinItem.Error
PullDownMenu {
busy: jItem.status == JellyfinItem.Loading
MenuItem {
text: qsTr("Retry")
onClicked: jItem.reload()
}
}
Column {
id: errorContent
width: parent.width
ViewPlaceholder {
enabled: true
text: qsTr("An error has occured")
hintText: jItem.errorString
}
}
}
JellyfinItem {
id: jItem
apiClient: ApiClient

View file

@ -42,6 +42,8 @@ BaseDetailPage {
cellWidth: Constants.libraryDelegateWidth
cellHeight: Utils.usePortraitCover(itemData.CollectionType) ? Constants.libraryDelegatePosterHeight
: Constants.libraryDelegateHeight
visible: itemData.status !== JellyfinItem.Error
header: PageHeader {
title: itemData.name || qsTr("Loading")
}

View file

@ -34,9 +34,16 @@ BaseDetailPage {
fields: ["Overview"]
}
Connections {
target: itemData
onReady: episodeModel.reload()
}
SilicaListView {
anchors.fill: parent
contentHeight: content.height
visible: itemData.status !== JellyfinItem.Error
header: PageHeader {
title: itemData.name
description: itemData.seriesName

View file

@ -28,6 +28,7 @@ BaseDetailPage {
SilicaFlickable {
anchors.fill: parent
contentHeight: content.height
visible: itemData.status !== JellyfinItem.Error
Column {
id: content
@ -68,6 +69,10 @@ BaseDetailPage {
show: itemData.jellyfinId
onShowChanged: reload()
}
Connections {
target: itemData
onReady: showSeasonsModel.reload()
}
SilicaListView {
model: showSeasonsModel

View file

@ -23,6 +23,7 @@ import Sailfish.Silica 1.0
BaseDetailPage {
SilicaFlickable {
anchors.fill: parent
visible: itemData.status !== JellyfinItem.Error
PageHeader {
title: itemData.name
}

View file

@ -36,6 +36,7 @@ BaseDetailPage {
SilicaFlickable {
anchors.fill: parent
contentHeight: content.height + Theme.paddingLarge
visible: itemData.status !== JellyfinItem.Error
VerticalScrollDecorator {}

View file

@ -62,6 +62,17 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BaseDetailPage</name>
<message>
<source>Retry</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An error has occured</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CollectionPage</name>
<message>
@ -259,14 +270,6 @@
<source>Session</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Server</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User id</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Log out</source>
<translation type="unfinished"></translation>