Commit 42e17587 authored by stef lep's avatar stef lep Committed by Matthieu Gallien
Browse files

go to artist or album from context, BUG-417858

parent 69bf2260
......@@ -337,6 +337,10 @@ RowLayout {
albumName: ElisaApplication.manageHeaderBar.album
albumArtUrl: ElisaApplication.manageHeaderBar.image
fileUrl: ElisaApplication.manageHeaderBar.fileUrl
albumId: ElisaApplication.manageHeaderBar.albumId
albumArtist: (ElisaApplication.manageHeaderBar.albumArtist !== undefined ? ElisaApplication.manageHeaderBar.albumArtist : '')
onOpenArtist: { contentViewContainer.openArtist(artistName) }
onOpenAlbum: { contentViewContainer.openAlbum(albumName, albumArtist, albumArtUrl, albumId) }
}
}
}
......@@ -24,6 +24,11 @@ FocusScope {
property string artistName: ''
property url albumArtUrl: ''
property url fileUrl: ''
property int albumId
property string albumArtist: ''
signal openArtist()
signal openAlbum()
readonly property bool nothingPlaying: albumName.length === 0
&& artistName.length === 0
......@@ -138,53 +143,102 @@ FocusScope {
// No bottom anchors so it can grow
// Song title
LabelWithToolTip {
id: titleLabel
RowLayout {
Layout.fillWidth: false
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: parent.width
Image {
source: "image://icon/view-media-track"
Layout.preferredWidth: sourceSize.width
Layout.preferredHeight: sourceSize.height
sourceSize {
width: Kirigami.Units.iconSizes.smallMedium
height: Kirigami.Units.iconSizes.smallMedium
}
}
LabelWithToolTip {
id: titleLabel
level: 1
level: 1
horizontalAlignment: Label.AlignHCenter
horizontalAlignment: Label.AlignHCenter
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
Layout.topMargin: elisaTheme.layoutVerticalMargin
Layout.topMargin: elisaTheme.layoutVerticalMargin
wrapMode: Text.Wrap
wrapMode: Text.Wrap
}
}
LabelWithToolTip {
id: subtitleLabel
text: {
if (artistName !== '' && albumName !== '') {
return i18nc("display of artist and album in context view", "<i>by</i> <b>%1</b> <i>from</i> <b>%2</b>", artistName, albumName)
} else if (artistName === '' && albumName !== '') {
return i18nc("display of album in context view", "<i>from</i> <b>%1</b>", albumName)
} else if (artistName !== '' && albumName === '') {
i18nc("display of artist in context view", "<i>by</i> <b>%1</b>", artistName)
RowLayout {
visible: artistName !== ''
Layout.fillWidth: false
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: parent.width
Image {
source: "image://icon/view-media-artist"
visible: artistName !== ''
Layout.preferredWidth: sourceSize.width
Layout.preferredHeight: sourceSize.height
sourceSize {
width: Kirigami.Units.iconSizes.smallMedium
height: Kirigami.Units.iconSizes.smallMedium
}
}
Kirigami.LinkButton {
text: artistName !== '' ? artistName : ""
opacity: 0.6
visible: artistName !== ''
Layout.fillWidth: true
elide: Text.ElideNone
wrapMode: Text.Wrap
font.pointSize: Math.round(Kirigami.Theme.defaultFont.pointSize * 1.20)
font.bold: true
color: Kirigami.Theme.textColor
onClicked: {
openArtist();
}
}
}
RowLayout {
visible: albumName !== ''
Layout.fillWidth: false
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: parent.width
Image {
source: "image://icon/view-media-album-cover"
visible: albumName !== ''
Layout.preferredWidth: sourceSize.width
Layout.preferredHeight: sourceSize.height
sourceSize {
width: Kirigami.Units.iconSizes.smallMedium
height: Kirigami.Units.iconSizes.smallMedium
}
}
Kirigami.LinkButton {
text: albumName !== '' ? albumName : ""
opacity: 0.6
visible: albumName !== ''
Layout.fillWidth: true
wrapMode: Text.Wrap
elide: Text.ElideNone
font.pointSize: Math.round(Kirigami.Theme.defaultFont.pointSize * 1.20)
font.bold: true
color: Kirigami.Theme.textColor
onClicked: {
openAlbum();
}
}
level: 3
opacity: 0.6
horizontalAlignment: Label.AlignHCenter
visible: artistName !== '' && albumName !== ''
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
wrapMode: Text.Wrap
}
// Horizontal line separating title and subtitle from metadata
Kirigami.Separator {
Layout.fillWidth: true
Layout.leftMargin: Kirigami.Units.largeSpacing* 5
Layout.rightMargin: Kirigami.Units.largeSpacing * 5
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.rightMargin: Kirigami.Units.largeSpacing * 5
Layout.bottomMargin: Kirigami.Units.largeSpacing
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment