Commit 0b2c4be9 authored by Alexander Stippich's avatar Alexander Stippich
Browse files

Rework size calculation for list delegates and cleanup

parent 0a8ce1fb
......@@ -40,10 +40,8 @@ FocusScope {
id: elisaTheme
property int layoutHorizontalMargin: 8
property int layoutVerticalMargin: 6
property int filterClearButtonMargin: layoutVerticalMargin
property int ratingStarSize: 15
property int navigationBarHeight: 100
property int navigationBarFilterHeight: 44
property int smallControlButtonSize: 22
}
......
......@@ -50,7 +50,6 @@ Item {
id: elisaTheme
property int layoutHorizontalMargin: 8
property int smallDelegateToolButtonSize: 20
property int ratingStarSize: 15
property int playListDelegateHeight: 28
property int smallControlButtonSize: 22
......
......@@ -42,24 +42,12 @@ Item {
property int layoutHorizontalMargin: 8
property int layoutVerticalMargin: 6
property int delegateHeight: 28
// FIXME: don't hardcode these; derive them from the layouts they're used in
FontMetrics {
id: playListAuthorTextHeight
font.weight: Font.Light
}
FontMetrics {
id: playListAlbumTextHeight
font.weight: Font.Bold
font.pointSize: Math.round(fontSize.font.pointSize * 1.4)
}
FontMetrics {
id: playListTrackTextHeight
font.weight: Font.Bold
}
property int playListDelegateHeight: (playListTrackTextHeight.height > 28) ? playListTrackTextHeight.height : 28
property int trackDelegateHeight: elisaTheme.layoutVerticalMargin + fontSize.height * 2
// END FIXME
property int playListAlbumArtSize: 70
......@@ -68,33 +56,24 @@ Item {
property int contextCoverImageSize: 100
property int smallImageSize: 32
property int maximumMetadataWidth: 300
property int tooltipRadius: 3
property int shadowOffset: 2
property int delegateToolButtonSize: 34
property int smallDelegateToolButtonSize: 20
property int ratingStarSize: 15
property int mediaPlayerControlHeight: 42
property int mediaPlayerHorizontalMargin: 10
property real mediaPlayerControlOpacity: 0.6
property int smallControlButtonSize: 22
property int volumeSliderWidth: 100
property int dragDropPlaceholderHeight: 28
property int navigationBarHeight: 100
property int navigationBarFilterHeight: 44
property int gridDelegateSize: 170
property int viewSelectorDelegateHeight: 24
property int filterClearButtonMargin: layoutVerticalMargin
property int headerToolbarHeight: 48
property int footerToolbarHeight: 30
......
......@@ -92,7 +92,6 @@ FocusScope {
id: entry
width: listView.delegateWidth
height: elisaTheme.delegateHeight
focus: true
......@@ -141,7 +140,6 @@ FocusScope {
id: entry
width: listView.delegateWidth
height: elisaTheme.trackDelegateHeight
focus: true
......
......@@ -54,6 +54,15 @@ FocusScope {
Keys.onReturnPressed: enqueue(trackUrl, dataType, title)
Keys.onEnterPressed: enqueue(trackUrl, dataType, title)
TextMetrics {
id: mainLabelSize
font: mainLabel.font
text: mainLabel.text
}
property int singleLineHeight: elisaTheme.layoutVerticalMargin * 2 + mainLabelSize.height
height: singleLineHeight + (detailedView ? mainLabelSize.height : 0)
Rectangle {
id: rowRoot
......@@ -132,44 +141,42 @@ FocusScope {
}
}
Item {
Layout.preferredHeight: mediaTrack.height * 0.9
Layout.preferredWidth: mediaTrack.height * 0.9
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Image {
id: coverImageElement
visible: detailedView
Layout.preferredHeight: mediaTrack.height - elisaTheme.layoutVerticalMargin
Layout.preferredWidth: mediaTrack.height - elisaTheme.layoutVerticalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutVerticalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutVerticalMargin : 0
Image {
id: coverImageElement
Layout.alignment: Qt.AlignCenter
anchors.fill: parent
visible: detailedView
sourceSize.width: mediaTrack.height * 0.9
sourceSize.height: mediaTrack.height * 0.9
fillMode: Image.PreserveAspectFit
smooth: true
sourceSize.width: mediaTrack.height - elisaTheme.layoutVerticalMargin
sourceSize.height: mediaTrack.height - elisaTheme.layoutVerticalMargin
fillMode: Image.PreserveAspectFit
smooth: true
source: (imageUrl != '' ? imageUrl : Qt.resolvedUrl(elisaTheme.defaultAlbumImage))
source: (imageUrl != '' ? imageUrl : Qt.resolvedUrl(elisaTheme.defaultAlbumImage))
asynchronous: true
asynchronous: true
layer.enabled: imageUrl != ''
layer.enabled: imageUrl != ''
layer.effect: DropShadow {
source: coverImageElement
layer.effect: DropShadow {
source: coverImageElement
radius: 10
spread: 0.1
samples: 21
radius: 10
spread: 0.1
samples: 21
color: myPalette.shadow
}
color: myPalette.shadow
}
onStatusChanged: {
if (coverImageElement.status === Image.Error) {
source = 'image://icon/media-optical-audio'
}
onStatusChanged: {
if (coverImageElement.status === Image.Error) {
source = 'image://icon/media-optical-audio'
}
}
}
......@@ -260,8 +267,8 @@ FocusScope {
FlatButtonWithToolTip {
id: detailsButton
height: elisaTheme.delegateHeight
width: elisaTheme.delegateHeight
height: singleLineHeight
width: singleLineHeight
text: i18nc("Show track metadata", "View Details")
icon.name: "help-about"
......@@ -270,8 +277,8 @@ FocusScope {
FlatButtonWithToolTip {
id: enqueueButton
height: elisaTheme.delegateHeight
width: elisaTheme.delegateHeight
height: singleLineHeight
width: singleLineHeight
text: i18nc("Enqueue current track", "Enqueue")
icon.name: "list-add"
......@@ -281,8 +288,8 @@ FocusScope {
FlatButtonWithToolTip {
id: clearAndEnqueueButton
scale: LayoutMirroring.enabled ? -1 : 1
height: elisaTheme.delegateHeight
width: elisaTheme.delegateHeight
height: singleLineHeight
width: singleLineHeight
text: i18nc("Clear play list and enqueue current track", "Play Now and Replace Play List")
icon.name: "media-playback-start"
......
......@@ -119,7 +119,6 @@ FocusScope {
section.delegate: TracksDiscHeader {
discNumber: section
width: scrollBar.visible ? (!LayoutMirroring.enabled ? contentDirectoryView.width - scrollBar.width : contentDirectoryView.width) : contentDirectoryView.width
height: elisaTheme.delegateHeight
}
ScrollBar.vertical: ScrollBar {
......
......@@ -22,6 +22,13 @@ Rectangle {
property int discNumber
color: myPalette.mid
height: discHeaderSize.height + elisaTheme.layoutVerticalMargin * 2
TextMetrics {
id: discHeaderSize
font: discHeaderLabel.font
text: discHeaderLabel.text
}
LabelWithToolTip {
id: discHeaderLabel
......
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