Warning, /multimedia/audiotube/src/contents/ui/AlbumCoverItem.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2023 Jonah BrĂ¼chert <jbb@kaidan.im>
0002 // SPDX-FileCopyrightText: 2023 Mathis BrĂ¼chert <mbb@kaidan.im>
0003 //
0004 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005
0006 import QtQuick 2.15
0007 import QtQuick.Controls 2.15 as Controls
0008 import QtQuick.Layouts 1.15
0009
0010 import org.kde.kirigami 2.15 as Kirigami
0011
0012 Item {
0013 id: root
0014 property alias contentItem: content.children
0015 property alias title: favTitle.text
0016 property alias subtitle: favSubtitle.text
0017 property bool showIcon: true
0018
0019 signal clicked
0020 signal optionsClicked
0021
0022 implicitWidth: mainLayout.implicitWidth
0023 implicitHeight: mainLayout.implicitHeight
0024
0025 MouseArea {
0026 id: coverArea
0027 acceptedButtons: Qt.LeftButton | Qt.RightButton
0028 anchors.fill: parent
0029 onClicked: (mouse) => {
0030 if (mouse.button === Qt.RightButton) {
0031 root.optionsClicked()
0032 } else if (mouse.button === Qt.LeftButton) {
0033 root.clicked()
0034 }
0035 }
0036
0037 hoverEnabled: !Kirigami.Settings.hasTransientTouchInput
0038 onEntered: {
0039 if (!Kirigami.Settings.hasTransientTouchInput) {
0040 selection.visible = true
0041 favTitle.color = Kirigami.Theme.hoverColor
0042 favSubtitle.color = Kirigami.Theme.hoverColor
0043 favTitle.font.bold = true
0044 playAnimationPosition.running = true
0045 playAnimationOpacity.running = true
0046 }
0047 }
0048
0049 onExited: {
0050 selection.visible = false
0051 favTitle.color = Kirigami.Theme.textColor
0052 favSubtitle.color = Kirigami.Theme.disabledTextColor
0053 favTitle.font.bold = false
0054 }
0055 }
0056
0057 ColumnLayout {
0058 id: mainLayout
0059
0060 anchors.fill: parent
0061 Kirigami.ShadowedRectangle {
0062 id: cover
0063
0064 color: Kirigami.Theme.backgroundColor
0065 Layout.margins: 5
0066 width: 200
0067 height: 200
0068 radius: 10
0069 shadow.size: 15
0070 shadow.xOffset: 5
0071 shadow.yOffset: 5
0072 shadow.color: Qt.rgba(0, 0, 0, 0.2)
0073
0074 Item {
0075 id: content
0076 anchors.fill: parent
0077 }
0078
0079 Rectangle {
0080 id: selection
0081
0082 Rectangle {
0083 anchors.fill: parent
0084 color: Kirigami.Theme.hoverColor
0085 radius: 10
0086 opacity: 0.2
0087 }
0088 Item {
0089 visible: root.showIcon
0090
0091 height: parent.height
0092 width: parent.width
0093 NumberAnimation on opacity {
0094 id: playAnimationOpacity
0095 easing.type: Easing.OutCubic
0096 running: false
0097 from: 0
0098 to: 1
0099 }
0100 NumberAnimation on y {
0101 id: playAnimationPosition
0102 easing.type: Easing.OutCubic
0103 running: false
0104 from: 20
0105 to: 0
0106 duration: 100
0107 }
0108 Rectangle {
0109 height: 45
0110 width: 45
0111 radius: 50
0112 color: Kirigami.Theme.hoverColor
0113 opacity: 0.8
0114 anchors.centerIn: parent
0115 }
0116 Kirigami.Icon {
0117 x: 100 - 0.43 * height
0118 y: 100 - 0.5 * height
0119 color: "white"
0120 source: "media-playback-start"
0121 }
0122 }
0123 visible: false
0124 anchors.fill: parent
0125
0126 radius: 9
0127
0128 border.color: Kirigami.Theme.hoverColor
0129 border.width: 2
0130 color: "transparent"
0131 }
0132 }
0133
0134 RowLayout {
0135 Layout.maximumWidth: 210
0136 ColumnLayout {
0137 Layout.fillWidth: true
0138 Controls.Label {
0139 id: favTitle
0140 Layout.fillWidth: true
0141 leftPadding: 5
0142 elide: Text.ElideRight
0143 enabled: false
0144 }
0145 Controls.Label {
0146 id: favSubtitle
0147 Layout.fillWidth: true
0148 leftPadding: 5
0149 color: Kirigami.Theme.disabledTextColor
0150 elide: Text.ElideRight
0151 enabled: false
0152
0153 }
0154 }
0155 Controls.ToolButton {
0156 Layout.fillHeight: true
0157 icon.name: "overflow-menu"
0158 onPressed: root.optionsClicked()
0159 }
0160 }
0161 }
0162 }
0163