Commit 0f70dbf7 authored by Nate Graham's avatar Nate Graham 🔩

Use enums for HeaderFooterToolbar types rather than strings

I don't know that QML enums existed back when this component was created
(they were introduced in Qt 5.10). Either way, they do now, so we should
use them.
parent 2ccef9fb
...@@ -44,7 +44,7 @@ FocusScope { ...@@ -44,7 +44,7 @@ FocusScope {
// Header with title // Header with title
HeaderFooterToolbar { HeaderFooterToolbar {
Layout.fillWidth: true Layout.fillWidth: true
type: "header" toolbarType: HeaderFooterToolbar.ToolbarType.Header
contentItems: [ contentItems: [
Image { Image {
id: mainIcon id: mainIcon
...@@ -248,7 +248,7 @@ FocusScope { ...@@ -248,7 +248,7 @@ FocusScope {
// Footer with file path label // Footer with file path label
HeaderFooterToolbar { HeaderFooterToolbar {
visible: !topItem.nothingPlaying visible: !topItem.nothingPlaying
type: "footer" toolbarType: HeaderFooterToolbar.ToolbarType.Footer
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: Kirigami.Units.gridUnit * 2 Layout.preferredHeight: Kirigami.Units.gridUnit * 2
contentLayoutSpacing: Kirigami.Units.largeSpacing contentLayoutSpacing: Kirigami.Units.largeSpacing
......
...@@ -12,11 +12,14 @@ import org.kde.kirigami 2.5 as Kirigami ...@@ -12,11 +12,14 @@ import org.kde.kirigami 2.5 as Kirigami
import org.kde.elisa 1.0 import org.kde.elisa 1.0
Rectangle { Rectangle {
// Is this a header or a footer? Acceptable values are enum ToolbarType {
// "header" (separator drawn on bottom) Header, // separator drawn on bottom
// "footer" (separator drawn on top) Footer, // separator drawn on top
// "other" (no separator drawn) Other // no separator drawn; used for stacking toolbars
property string type }
// The type of toolbar it is
property int toolbarType: HeaderFooterToolbar.ToolbarType.Header
// A list of items to be shown within the header or footer // A list of items to be shown within the header or footer
property alias contentItems: contentLayout.children property alias contentItems: contentLayout.children
...@@ -28,9 +31,9 @@ Rectangle { ...@@ -28,9 +31,9 @@ Rectangle {
color: myPalette.window color: myPalette.window
// Separator line above the header // Top separator line for a footer
Kirigami.Separator { Kirigami.Separator {
visible: type == "footer" && type != "other" visible: toolbarType == HeaderFooterToolbar.ToolbarType.Footer
width: parent.width width: parent.width
anchors.top: parent.top anchors.top: parent.top
} }
...@@ -48,9 +51,9 @@ Rectangle { ...@@ -48,9 +51,9 @@ Rectangle {
// Items provided by the contentItems property will go here // Items provided by the contentItems property will go here
} }
// Separator line under the header // Bottom separator line for a header
Kirigami.Separator { Kirigami.Separator {
visible: type == "header" && type != "other" visible: toolbarType == HeaderFooterToolbar.ToolbarType.Header
width: parent.width width: parent.width
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
} }
......
...@@ -119,7 +119,7 @@ FocusScope { ...@@ -119,7 +119,7 @@ FocusScope {
// Header with title and toolbar buttons // Header with title and toolbar buttons
HeaderFooterToolbar { HeaderFooterToolbar {
Layout.fillWidth: true Layout.fillWidth: true
type: "header" toolbarType: HeaderFooterToolbar.ToolbarType.Header
contentItems: [ contentItems: [
// Header title // Header title
...@@ -240,7 +240,7 @@ FocusScope { ...@@ -240,7 +240,7 @@ FocusScope {
// Footer with number of tracks label // Footer with number of tracks label
HeaderFooterToolbar { HeaderFooterToolbar {
type: "footer" toolbarType: HeaderFooterToolbar.ToolbarType.Footer
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: Kirigami.Units.gridUnit * 2 Layout.preferredHeight: Kirigami.Units.gridUnit * 2
contentItems: [ contentItems: [
......
...@@ -40,7 +40,8 @@ ColumnLayout { ...@@ -40,7 +40,8 @@ ColumnLayout {
signal sort(var order); signal sort(var order);
HeaderFooterToolbar { HeaderFooterToolbar {
type: filterRow.visible? "other" : "header" toolbarType: filterRow.visible ? HeaderFooterToolbar.ToolbarType.Other
: HeaderFooterToolbar.ToolbarType.Header
Layout.fillWidth: true Layout.fillWidth: true
contentItems: [ contentItems: [
...@@ -151,7 +152,7 @@ ColumnLayout { ...@@ -151,7 +152,7 @@ ColumnLayout {
HeaderFooterToolbar { HeaderFooterToolbar {
id: filterRow id: filterRow
type: "header" toolbarType: HeaderFooterToolbar.ToolbarType.Header
Layout.fillWidth: true Layout.fillWidth: true
visible: opacity > 0.0 visible: opacity > 0.0
......
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