mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-04 01:42:44 +00:00
Add navigation to artists from tracks
I'm not to happy about the C++ sides. If anyone from the future finds this commit with "git blame" while debugging this code: I apologise
This commit is contained in:
parent
3f9661ccb5
commit
0fafb19c7d
14 changed files with 185 additions and 5 deletions
|
@ -24,7 +24,7 @@ SilicaListView {
|
|||
}
|
||||
}
|
||||
delegate: SongDelegate {
|
||||
artists: model.artists
|
||||
artists: model.artistItems
|
||||
name: model.name
|
||||
width: parent.width
|
||||
indexNumber: index + 1
|
||||
|
|
|
@ -147,6 +147,11 @@ PanelBackground {
|
|||
maximumLineCount: 1
|
||||
truncationMode: TruncationMode.Fade
|
||||
color: highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
|
||||
linkColor: Theme.secondaryColor
|
||||
onLinkActivated: {
|
||||
appWindow.navigateToItem(link, "Audio", "MusicArtist", true)
|
||||
}
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,6 +354,21 @@ PanelBackground {
|
|||
PropertyChanges {
|
||||
target: artists
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
text: {
|
||||
var links = [];
|
||||
var items = manager.item.artistItems;
|
||||
console.log(items)
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
links.push("<a href=\"%1\" style=\"text-decoration:none;color:%3\">%2</a>"
|
||||
.arg(items[i].jellyfinId)
|
||||
.arg(items[i].name)
|
||||
.arg(Theme.secondaryColor)
|
||||
)
|
||||
}
|
||||
|
||||
return links.join(", ")
|
||||
}
|
||||
|
||||
}
|
||||
AnchorChanges {
|
||||
target: artists
|
||||
|
@ -419,6 +439,7 @@ PanelBackground {
|
|||
id: fullPage
|
||||
Page {
|
||||
property bool __hidePlaybackBar: true
|
||||
property bool __isPlaybackBar: true
|
||||
showNavigationIndicator: true
|
||||
allowedOrientations: appWindow.allowedOrientations
|
||||
SilicaFlickable {
|
||||
|
|
|
@ -31,6 +31,7 @@ ListItem {
|
|||
|
||||
contentHeight: songName.height + songArtists.height + 2 * Theme.paddingMedium
|
||||
width: parent.width
|
||||
menu: contextMenu
|
||||
|
||||
TextMetrics {
|
||||
id: indexMetrics
|
||||
|
@ -77,7 +78,13 @@ ListItem {
|
|||
right: parent.right
|
||||
rightMargin: Theme.horizontalPageMargin
|
||||
}
|
||||
text: artists.join(", ")
|
||||
text: {
|
||||
var names = []
|
||||
for (var i = 0; i < artists.length; i++) {
|
||||
names.push(artists[i].name)
|
||||
}
|
||||
return names.join(", ")
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
truncationMode: TruncationMode.Fade
|
||||
color: highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
|
||||
|
@ -97,4 +104,48 @@ ListItem {
|
|||
color: highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
|
||||
highlighted: down || playing
|
||||
}
|
||||
|
||||
function goToArtist(id) {
|
||||
appWindow.navigateToItem(id, "audio", "MusicArtist", true)
|
||||
}
|
||||
|
||||
Component {
|
||||
id: contextMenu
|
||||
ContextMenu {
|
||||
MenuItem {
|
||||
text: {
|
||||
if(artists.length === 1) {
|
||||
//: Context menu item for navigating to the artist of the selected track
|
||||
return qsTr("Go to %1").arg(artists[0].name)
|
||||
} else {
|
||||
//: Context menu item for navigating to one of the artists of the selected track (opens submenu)
|
||||
return qsTr("Go to artists")
|
||||
}
|
||||
}
|
||||
onDelayedClick: {
|
||||
if (artists.length > 1) {
|
||||
songDelegateRoot.menu = artistMenu
|
||||
songDelegateRoot.openMenu()
|
||||
} else {
|
||||
goToArtist(artists[0].jellyfinId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: artistMenu
|
||||
ContextMenu {
|
||||
Repeater {
|
||||
model: artists
|
||||
MenuItem {
|
||||
text: modelData.name
|
||||
onDelayedClick: goToArtist(modelData.jellyfinId)
|
||||
}
|
||||
}
|
||||
onClosed: songDelegateRoot.menu = contextMenu
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -154,7 +154,13 @@ ApplicationWindow {
|
|||
if (mediaType === "Audio" && !isFolder) {
|
||||
playbackManager.playItemId(jellyfinId)
|
||||
} else {
|
||||
pageStack.push(Utils.getPageUrl(mediaType, type, isFolder), {"itemId": jellyfinId});
|
||||
var url = Utils.getPageUrl(mediaType, type, isFolder)
|
||||
var properties = {"itemId": jellyfinId}
|
||||
if ("__isPlaybackBar" in pageStack.currentPage) {
|
||||
pageStack.replace(url, properties);
|
||||
} else {
|
||||
pageStack.push(url, properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ BaseDetailPage {
|
|||
delegate: SongDelegate {
|
||||
id: songDelegate
|
||||
name: model.name
|
||||
artists: model.artists
|
||||
artists: model.artistItems
|
||||
duration: model.runTimeTicks
|
||||
indexNumber: itemData.type === "MusicAlbum" ? model.indexNumber : index + 1
|
||||
onClicked: window.playbackManager.playItemInList(collectionModel, model.index)
|
||||
|
|
|
@ -19,6 +19,15 @@ BaseDetailPage {
|
|||
SilicaFlickable {
|
||||
anchors.fill: parent
|
||||
contentHeight: content.height
|
||||
Component {
|
||||
id: latestMediaLoaderComponent
|
||||
J.LatestMediaLoader {
|
||||
apiClient: appWindow.apiClient
|
||||
parentId: itemData.jellyfinId
|
||||
includeItemTypes: "Audio"
|
||||
autoReload: false
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: albumArtistLoaderComponent
|
||||
|
@ -64,7 +73,6 @@ BaseDetailPage {
|
|||
text: qsTr("Recently added")
|
||||
//collapseWhenEmpty: false
|
||||
extraBusy: !_firstTimeLoaded
|
||||
clickable: false
|
||||
loader: J.LatestMediaLoader {
|
||||
apiClient: appWindow.apiClient
|
||||
parentId: itemData.jellyfinId
|
||||
|
@ -72,6 +80,12 @@ BaseDetailPage {
|
|||
includeItemTypes: "Audio"
|
||||
limit: 12
|
||||
}
|
||||
onHeaderClicked: pageStack.push(Qt.resolvedUrl("CollectionPage.qml"), {
|
||||
"loader": latestMediaLoaderComponent.createObject(musicLibraryPage),
|
||||
//: Page title for the list of all albums within the music library
|
||||
"pageTitle": qsTr("Latest media"),
|
||||
"allowSort": false
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue