2019-07-13 19:39:01 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
2019-04-29 05:18:36 +10:00
|
|
|
import "../../Base"
|
2019-04-22 05:20:20 +10:00
|
|
|
|
2019-08-28 12:46:31 +10:00
|
|
|
Rectangle {
|
2019-04-22 05:20:20 +10:00
|
|
|
id: banner
|
2019-07-16 22:10:37 +10:00
|
|
|
implicitHeight: childrenRect.height
|
2019-08-28 12:46:31 +10:00
|
|
|
color: theme.controls.box.background
|
2019-04-22 05:20:20 +10:00
|
|
|
|
2019-05-09 03:45:25 +10:00
|
|
|
property alias avatar: bannerAvatar
|
|
|
|
property alias icon: bannerIcon
|
2019-04-22 05:20:20 +10:00
|
|
|
property alias labelText: bannerLabel.text
|
|
|
|
property alias buttonModel: bannerRepeater.model
|
2019-04-29 04:20:30 +10:00
|
|
|
property var buttonCallbacks: []
|
2019-04-22 05:20:20 +10:00
|
|
|
|
2019-07-16 22:10:37 +10:00
|
|
|
HGridLayout {
|
|
|
|
id: bannerGrid
|
|
|
|
width: parent.width
|
|
|
|
flow: bannerAvatarWrapper.width +
|
|
|
|
bannerIcon.width +
|
|
|
|
bannerLabel.implicitWidth +
|
|
|
|
bannerButtons.width >
|
|
|
|
parent.width ?
|
|
|
|
GridLayout.TopToBottom : GridLayout.LeftToRight
|
2019-04-22 05:20:20 +10:00
|
|
|
|
2019-07-16 22:10:37 +10:00
|
|
|
HRowLayout {
|
|
|
|
id: bannerRow
|
2019-04-22 05:20:20 +10:00
|
|
|
|
2019-08-28 12:46:31 +10:00
|
|
|
Rectangle {
|
2019-07-16 22:10:37 +10:00
|
|
|
id: bannerAvatarWrapper
|
|
|
|
color: "black"
|
2019-05-09 03:45:25 +10:00
|
|
|
|
2019-07-16 22:10:37 +10:00
|
|
|
Layout.preferredWidth: bannerAvatar.width
|
|
|
|
Layout.minimumHeight: bannerAvatar.height
|
|
|
|
Layout.preferredHeight: bannerLabel.height
|
2019-05-09 03:45:25 +10:00
|
|
|
|
2019-07-16 22:10:37 +10:00
|
|
|
HUserAvatar {
|
|
|
|
id: bannerAvatar
|
2019-11-04 04:48:12 +11:00
|
|
|
clientUserId: chatPage.userId
|
2019-07-16 22:10:37 +10:00
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
|
|
|
}
|
2019-04-22 05:20:20 +10:00
|
|
|
|
2019-07-16 22:10:37 +10:00
|
|
|
HIcon {
|
|
|
|
id: bannerIcon
|
|
|
|
dimension: bannerLabel.implicitHeight
|
|
|
|
visible: Boolean(svgName)
|
2019-04-22 05:20:20 +10:00
|
|
|
|
2019-07-16 22:10:37 +10:00
|
|
|
Layout.leftMargin: theme.spacing / 2
|
|
|
|
}
|
2019-04-22 05:20:20 +10:00
|
|
|
|
2019-07-16 22:10:37 +10:00
|
|
|
HLabel {
|
|
|
|
id: bannerLabel
|
|
|
|
textFormat: Text.StyledText
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: bannerIcon.Layout.leftMargin
|
|
|
|
Layout.rightMargin: Layout.leftMargin
|
|
|
|
}
|
|
|
|
|
|
|
|
HSpacer {}
|
|
|
|
}
|
2019-04-22 05:20:20 +10:00
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HRowLayout {
|
2019-07-16 22:10:37 +10:00
|
|
|
HRowLayout {
|
|
|
|
id: bannerButtons
|
2019-04-22 05:20:20 +10:00
|
|
|
|
2019-07-16 22:10:37 +10:00
|
|
|
Repeater {
|
|
|
|
id: bannerRepeater
|
|
|
|
model: []
|
2019-04-22 05:20:20 +10:00
|
|
|
|
2019-08-21 07:41:24 +10:00
|
|
|
HButton {
|
2019-07-16 22:10:37 +10:00
|
|
|
id: button
|
|
|
|
text: modelData.text
|
2019-08-22 05:45:13 +10:00
|
|
|
icon.name: modelData.iconName
|
2019-08-29 08:21:13 +10:00
|
|
|
icon.color: modelData.iconColor || theme.icons.colorize
|
2019-07-16 22:10:37 +10:00
|
|
|
onClicked: buttonCallbacks[modelData.name](button)
|
2019-04-22 05:20:20 +10:00
|
|
|
|
2019-07-16 22:10:37 +10:00
|
|
|
Layout.preferredHeight: theme.baseElementsHeight
|
|
|
|
}
|
|
|
|
}
|
2019-04-22 05:20:20 +10:00
|
|
|
}
|
|
|
|
|
2019-08-28 12:46:31 +10:00
|
|
|
Rectangle {
|
2019-07-16 22:10:37 +10:00
|
|
|
id: buttonsRightPadding
|
|
|
|
color: theme.controls.button.background
|
|
|
|
visible: bannerGrid.flow == GridLayout.TopToBottom
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2019-04-22 05:20:20 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|