diff --git a/src/qml/ContextView.qml b/src/qml/ContextView.qml index f97859194c5d8ac45979f38ca19b4ad46285cf09..94a470e81af1338c8cd772ffe23fb362940483d2 100644 --- a/src/qml/ContextView.qml +++ b/src/qml/ContextView.qml @@ -44,7 +44,7 @@ FocusScope { // Header with title HeaderFooterToolbar { Layout.fillWidth: true - type: "header" + toolbarType: HeaderFooterToolbar.ToolbarType.Header contentItems: [ Image { id: mainIcon @@ -248,7 +248,7 @@ FocusScope { // Footer with file path label HeaderFooterToolbar { visible: !topItem.nothingPlaying - type: "footer" + toolbarType: HeaderFooterToolbar.ToolbarType.Footer Layout.fillWidth: true Layout.preferredHeight: Kirigami.Units.gridUnit * 2 contentLayoutSpacing: Kirigami.Units.largeSpacing diff --git a/src/qml/HeaderFooterToolbar.qml b/src/qml/HeaderFooterToolbar.qml index 86831e9ec879166c3ae7146520b553a82d02de95..abe0f3395ad8182b1ab5630327f9d3da9ca6c46d 100644 --- a/src/qml/HeaderFooterToolbar.qml +++ b/src/qml/HeaderFooterToolbar.qml @@ -12,11 +12,14 @@ import org.kde.kirigami 2.5 as Kirigami import org.kde.elisa 1.0 Rectangle { - // Is this a header or a footer? Acceptable values are - // "header" (separator drawn on bottom) - // "footer" (separator drawn on top) - // "other" (no separator drawn) - property string type + enum ToolbarType { + Header, // separator drawn on bottom + Footer, // separator drawn on top + Other // no separator drawn; used for stacking toolbars + } + + // The type of toolbar it is + property int toolbarType: HeaderFooterToolbar.ToolbarType.Header // A list of items to be shown within the header or footer property alias contentItems: contentLayout.children @@ -28,9 +31,9 @@ Rectangle { color: myPalette.window - // Separator line above the header + // Top separator line for a footer Kirigami.Separator { - visible: type == "footer" && type != "other" + visible: toolbarType == HeaderFooterToolbar.ToolbarType.Footer width: parent.width anchors.top: parent.top } @@ -48,9 +51,9 @@ Rectangle { // Items provided by the contentItems property will go here } - // Separator line under the header + // Bottom separator line for a header Kirigami.Separator { - visible: type == "header" && type != "other" + visible: toolbarType == HeaderFooterToolbar.ToolbarType.Header width: parent.width anchors.bottom: parent.bottom } diff --git a/src/qml/MediaPlayListView.qml b/src/qml/MediaPlayListView.qml index be59108b7fe536d0ca3a6fa6912703acdd894011..862064ddd9068e23018949061e73713ab152c21f 100644 --- a/src/qml/MediaPlayListView.qml +++ b/src/qml/MediaPlayListView.qml @@ -119,7 +119,7 @@ FocusScope { // Header with title and toolbar buttons HeaderFooterToolbar { Layout.fillWidth: true - type: "header" + toolbarType: HeaderFooterToolbar.ToolbarType.Header contentItems: [ // Header title @@ -240,7 +240,7 @@ FocusScope { // Footer with number of tracks label HeaderFooterToolbar { - type: "footer" + toolbarType: HeaderFooterToolbar.ToolbarType.Footer Layout.fillWidth: true Layout.preferredHeight: Kirigami.Units.gridUnit * 2 contentItems: [ diff --git a/src/qml/NavigationActionBar.qml b/src/qml/NavigationActionBar.qml index c1ba4e580bd572b052df42c62639e7ff9ddb337b..d458fc181a716e58f47da200003f67057ddf646e 100644 --- a/src/qml/NavigationActionBar.qml +++ b/src/qml/NavigationActionBar.qml @@ -40,7 +40,8 @@ ColumnLayout { signal sort(var order); HeaderFooterToolbar { - type: filterRow.visible? "other" : "header" + toolbarType: filterRow.visible ? HeaderFooterToolbar.ToolbarType.Other + : HeaderFooterToolbar.ToolbarType.Header Layout.fillWidth: true contentItems: [ @@ -151,7 +152,7 @@ ColumnLayout { HeaderFooterToolbar { id: filterRow - type: "header" + toolbarType: HeaderFooterToolbar.ToolbarType.Header Layout.fillWidth: true visible: opacity > 0.0