Warning, /multimedia/audiotube/src/contents/ui/ListHeader.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2022 Mathis BrĂ¼chert <mbb@kaidan.im> 0002 // 0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 0005 import QtQuick 2.15 0006 import QtQuick.Effects 0007 0008 import org.kde.kirigami 2.14 as Kirigami 0009 import org.kde.kirigami.delegates as KirigamiDelegates 0010 import org.kde.kirigamiaddons.components 1.0 as Components 0011 0012 import QtQuick.Controls 2.14 as Controls 0013 import QtQuick.Layouts 1.3 0014 0015 import org.kde.ytmusic 1.0 0016 0017 0018 Item { 0019 id:root 0020 required property string imageSourceURL 0021 property bool rounded : false 0022 required property string title 0023 property string subtitle 0024 property list<Kirigami.Action> visibleActions 0025 property list<Kirigami.Action> overflowActions 0026 0027 height: root.width > 500 ? 200 : 400 0028 0029 Item { 0030 anchors.fill: parent 0031 0032 Image { 0033 scale: 1.8 0034 anchors.fill: parent 0035 asynchronous: true 0036 0037 source: imageSourceURL 0038 fillMode: Image.PreserveAspectCrop 0039 0040 sourceSize.width: 512 0041 sourceSize.height: 512 0042 } 0043 0044 layer.enabled: true 0045 layer.effect: MultiEffect { 0046 brightness: -0.25 0047 saturation: 0.5 0048 0049 blurEnabled: true 0050 autoPaddingEnabled: false 0051 blur: 1.0 0052 blurMax: 40 0053 blurMultiplier: 3.0 0054 } 0055 } 0056 Rectangle { 0057 anchors.fill: parent 0058 gradient: Gradient{ 0059 GradientStop { position: -1.0; color: "transparent" } 0060 GradientStop { position: 1.0; color: Kirigami.Theme.backgroundColor } 0061 0062 } 0063 } 0064 GridLayout { 0065 width: parent.width 0066 0067 flow: root.width > 500?GridLayout.LeftToRight:GridLayout.TopToBottom 0068 Kirigami.ShadowedRectangle { 0069 Layout.alignment: Qt.AlignHCenter 0070 color: Kirigami.Theme.backgroundColor 0071 Layout.margins: 30 0072 width: 150 0073 height: width 0074 radius: rounded ? 100 : 10 0075 shadow.size: 15 0076 shadow.xOffset: 5 0077 shadow.yOffset: 5 0078 shadow.color: Qt.rgba(0, 0, 0, 0.2) 0079 0080 RoundedImage { 0081 source: imageSourceURL 0082 height: parent.height 0083 width: height 0084 radius: rounded ? 100 : 10 0085 } 0086 } 0087 ColumnLayout { 0088 Layout.leftMargin: 30 0089 Layout.rightMargin: 30 0090 Layout.fillWidth: true 0091 0092 0093 Controls.Label { 0094 horizontalAlignment: (root.width <= 500)? Qt.AlignHCenter: Qt.AlignLeft 0095 Layout.fillWidth: true 0096 text: title 0097 font.bold: true 0098 font.pixelSize: 22 0099 elide: Qt.ElideRight 0100 0101 } 0102 Controls.Label { 0103 horizontalAlignment: (root.width <= 500)? Qt.AlignHCenter: Qt.AlignLeft 0104 Layout.fillWidth: true 0105 text: subtitle 0106 elide: Qt.ElideRight 0107 0108 } 0109 RowLayout { 0110 visible: root.visibleActions.length>0 0111 Layout.topMargin: 30 0112 0113 Repeater { 0114 model: root.visibleActions 0115 delegate: Controls.RoundButton{ 0116 required property var modelData 0117 Layout.fillWidth: root.width <= 500 0118 leftPadding: 20 0119 rightPadding: 20 0120 icon.name: modelData.icon.name 0121 text:modelData.text 0122 onClicked: modelData.triggered() 0123 visible: modelData.visible 0124 } 0125 } 0126 Controls.Menu { 0127 id: overflowMenu 0128 Instantiator { 0129 model: root.overflowActions 0130 onObjectAdded: (index, object) => overflowMenu.insertItem(index, object) 0131 onObjectRemoved: (index, object) => overflowMenu.removeItem(object) 0132 delegate: Controls.MenuItem { 0133 required property var modelData 0134 icon.name: modelData.icon.name 0135 text: modelData.text 0136 onTriggered: modelData.triggered() 0137 } 0138 } 0139 } 0140 0141 Components.BottomDrawer { 0142 id: overflowDrawer 0143 0144 parent: applicationWindow().overlay 0145 0146 drawerContentItem: ColumnLayout { 0147 Repeater { 0148 model: root.overflowActions 0149 delegate: KirigamiDelegates.SubtitleDelegate{ 0150 required property var modelData 0151 text: modelData.text 0152 icon.name: modelData.icon.name 0153 onClicked: { 0154 modelData.triggered() 0155 overflowDrawer.close() 0156 overflowDrawer.interactive = false 0157 0158 } 0159 } 0160 } 0161 Item{ 0162 Layout.fillHeight: true 0163 } 0164 0165 } 0166 } 0167 Controls.RoundButton { 0168 onClicked: if (Kirigami.Settings.isMobile) { 0169 overflowDrawer.open() 0170 overflowDrawer.interactive = true 0171 } else { 0172 overflowMenu.popup() 0173 } 0174 visible: root.overflowActions.length > 0 0175 icon.name: "overflow-menu" 0176 } 0177 } 0178 } 0179 } 0180 }