2020-06-24 03:23:49 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2020-07-02 18:25:30 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2020-06-24 03:23:49 +00:00
|
|
|
import "../../../../imports"
|
2020-07-06 17:54:41 +00:00
|
|
|
import "../../../../shared"
|
2020-06-24 03:23:49 +00:00
|
|
|
import "../components"
|
|
|
|
|
2020-07-02 18:25:30 +00:00
|
|
|
Item {
|
|
|
|
property int iconPadding: 6
|
2020-07-02 18:49:02 +00:00
|
|
|
property var addToChat: function () {}
|
2020-07-02 18:25:30 +00:00
|
|
|
|
|
|
|
id: chatButtonsContainer
|
2020-06-24 03:23:49 +00:00
|
|
|
|
2020-07-09 19:10:28 +00:00
|
|
|
width: chatSendBtn.width + emojiIconContainer.width + 2 * iconPadding
|
|
|
|
|
2020-06-24 03:23:49 +00:00
|
|
|
Button {
|
|
|
|
id: chatSendBtn
|
|
|
|
visible: txtData.length > 0
|
|
|
|
width: 30
|
|
|
|
height: 30
|
|
|
|
text: ""
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.rightMargin: Style.current.padding
|
2020-06-24 03:23:49 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.right: parent.right
|
|
|
|
onClicked: {
|
2020-07-12 01:03:39 +00:00
|
|
|
chatsModel.sendMessage(txtData.text, chatColumn.isReply ? SelectedMessage.messageId : "")
|
2020-06-24 03:23:49 +00:00
|
|
|
txtData.text = ""
|
|
|
|
}
|
|
|
|
background: Rectangle {
|
2020-07-02 15:14:31 +00:00
|
|
|
color: parent.enabled ? Style.current.blue : Style.current.grey
|
2020-06-24 03:23:49 +00:00
|
|
|
radius: 50
|
|
|
|
}
|
2020-07-06 17:54:41 +00:00
|
|
|
SVGImage {
|
2020-06-24 03:23:49 +00:00
|
|
|
source: "../../../img/arrowUp.svg"
|
2020-07-09 19:10:28 +00:00
|
|
|
width: 13
|
|
|
|
height: 17
|
2020-06-24 03:23:49 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-02 18:25:30 +00:00
|
|
|
Rectangle {
|
|
|
|
property bool hovered: false
|
|
|
|
|
|
|
|
id: emojiIconContainer
|
|
|
|
width: emojiIcon.width + chatButtonsContainer.iconPadding * 2
|
|
|
|
height: emojiIcon.height + chatButtonsContainer.iconPadding * 2
|
2020-07-06 15:03:41 +00:00
|
|
|
anchors.right: txtData.length == 0 ? stickerIconContainer.left : chatSendBtn.left
|
2020-07-02 18:25:30 +00:00
|
|
|
anchors.rightMargin: Style.current.padding - chatButtonsContainer.iconPadding * 2
|
2020-06-24 03:23:49 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2020-07-02 18:25:30 +00:00
|
|
|
radius: Style.current.radius
|
|
|
|
color: hovered ? Style.current.lightBlue : Style.current.transparent
|
|
|
|
|
2020-07-06 17:54:41 +00:00
|
|
|
SVGImage {
|
2020-07-02 18:25:30 +00:00
|
|
|
id: emojiIcon
|
|
|
|
visible: txtData.length == 0
|
|
|
|
width: 20
|
|
|
|
height: 20
|
2020-07-06 17:54:41 +00:00
|
|
|
// fillMode: Image.PreserveAspectFit
|
2020-07-02 18:25:30 +00:00
|
|
|
source: "../../../img/emojiBtn.svg"
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: emojiIcon
|
|
|
|
source: emojiIcon
|
|
|
|
color: emojiIconContainer.hovered || emojiPopup.opened ? Style.current.blue : Style.current.transparent
|
|
|
|
}
|
2020-06-24 03:23:49 +00:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
2020-07-02 18:25:30 +00:00
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: {
|
|
|
|
emojiIconContainer.hovered = true
|
|
|
|
}
|
|
|
|
onExited: {
|
|
|
|
emojiIconContainer.hovered = false
|
|
|
|
}
|
2020-06-24 03:23:49 +00:00
|
|
|
onClicked: {
|
2020-07-02 17:48:06 +00:00
|
|
|
if (emojiPopup.opened) {
|
|
|
|
emojiPopup.close()
|
2020-06-24 03:23:49 +00:00
|
|
|
} else {
|
2020-07-02 17:48:06 +00:00
|
|
|
emojiPopup.open()
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
2020-07-02 18:25:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
property bool hovered: false
|
|
|
|
|
|
|
|
id: stickerIconContainer
|
|
|
|
visible: txtData.length == 0
|
|
|
|
width: emojiIcon.width + chatButtonsContainer.iconPadding * 2
|
|
|
|
height: emojiIcon.height + chatButtonsContainer.iconPadding * 2
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding - chatButtonsContainer.iconPadding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
radius: Style.current.radius
|
|
|
|
color: hovered ? Style.current.lightBlue : Style.current.transparent
|
|
|
|
|
|
|
|
Image {
|
|
|
|
id: stickersIcon
|
|
|
|
width: 20
|
|
|
|
height: 20
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
source: "../../../img/stickers_icon.svg"
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: stickersIcon
|
|
|
|
source: stickersIcon
|
|
|
|
color: stickerIconContainer.hovered || stickersPopup.opened ? Style.current.blue : Style.current.transparent
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: {
|
|
|
|
stickerIconContainer.hovered = true
|
|
|
|
}
|
|
|
|
onExited: {
|
|
|
|
stickerIconContainer.hovered = false
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
if (stickersPopup.opened) {
|
|
|
|
stickersPopup.close()
|
|
|
|
} else {
|
|
|
|
stickersPopup.open()
|
|
|
|
}
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StickersPopup {
|
|
|
|
id: stickersPopup
|
|
|
|
width: 360
|
|
|
|
height: 440
|
|
|
|
x: parent.width - width - 8
|
|
|
|
y: parent.height - sendBtns.height - height - 8
|
|
|
|
stickerList: chatsModel.stickers
|
|
|
|
stickerPackList: chatsModel.stickerPacks
|
|
|
|
}
|
2020-07-02 17:48:06 +00:00
|
|
|
|
|
|
|
EmojiPopup {
|
|
|
|
id: emojiPopup
|
|
|
|
width: 360
|
|
|
|
height: 440
|
|
|
|
x: parent.width - width - 8
|
|
|
|
y: parent.height - sendBtns.height - height - 8
|
2020-07-02 18:49:02 +00:00
|
|
|
addToChat: chatButtonsContainer.addToChat
|
2020-07-02 17:48:06 +00:00
|
|
|
}
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
2020-07-09 19:10:28 +00:00
|
|
|
D{i:0;formeditorColor:"#ffffff";formeditorZoom:1.75}
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
|
|
|
##^##*/
|