2023-09-13 09:12:47 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2023-10-09 12:41:27 +00:00
|
|
|
import QtQuick.Window 2.15
|
2023-09-13 09:12:47 +00:00
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
|
|
|
import shared.status 1.0
|
2023-10-09 12:41:27 +00:00
|
|
|
import utils 1.0
|
2023-09-13 09:12:47 +00:00
|
|
|
|
|
|
|
CalloutCard {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
/// The title of the callout card
|
|
|
|
required property string title
|
|
|
|
required property string description
|
|
|
|
required property string footer
|
2023-10-09 12:41:27 +00:00
|
|
|
|
|
|
|
property bool highlight: false
|
|
|
|
|
2023-09-13 09:12:47 +00:00
|
|
|
property StatusAssetSettings logoSettings: StatusAssetSettings {
|
|
|
|
width: 28
|
|
|
|
height: 28
|
|
|
|
bgRadius: bgWidth / 2
|
|
|
|
}
|
|
|
|
|
|
|
|
property string bannerImageSource: ""
|
|
|
|
|
2023-10-09 14:53:59 +00:00
|
|
|
signal clicked(var mouse)
|
2023-09-13 09:12:47 +00:00
|
|
|
|
|
|
|
borderWidth: 1
|
|
|
|
implicitHeight: 290
|
|
|
|
implicitWidth: 305
|
2023-10-09 12:41:27 +00:00
|
|
|
hoverEnabled: true
|
|
|
|
borderColor: hovered || highlight ? Style.current.borderTertiary : Style.current.border
|
|
|
|
|
|
|
|
Behavior on borderColor {
|
|
|
|
ColorAnimation { duration: 200 }
|
|
|
|
}
|
2023-09-13 09:12:47 +00:00
|
|
|
|
|
|
|
contentItem: ColumnLayout {
|
|
|
|
StatusImage {
|
|
|
|
id: bannerImage
|
|
|
|
Layout.fillWidth: true
|
2023-10-09 12:41:27 +00:00
|
|
|
Layout.leftMargin: d.bannerImageMargins
|
|
|
|
Layout.rightMargin: d.bannerImageMargins
|
|
|
|
Layout.topMargin: d.bannerImageMargins
|
2023-09-13 09:12:47 +00:00
|
|
|
Layout.preferredHeight: 170
|
|
|
|
asynchronous: true
|
|
|
|
source: root.bannerImageSource
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
|
|
|
layer.enabled: true
|
|
|
|
layer.effect: root.clippingEffect
|
|
|
|
}
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2023-09-15 11:37:29 +00:00
|
|
|
Layout.margins: 12
|
2023-09-13 09:12:47 +00:00
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.maximumHeight: root.description.length ? 28 : 72
|
|
|
|
StatusSmartIdenticon {
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.preferredWidth: 28
|
|
|
|
Layout.preferredHeight: 28
|
|
|
|
asset: root.logoSettings
|
|
|
|
name: root.logoSettings.name
|
|
|
|
visible: !!root.logoSettings.name.length || !!root.logoSettings.emoji.length
|
|
|
|
}
|
|
|
|
StatusBaseText {
|
|
|
|
text: root.title
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
font.pixelSize: 13
|
|
|
|
font.weight: Font.Medium
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
elide: Text.ElideRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
text: root.description
|
|
|
|
font.pixelSize: 12
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
elide: Text.ElideRight
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
visible: root.description.length
|
|
|
|
}
|
|
|
|
StatusBaseText {
|
|
|
|
id: linkSite
|
|
|
|
Layout.fillWidth: true
|
|
|
|
text: root.footer
|
|
|
|
font.pixelSize: 12
|
|
|
|
lineHeight: 16
|
|
|
|
lineHeightMode: Text.FixedHeight
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
elide: Text.ElideRight
|
|
|
|
verticalAlignment: Text.AlignBottom
|
|
|
|
textFormat: Text.RichText
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: root
|
|
|
|
hoverEnabled: true
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
2023-10-09 14:53:59 +00:00
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
|
|
onClicked: root.clicked(mouse)
|
2023-09-13 09:12:47 +00:00
|
|
|
}
|
2023-10-09 12:41:27 +00:00
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
property real bannerImageMargins: 1 / Screen.devicePixelRatio // image size isn't pixel perfect..
|
|
|
|
}
|
2023-09-13 09:12:47 +00:00
|
|
|
}
|