60 lines
1.6 KiB
QML
60 lines
1.6 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import QtQuick.Layouts
|
|
|
|
Rectangle {
|
|
id: root
|
|
|
|
required property var theme
|
|
required property var app
|
|
required property bool selected
|
|
required property bool enableCacheFolder
|
|
|
|
signal activated
|
|
|
|
width: theme.cardWidth
|
|
height: theme.cardHeight
|
|
radius: theme.cornerRadius
|
|
color: theme.cardBg
|
|
border.width: selected ? 3 : 1
|
|
border.color: selected ? theme.selectedBorder : theme.cardBorder
|
|
clip: true
|
|
|
|
HttpImageCache {
|
|
id: httpCache
|
|
url: root.app.isIcon ? "" : String(root.app.image)
|
|
cacheEnabled: root.enableCacheFolder
|
|
}
|
|
|
|
ColumnLayout {
|
|
spacing: 10
|
|
width: root.theme.cardWidth
|
|
height: root.theme.cardHeight
|
|
anchors.fill: parent
|
|
anchors.margins: root.theme.cardPadding
|
|
|
|
Image {
|
|
fillMode: Image.PreserveAspectFit
|
|
Layout.alignment: Qt.AlignCenter
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
source: root.app.isIcon ? Quickshell.iconPath(root.app.image) : httpCache.source
|
|
sourceSize.width: root.app.isIcon ? root.app.dims[0] : 0
|
|
sourceSize.height: root.app.isIcon ? root.app.dims[1] : 0
|
|
}
|
|
Text {
|
|
id: label
|
|
elide: Text.ElideRight
|
|
color: root.theme.textColor
|
|
text: root.app.name
|
|
font.pixelSize: root.theme.fontSize
|
|
Layout.alignment: Qt.AlignHCenter
|
|
}
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: root.activated()
|
|
}
|
|
}
|