2023-01-20 00:44:35 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.1
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
2023-01-31 10:49:07 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2023-01-20 00:44:35 +00:00
|
|
|
|
2023-01-31 10:49:07 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2023-03-09 16:40:34 +00:00
|
|
|
Control {
|
2023-01-20 00:44:35 +00:00
|
|
|
id: root
|
|
|
|
|
2023-03-09 16:40:34 +00:00
|
|
|
property string title: ""
|
|
|
|
property string subTitle: ""
|
|
|
|
property string backgroundColor: "transparent"
|
2023-04-03 15:38:05 +00:00
|
|
|
property url mediaUrl : ""
|
|
|
|
property string mediaType: ""
|
|
|
|
property url fallbackImageUrl : ""
|
2023-03-09 16:40:34 +00:00
|
|
|
property bool isLoading: false
|
|
|
|
property bool navigationIconVisible: false
|
2023-01-20 00:44:35 +00:00
|
|
|
|
2023-03-09 16:40:34 +00:00
|
|
|
signal clicked
|
2023-01-31 10:49:07 +00:00
|
|
|
|
|
|
|
implicitHeight: 225
|
|
|
|
implicitWidth: 176
|
2023-01-20 00:44:35 +00:00
|
|
|
|
2023-03-09 16:40:34 +00:00
|
|
|
background: Rectangle {
|
2023-05-11 17:12:22 +00:00
|
|
|
radius: 8
|
|
|
|
color: Theme.palette.baseColor2
|
2023-03-09 16:40:34 +00:00
|
|
|
visible: !root.isLoading && mouse.containsMouse
|
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: ColumnLayout {
|
2023-01-20 00:44:35 +00:00
|
|
|
spacing: 0
|
|
|
|
|
2023-04-03 15:38:05 +00:00
|
|
|
StatusRoundedMedia {
|
2023-01-20 00:44:35 +00:00
|
|
|
id: image
|
2023-03-09 16:40:34 +00:00
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
Layout.margins: Style.current.halfPadding
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: width
|
2023-05-11 17:12:22 +00:00
|
|
|
radius: 8
|
2023-04-03 15:38:05 +00:00
|
|
|
mediaUrl: root.mediaUrl
|
|
|
|
mediaType: root.mediaType
|
|
|
|
fallbackImageUrl: root.fallbackImageUrl
|
2023-01-20 00:44:35 +00:00
|
|
|
border.color: Theme.palette.baseColor2
|
|
|
|
border.width: 1
|
|
|
|
showLoadingIndicator: true
|
2023-03-23 10:23:02 +00:00
|
|
|
color: root.isLoading ? "transparent": root.backgroundColor
|
2023-03-09 16:40:34 +00:00
|
|
|
|
2023-01-31 10:49:07 +00:00
|
|
|
Loader {
|
|
|
|
anchors.fill: parent
|
2023-03-09 16:40:34 +00:00
|
|
|
active: root.isLoading
|
2023-01-31 10:49:07 +00:00
|
|
|
sourceComponent: LoadingComponent {radius: image.radius}
|
|
|
|
}
|
2023-01-20 00:44:35 +00:00
|
|
|
}
|
2023-03-09 16:40:34 +00:00
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
Layout.leftMargin: Style.current.halfPadding
|
|
|
|
Layout.rightMargin: Layout.leftMargin
|
|
|
|
Layout.fillWidth: !root.isLoading
|
|
|
|
Layout.preferredWidth: root.isLoading ? 134 : width
|
|
|
|
|
|
|
|
StatusTextWithLoadingState {
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
Layout.fillWidth: true
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
font.pixelSize: 15
|
|
|
|
customColor: Theme.palette.directColor1
|
|
|
|
font.weight: Font.DemiBold
|
|
|
|
elide: Text.ElideRight
|
|
|
|
text: root.isLoading ? Constants.dummyText : root.title
|
|
|
|
loading: root.isLoading
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusIcon {
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
visible: root.navigationIconVisible
|
|
|
|
icon: "next"
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
2023-01-20 00:44:35 +00:00
|
|
|
}
|
2023-03-09 16:40:34 +00:00
|
|
|
|
2023-01-31 10:49:07 +00:00
|
|
|
StatusTextWithLoadingState {
|
2023-03-09 16:40:34 +00:00
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
Layout.leftMargin: Style.current.halfPadding
|
|
|
|
Layout.rightMargin: Layout.leftMargin
|
|
|
|
Layout.fillWidth: !root.isLoading
|
|
|
|
Layout.preferredWidth: root.isLoading ? 88 : width
|
2023-01-20 00:44:35 +00:00
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
font.pixelSize: 13
|
2023-01-31 10:49:07 +00:00
|
|
|
customColor: Theme.palette.baseColor1
|
2023-01-20 00:44:35 +00:00
|
|
|
elide: Text.ElideRight
|
2023-03-09 16:40:34 +00:00
|
|
|
text: root.isLoading? Constants.dummyText : root.subTitle
|
|
|
|
loading: root.isLoading
|
2023-01-20 00:44:35 +00:00
|
|
|
}
|
|
|
|
|
2023-03-09 16:40:34 +00:00
|
|
|
// Filler
|
|
|
|
Item {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
2023-01-20 00:44:35 +00:00
|
|
|
}
|
2023-03-09 16:40:34 +00:00
|
|
|
|
2023-01-20 00:44:35 +00:00
|
|
|
MouseArea {
|
|
|
|
id: mouse
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
2023-05-11 17:12:22 +00:00
|
|
|
cursorShape: Qt.PointingHandCursor
|
2023-01-20 00:44:35 +00:00
|
|
|
onClicked: {
|
2023-03-09 16:40:34 +00:00
|
|
|
if (!root.isLoading) {
|
|
|
|
root.clicked()
|
2023-01-20 00:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-31 10:49:07 +00:00
|
|
|
}
|