mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-05 18:22:46 +00:00
[3/3] update openapi spec: update code interacting with generated code
Adjusted C++ code to handle with new and renamed objects, as well as properties with different types. As a result of changing types, the QML side had to be updated as well. I hope I found everything by manually testing. Additionally, the Qt Quick application has been updated to test the remote sessions more easily and to make it launch again.
This commit is contained in:
parent
9e1a20cd3a
commit
0c72906f88
39 changed files with 366 additions and 317 deletions
|
@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
*/
|
||||
|
||||
.pragma library
|
||||
.import nl.netsoj.chris.Jellyfin 1.0 as J
|
||||
|
||||
/**
|
||||
* Converts miliseconds to a h:mm:ss format
|
||||
|
@ -89,54 +90,60 @@ function itemModelImageUrl(baseUrl, itemId, tag, type, options) {
|
|||
}
|
||||
|
||||
function usePortraitCover(itemType) {
|
||||
return ["Series", "Movie", "tvshows", "movies"].indexOf(itemType) >= 0
|
||||
var portraitTypes = [J.ItemType.Series, J.ItemType.Movie, J.CollectionType.Tvshows, J.CollectionType.Movies]
|
||||
console.log("UsePortraitCover itemType: ", itemType)
|
||||
return portraitTypes.indexOf(itemType) >= 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the page url for a certain item type.
|
||||
*/
|
||||
function getPageUrl(mediaType, itemType, isFolder) {
|
||||
switch (itemType.toLowerCase()) {
|
||||
case "series":
|
||||
switch (itemType) {
|
||||
case J.ItemType.Series:
|
||||
return Qt.resolvedUrl("pages/itemdetails/SeriesPage.qml")
|
||||
case "movie":
|
||||
case J.ItemType.Movie:
|
||||
return Qt.resolvedUrl("pages/itemdetails/FilmPage.qml")
|
||||
case "collection":
|
||||
case "photoalbum":
|
||||
case J.ItemType.Folder:
|
||||
case J.ItemType.PhotoAlbum:
|
||||
return Qt.resolvedUrl("pages/itemdetails/CollectionPage.qml")
|
||||
case "season":
|
||||
case J.ItemType.Season:
|
||||
return Qt.resolvedUrl("pages/itemdetails/SeasonPage.qml")
|
||||
case "episode":
|
||||
case J.ItemType.Episode:
|
||||
return Qt.resolvedUrl("pages/itemdetails/EpisodePage.qml")
|
||||
case "musicartist":
|
||||
case J.ItemType.MusicArtist:
|
||||
return Qt.resolvedUrl("pages/itemdetails/MusicArtistPage.qml")
|
||||
case "musicalbum":
|
||||
case "playlist":
|
||||
case J.ItemType.MusicAlbum:
|
||||
case J.ItemType.Playlist:
|
||||
return Qt.resolvedUrl("pages/itemdetails/MusicAlbumPage.qml")
|
||||
case "photo":
|
||||
case J.ItemType.Photo:
|
||||
return Qt.resolvedUrl("pages/itemdetails/PhotoPage.qml")
|
||||
case "tvchannel":
|
||||
case J.ItemType.TvChannel:
|
||||
return Qt.resolvedUrl("pages/itemdetails/LiveTvChannelPage.qml")
|
||||
case "collectionfolder":
|
||||
case J.ItemType.CollectionFolder:
|
||||
// TODO: support for other collection folders
|
||||
switch(mediaType.toLowerCase()) {
|
||||
case "music":
|
||||
switch(mediaType) {
|
||||
case J.CollectionType.Music:
|
||||
return Qt.resolvedUrl("pages/itemdetails/MusicLibraryPage.qml")
|
||||
}
|
||||
// FALLTRHOUGH
|
||||
default:
|
||||
switch (mediaType ? mediaType.toLowerCase() : isFolder ? "folder" : "") {
|
||||
case "livetv":
|
||||
return Qt.resolvedUrl("pages/itemdetails/LiveTvChannelsPage.qml")
|
||||
case "folder":
|
||||
return Qt.resolvedUrl("pages/itemdetails/CollectionPage.qml")
|
||||
case "video":
|
||||
return Qt.resolvedUrl("pages/itemdetails/VideoPage.qml")
|
||||
case "photo":
|
||||
return Qt.resolvedUrl("pages/itemdetails/PhotoPage.qml")
|
||||
default:
|
||||
if (isFolder) return Qt.resolvedUrl("pages/itemdetails/CollectionPage.qml")
|
||||
return Qt.resolvedUrl("pages/itemdetails/UnsupportedPage.qml")
|
||||
if (isFolder) {
|
||||
switch (mediaType) {
|
||||
case J.CollectionType.Livetv:
|
||||
return Qt.resolvedUrl("pages/itemdetails/LiveTvChannelsPage.qml")
|
||||
default:
|
||||
return Qt.resolvedUrl("pages/itemdetails/CollectionPage.qml")
|
||||
}
|
||||
} else {
|
||||
switch (mediaType) {
|
||||
case J.MediaType.Photo:
|
||||
return Qt.resolvedUrl("pages/itemdetails/PhotoPage.qml")
|
||||
case J.MediaType.Video:
|
||||
return Qt.resolvedUrl("pages/itemdetails/VideoPage.qml")
|
||||
default:
|
||||
return Qt.resolvedUrl("pages/itemdetails/UnsupportedPage.qml")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ MoreSection {
|
|||
busy: itemModel.loader.status === J.ModelStatus.Loading || extraBusy
|
||||
property bool extraBusy: false
|
||||
property alias loader: itemModel.loader
|
||||
property string collectionType
|
||||
property int collectionType
|
||||
property bool collapseWhenEmpty: true
|
||||
|
||||
J.ItemModel {
|
||||
|
|
|
@ -158,7 +158,7 @@ PanelBackground {
|
|||
}
|
||||
|
||||
switch(manager.item.mediaType) {
|
||||
case "Audio":
|
||||
case J.MediaType.Audio:
|
||||
var links = [];
|
||||
var items = manager.item.artistItems;
|
||||
console.log(items)
|
||||
|
@ -181,7 +181,7 @@ PanelBackground {
|
|||
color: highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
|
||||
linkColor: Theme.secondaryColor
|
||||
onLinkActivated: {
|
||||
appWindow.navigateToItem(link, "Audio", "MusicArtist", true)
|
||||
appWindow.navigateToItem(link, J.MediaType.Audio, J.ItemType.MusicArtist, true)
|
||||
}
|
||||
textFormat: Text.StyledText
|
||||
Icon {
|
||||
|
|
|
@ -18,6 +18,7 @@ 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 "../.."
|
||||
|
||||
|
@ -106,7 +107,7 @@ ListItem {
|
|||
}
|
||||
|
||||
function goToArtist(id) {
|
||||
appWindow.navigateToItem(id, "audio", "MusicArtist", true)
|
||||
appWindow.navigateToItem(id, J.MediaType.Audio, J.ItemType.MusicArtist, true)
|
||||
}
|
||||
|
||||
Component {
|
||||
|
|
|
@ -41,7 +41,7 @@ CoverBackground {
|
|||
apiClient: appWindow.apiClient
|
||||
limit: cover.rowCount * 2 - 2
|
||||
imageTypes: [J.ImageType.Primary]
|
||||
sortBy: "IsFavoriteOrLiked,Random"
|
||||
sortBy: [J.SortBy.IsFavoriteOrLiked, J.SortBy.Random]
|
||||
recursive: true
|
||||
parentId: itemId
|
||||
autoReload: false
|
||||
|
|
|
@ -38,7 +38,7 @@ CoverBackground {
|
|||
Shim {
|
||||
// Movies usually show their name on the poster,
|
||||
// so showing it here as well is a bit double
|
||||
visible: mData.type !== "Movie"
|
||||
visible: mData.type !== J.ItemType.Movie
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
|
|
|
@ -156,7 +156,7 @@ ApplicationWindow {
|
|||
}
|
||||
|
||||
function navigateToItem(jellyfinId, mediaType, type, isFolder) {
|
||||
if (mediaType === "Audio" && !isFolder) {
|
||||
if (mediaType === MediaType.Audio && !isFolder) {
|
||||
playbackManager.playItemId(jellyfinId)
|
||||
} else {
|
||||
var url = Utils.getPageUrl(mediaType, type, isFolder)
|
||||
|
|
|
@ -56,7 +56,7 @@ Page {
|
|||
"You can <a href=\"github\">view its source code on GitHub</a>. " +
|
||||
"Parts of the code of Sailfin are from other libraries. <a href='3rdparty'>View their licenses here</a>.</p>")
|
||||
.arg(apiClient.version)
|
||||
.arg(2024)
|
||||
.arg(2025)
|
||||
textFormat: Text.StyledText
|
||||
color: Theme.secondaryHighlightColor
|
||||
linkColor: Theme.primaryColor
|
||||
|
|
|
@ -109,13 +109,13 @@ Page {
|
|||
ItemChildrenShowcase {
|
||||
text: model.name
|
||||
onHeaderClicked: appWindow.navigateToItem(model.jellyfinId, model.collectionType, model.type, model.isFolder);
|
||||
collectionType: model.collectionType || ""
|
||||
collectionType: model.collectionType || 0
|
||||
loader: J.LatestMediaLoader {
|
||||
apiClient: appWindow.apiClient
|
||||
parentId: jellyfinId
|
||||
}
|
||||
Binding on loader {
|
||||
when: model.collectionType == "livetv"
|
||||
when: model.collectionType == J.CollectionType.Livetv
|
||||
value: J.LiveTvChannelsLoader{
|
||||
apiClient: appWindow.apiClient
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ BaseDetailPage {
|
|||
id: collectionLoader
|
||||
apiClient: appWindow.apiClient
|
||||
parentId: itemData.jellyfinId
|
||||
sortBy: "SortName"
|
||||
sortBy: [ J.SortBy.SortName ]
|
||||
autoReload: itemData.jellyfinId.length > 0 && (pageRoot.status == PageStatus.Active || _collectionModelLoaded)
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ BaseDetailPage {
|
|||
id: itemImage
|
||||
anchors.fill: parent
|
||||
source: Utils.itemModelImageUrl(apiClient.baseUrl, model.jellyfinId, model.imageTags.Primary, "Primary", {"maxWidth": width})
|
||||
blurhash: model.imageBlurHashes.Primary[model.imageTags.Primary]
|
||||
blurhash: model.imageBlurHashes.Primary !== undefined ? model.imageBlurHashes.Primary[model.imageTags.Primary] : undefined
|
||||
fallbackColor: Utils.colorFromString(model.name)
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
clip: true
|
||||
|
@ -152,8 +152,14 @@ BaseDetailPage {
|
|||
|
||||
Component {
|
||||
id: sortPageComponent
|
||||
|
||||
Page {
|
||||
id: sortPage
|
||||
readonly property var sortMap: {
|
||||
"SortName": [J.SortBy.SortName],
|
||||
"PlayCount": [J.SortBy.PlayCount],
|
||||
"DateCreated": [J.SortBy.DateCreated]
|
||||
};
|
||||
|
||||
ListModel {
|
||||
id: sortOptions
|
||||
|
@ -183,19 +189,19 @@ BaseDetailPage {
|
|||
MenuItem {
|
||||
//: Sort order
|
||||
text: qsTr("Ascending")
|
||||
onClicked: apply(model.value, "Ascending")
|
||||
onClicked: apply(model.value, J.SortOrder.Ascending)
|
||||
}
|
||||
MenuItem {
|
||||
//: Sort order
|
||||
text: qsTr("Descending")
|
||||
onClicked: apply(model.value, "Descending")
|
||||
onClicked: apply(model.value, J.SortOrder.Descending)
|
||||
}
|
||||
}
|
||||
onClicked: openMenu()
|
||||
|
||||
function apply(field, order) {
|
||||
collectionModel.loader.sortBy = field;
|
||||
collectionModel.loader.sortOrder = order;
|
||||
collectionModel.loader.sortBy = sortMap[field];
|
||||
collectionModel.loader.sortOrder = [order];
|
||||
collectionModel.loader.reload()
|
||||
pageStack.pop()
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ BaseDetailPage {
|
|||
id: collectionModel
|
||||
loader: J.UserItemsLoader {
|
||||
apiClient: appWindow.apiClient
|
||||
sortBy: itemData.type === "MusicAlbum" ? "ParentIndexNumber,IndexNumber,SortName" : ""
|
||||
sortBy: itemData.type === J.ItemType.MusicAlbum ? [J.SortBy.ParentIndexNumber, J.SortBy.IndexNumber,J.SortBy.SortName] : []
|
||||
fields: [J.ItemFields.ItemCounts, J.ItemFields.PrimaryImageAspectRatio]
|
||||
parentId: itemData.jellyfinId
|
||||
autoReload: itemData.jellyfinId.length > 0
|
||||
|
|
|
@ -33,11 +33,11 @@ BaseDetailPage {
|
|||
id: albumsModel
|
||||
loader: J.UserItemsLoader {
|
||||
apiClient: appWindow.apiClient
|
||||
sortBy: "PremiereDate,ProductionYear,SortName"
|
||||
sortOrder: "Descending"
|
||||
sortBy: [J.SortBy.PremiereDate, J.SortBy.ProductionYear, J.SortBy.SortName]
|
||||
sortOrder: [J.SortOrder.Descending]
|
||||
fields: [J.ItemFields.ItemCounts, J.ItemFields.PrimaryImageAspectRatio]
|
||||
includeItemTypes: ["MusicAlbum"]
|
||||
albumArtistIds: itemData.jellyfinId
|
||||
includeItemTypes: [J.ItemType.MusicAlbum]
|
||||
albumArtistIds: [itemData.jellyfinId]
|
||||
recursive: true
|
||||
autoReload: itemData.jellyfinId.length > 0
|
||||
limit: _maxItems
|
||||
|
@ -48,10 +48,10 @@ BaseDetailPage {
|
|||
id: fullAlbumsModelComponent
|
||||
J.UserItemsLoader {
|
||||
apiClient: appWindow.apiClient
|
||||
sortBy: "PremiereDate,ProductionYear,SortName"
|
||||
sortOrder: "Descending"
|
||||
sortBy: [J.SortBy.PremiereDate, J.SortBy.ProductionYear, J.SortBy.SortName]
|
||||
sortOrder: [J.SortOrder.Descending]
|
||||
fields: [J.ItemFields.ItemCounts, J.ItemFields.PrimaryImageAspectRatio]
|
||||
includeItemTypes: ["MusicAlbum"]
|
||||
includeItemTypes: [J.ItemType.MusicAlbum]
|
||||
albumArtistIds: itemData.jellyfinId
|
||||
recursive: true
|
||||
autoReload: false
|
||||
|
@ -62,10 +62,10 @@ BaseDetailPage {
|
|||
id: appearsOnModel
|
||||
loader: J.UserItemsLoader {
|
||||
apiClient: appWindow.apiClient
|
||||
sortBy: "PremiereDate,ProductionYear,SortName"
|
||||
sortOrder: "Descending"
|
||||
sortBy: [J.SortBy.PremiereDate, J.SortBy.ProductionYear, J.SortBy.SortName]
|
||||
sortOrder: [J.SortOrder.Descending]
|
||||
fields: [J.ItemFields.ItemCounts, J.ItemFields.PrimaryImageAspectRatio]
|
||||
includeItemTypes: ["MusicAlbum"]
|
||||
includeItemTypes: [J.ItemType.MusicAlbum]
|
||||
contributingArtistIds: itemData.jellyfinId
|
||||
recursive: true
|
||||
autoReload: itemData.jellyfinId.length > 0
|
||||
|
@ -76,10 +76,10 @@ BaseDetailPage {
|
|||
id: fullAppearsOnModelComponent
|
||||
J.UserItemsLoader {
|
||||
apiClient: appWindow.apiClient
|
||||
sortBy: "PremiereDate,ProductionYear,SortName"
|
||||
sortOrder: "Descending"
|
||||
sortBy: [J.SortBy.PremiereDate, J.SortBy.ProductionYear, J.SortBy.SortName]
|
||||
sortOrder: [J.SortOrder.Descending]
|
||||
fields: [J.ItemFields.ItemCounts, J.ItemFields.PrimaryImageAspectRatio]
|
||||
includeItemTypes: ["MusicAlbum"]
|
||||
includeItemTypes: [J.ItemType.MusicAlbum]
|
||||
contributingArtistIds: itemData.jellyfinId
|
||||
recursive: true
|
||||
autoReload: false
|
||||
|
|
|
@ -56,7 +56,7 @@ BaseDetailPage {
|
|||
J.LatestMediaLoader {
|
||||
apiClient: appWindow.apiClient
|
||||
parentId: itemData.jellyfinId
|
||||
includeItemTypes: "Audio"
|
||||
includeItemTypes: [J.ItemType.Audio]
|
||||
autoReload: false
|
||||
}
|
||||
}
|
||||
|
@ -74,9 +74,9 @@ BaseDetailPage {
|
|||
J.UserItemsLoader {
|
||||
apiClient: appWindow.apiClient
|
||||
parentId: itemData.jellyfinId
|
||||
includeItemTypes: "MusicAlbum"
|
||||
includeItemTypes: [J.ItemType.MusicAlbum]
|
||||
recursive: true
|
||||
sortBy: "SortName"
|
||||
sortBy: [J.SortBy.SortName]
|
||||
autoReload: false
|
||||
}
|
||||
}
|
||||
|
@ -85,9 +85,9 @@ BaseDetailPage {
|
|||
J.UserItemsLoader {
|
||||
apiClient: appWindow.apiClient
|
||||
parentId: itemData.jellyfinId
|
||||
includeItemTypes: "Playlist"
|
||||
includeItemTypes: [J.ItemType.Playlist]
|
||||
recursive: true
|
||||
sortBy: "SortName"
|
||||
sortBy: [J.SortBy.SortName]
|
||||
autoReload: false
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ BaseDetailPage {
|
|||
apiClient: appWindow.apiClient
|
||||
parentId: itemData.jellyfinId
|
||||
autoReload: _firstTimeLoaded && itemData.jellyfinId.length > 0
|
||||
includeItemTypes: "Audio"
|
||||
includeItemTypes: [J.ItemType.Audio]
|
||||
limit: 12
|
||||
}
|
||||
onHeaderClicked: pageStack.push(Qt.resolvedUrl("CollectionPage.qml"), {
|
||||
|
@ -128,9 +128,9 @@ BaseDetailPage {
|
|||
loader: J.UserItemsLoader {
|
||||
apiClient: appWindow.apiClient
|
||||
parentId: itemData.jellyfinId
|
||||
includeItemTypes: "MusicAlbum"
|
||||
includeItemTypes: [J.ItemType.MusicAlbum]
|
||||
autoReload: _firstTimeLoaded && itemData.jellyfinId.length > 0
|
||||
sortBy: "Random"
|
||||
sortBy: [J.SortBy.Random]
|
||||
recursive: true
|
||||
limit: 12
|
||||
}
|
||||
|
@ -148,9 +148,9 @@ BaseDetailPage {
|
|||
loader: J.UserItemsLoader {
|
||||
apiClient: appWindow.apiClient
|
||||
parentId: itemData.jellyfinId
|
||||
includeItemTypes: "Playlist"
|
||||
includeItemTypes: [J.ItemType.Playlist]
|
||||
autoReload: _firstTimeLoaded && itemData.jellyfinId.length > 0
|
||||
sortBy: "Random"
|
||||
sortBy: [J.SortBy.Random]
|
||||
recursive: true
|
||||
limit: 12
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue