Commit 230ea4b8 authored by Nate Graham's avatar Nate Graham 🔩
Browse files

Clean up maximized headerbar code a bit

The new maximized headerbar layour works great, but suffered from a few
papercut visual bugs, and the logic to implement it was unnecessarily
complicated in some cases. This patch simplifies the logic as much as
possible and fixes the layout bugs in the process.
parent 5828a768
......@@ -248,108 +248,89 @@ FocusScope {
Layout.maximumHeight: (headerBar.height - playControlItem.height - 8 * Kirigami.Units.largeSpacing) < gridLayoutContent.height ? (headerBar.height - playControlItem.height - 8 * Kirigami.Units.largeSpacing): gridLayoutContent.height
GridLayout {
id: gridLayoutLabels
property bool doChangeLayout: (contentZone.height/contentZone.width < 0.1) || (!isMaximized && contentZone.height < 125)
columns: doChangeLayout? 2: 1
rows: doChangeLayout? 2: 4
flow: GridLayout.TopToBottom
Layout.fillHeight: true
LabelWithToolTip {
id: mainLabel
text: title
Layout.fillWidth: true
Layout.alignment: (portrait? Qt.AlignHCenter: Qt.AlignLeft) | (isMaximized? Qt.AlignTop : Qt.AlignVCenter)
LabelWithToolTip {
id: mainLabel
text: title
Layout.fillWidth: true
Layout.maximumWidth: headerBar.width - 8 * Kirigami.Units.largeSpacing
wrapMode: Text.Wrap
Layout.alignment: (portrait? Qt.AlignHCenter: Qt.AlignLeft) | Qt.AlignTop
horizontalAlignment: portrait? Text.AlignHCenter : Text.AlignLeft
elide: Text.ElideRight
// Hardcoded because the headerbar blur always makes a dark-ish
// background, so we don't want to use a color scheme color that
// might also be dark
color: "white"
level: 1
font.bold: true
Layout.bottomMargin: albumLabel.height * 0.25
MouseArea {
id: titleMouseArea
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
openNowPlaying()
}
wrapMode: Text.Wrap
Layout.alignment: (portrait? Qt.AlignHCenter: Qt.AlignLeft) | Qt.AlignTop
horizontalAlignment: portrait? Text.AlignHCenter : Text.AlignLeft
elide: Text.ElideRight
// Hardcoded because the headerbar blur always makes a dark-ish
// background, so we don't want to use a color scheme color that
// might also be dark
color: "white"
level: 1
font.bold: true
MouseArea {
id: titleMouseArea
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
openNowPlaying()
}
}
}
LabelWithToolTip {
id: authorLabel
text: artist
Layout.fillHeight: false
Layout.fillWidth: true
Layout.maximumWidth: headerBar.width - 8 * Kirigami.Units.largeSpacing
wrapMode: Text.Wrap
Layout.alignment: (portrait? Qt.AlignHCenter: Qt.AlignLeft) | Qt.AlignTop
horizontalAlignment: portrait? Text.AlignHCenter : Text.AlignLeft
elide: Text.ElideRight
// Hardcoded because the headerbar blur always makes a dark-ish
// background, so we don't want to use a color scheme color that
// might also be dark
color: "white"
level: 3
MouseArea {
id: authorMouseArea
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
openArtist()
}
LabelWithToolTip {
id: authorLabel
text: artist
Layout.fillWidth: true
wrapMode: Text.Wrap
Layout.alignment: (portrait? Qt.AlignHCenter: Qt.AlignLeft) | Qt.AlignTop
horizontalAlignment: portrait? Text.AlignHCenter : Text.AlignLeft
elide: Text.ElideRight
// Hardcoded because the headerbar blur always makes a dark-ish
// background, so we don't want to use a color scheme color that
// might also be dark
color: "white"
level: 3
MouseArea {
id: authorMouseArea
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
openArtist()
}
}
}
LabelWithToolTip {
id: albumLabel
text: album
Layout.fillWidth: true
Layout.maximumWidth: headerBar.width - 8 * Kirigami.Units.largeSpacing
wrapMode: Text.Wrap
Layout.alignment: (portrait? Qt.AlignHCenter: Qt.AlignLeft) | Qt.AlignTop
horizontalAlignment: portrait? Text.AlignHCenter : Text.AlignLeft
elide: Text.ElideRight
// Hardcoded because the headerbar blur always makes a dark-ish
// background, so we don't want to use a color scheme color that
// might also be dark
color: "white"
level: 3
MouseArea {
id: albumMouseArea
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
openAlbum()
}
LabelWithToolTip {
id: albumLabel
text: album
Layout.fillWidth: true
wrapMode: Text.Wrap
Layout.alignment: (portrait? Qt.AlignHCenter: Qt.AlignLeft) | Qt.AlignTop
horizontalAlignment: portrait? Text.AlignHCenter : Text.AlignLeft
elide: Text.ElideRight
// Hardcoded because the headerbar blur always makes a dark-ish
// background, so we don't want to use a color scheme color that
// might also be dark
color: "white"
level: 3
MouseArea {
id: albumMouseArea
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
openAlbum()
}
}
}
RatingStar {
id: mainRating
visible: ratingVisible
starRating: trackRating
Layout.fillWidth: true
Layout.alignment: (portrait? Qt.AlignHCenter: Qt.AlignLeft) | Qt.AlignTop
}
RatingStar {
id: mainRating
visible: ratingVisible
starRating: trackRating
Layout.fillWidth: true
Layout.alignment: (portrait? Qt.AlignHCenter: Qt.AlignLeft) | Qt.AlignTop
}
Loader {
......@@ -359,17 +340,13 @@ FocusScope {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignRight | Qt.AlignTop
sourceComponent:
SimplePlayListView {
id: playList
playListModel: elisa.mediaPlayListProxyModel
anchors.fill: parent
}
sourceComponent: SimplePlayListView {
anchors.fill: parent
playListModel: elisa.mediaPlayListProxyModel
}
Layout.alignment: Qt.AlignRight | Qt.AlignTop
}
}
}
......
......@@ -19,6 +19,8 @@ import QtQuick 2.10
import QtQuick.Controls 2.2
import QtQml.Models 2.1
import org.kde.kirigami 2.5 as Kirigami
import org.kde.elisa 1.0
ListView {
......
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