2020-07-15 21:04:14 +00:00
|
|
|
import QtQuick 2.3
|
|
|
|
import "../../../../../imports"
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
property int chatVerticalPadding: 12
|
|
|
|
property int chatHorizontalPadding: 12
|
|
|
|
|
|
|
|
id: imageChatBox
|
|
|
|
height: {
|
|
|
|
let h = chatVerticalPadding
|
|
|
|
for (let i = 0; i < imageRepeater.count; i++) {
|
2020-07-23 16:23:20 +00:00
|
|
|
h += imageRepeater.itemAt(i).height
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
|
|
|
return h + chatVerticalPadding * imageRepeater.count
|
|
|
|
}
|
|
|
|
color: isCurrentUser ? Style.current.blue : Style.current.lightBlue
|
|
|
|
border.color: "transparent"
|
2020-07-23 18:20:57 +00:00
|
|
|
width: {
|
|
|
|
let w = 0
|
|
|
|
for (let i = 0; i < imageRepeater.count; i++) {
|
|
|
|
if (imageRepeater.itemAt(i).width > w) {
|
|
|
|
w = imageRepeater.itemAt(i).width
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return w + 2 * chatHorizontalPadding
|
|
|
|
}
|
|
|
|
|
2020-07-15 21:04:14 +00:00
|
|
|
radius: 16
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
id: imageRepeater
|
2020-07-20 15:38:24 +00:00
|
|
|
model: {
|
|
|
|
if (!imageUrls) {
|
|
|
|
return []
|
|
|
|
}
|
|
|
|
|
|
|
|
return imageUrls.split(" ")
|
|
|
|
}
|
2020-07-15 21:04:14 +00:00
|
|
|
|
2020-07-23 18:20:57 +00:00
|
|
|
ImageLoader {
|
|
|
|
verticalPadding: imageChatBox.chatVerticalPadding
|
|
|
|
anchors.top: (index === 0) ? parent.top: parent.children[index-1].bottom
|
|
|
|
anchors.topMargin: verticalPadding
|
2020-08-12 15:01:03 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2020-07-23 18:20:57 +00:00
|
|
|
source: modelData
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-16 14:51:12 +00:00
|
|
|
RectangleCorner {}
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|