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-08-17 15:52:41 +00:00
|
|
|
import "./ChatComponents"
|
2020-06-24 03:23:49 +00:00
|
|
|
|
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-08-03 14:01:47 +00:00
|
|
|
property var onSend: function () {}
|
2020-07-02 18:25:30 +00:00
|
|
|
|
|
|
|
id: chatButtonsContainer
|
2020-06-24 03:23:49 +00:00
|
|
|
|
2020-07-31 15:25:45 +00:00
|
|
|
width: {
|
|
|
|
var w = chatSendBtn.width + emojiIconContainer.width + 2 * iconPadding
|
|
|
|
if(stickerIconContainer.visible) {
|
|
|
|
w += stickerIconContainer.width + 2 * iconPadding;
|
|
|
|
}
|
|
|
|
if(imageIconContainer.visible) {
|
|
|
|
w += imageIconContainer.width + 2 * iconPadding;
|
|
|
|
}
|
|
|
|
return w;
|
|
|
|
}
|
2020-07-09 19:10:28 +00:00
|
|
|
|
2020-06-24 03:23:49 +00:00
|
|
|
Button {
|
|
|
|
id: chatSendBtn
|
2020-07-20 17:04:33 +00:00
|
|
|
visible: txtData.length > 0 || chatColumn.isImage
|
2020-06-24 03:23:49 +00:00
|
|
|
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-08-03 14:01:47 +00:00
|
|
|
onSend();
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
|
|
|
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-08-17 15:52:41 +00:00
|
|
|
ChatInputButton {
|
2020-07-02 18:25:30 +00:00
|
|
|
id: emojiIconContainer
|
2020-08-17 15:52:41 +00:00
|
|
|
source: "../../../img/emojiBtn.svg"
|
2020-07-20 17:04:33 +00:00
|
|
|
anchors.right: {
|
|
|
|
if(stickerIconContainer.visible) return stickerIconContainer.left;
|
|
|
|
if(imageIconContainer.visible) return imageIconContainer.left;
|
|
|
|
return 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-08-17 15:52:41 +00:00
|
|
|
opened: emojiPopup.opened
|
|
|
|
close: function () {
|
|
|
|
emojiPopup.close()
|
2020-07-02 18:25:30 +00:00
|
|
|
}
|
2020-08-17 15:52:41 +00:00
|
|
|
open: function () {
|
|
|
|
emojiPopup.open()
|
2020-07-02 18:25:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-17 15:52:41 +00:00
|
|
|
ChatInputButton {
|
2020-07-02 18:25:30 +00:00
|
|
|
id: stickerIconContainer
|
2020-07-20 17:04:33 +00:00
|
|
|
visible: !chatColumn.isExtendedInput && txtData.length == 0
|
2020-08-17 15:52:41 +00:00
|
|
|
source: "../../../img/stickers_icon.svg"
|
2020-07-20 17:04:33 +00:00
|
|
|
anchors.right: imageIconContainer.visible ? imageIconContainer.left : parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding - chatButtonsContainer.iconPadding * (imageIconContainer.visible ? 2 : 1)
|
2020-07-02 18:25:30 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2020-08-17 15:52:41 +00:00
|
|
|
opened: stickersPopup.opened
|
|
|
|
close: function () {
|
|
|
|
stickersPopup.close()
|
2020-07-02 18:25:30 +00:00
|
|
|
}
|
2020-08-17 15:52:41 +00:00
|
|
|
open: function () {
|
|
|
|
stickersPopup.open()
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-17 15:52:41 +00:00
|
|
|
ChatInputButton {
|
2020-07-20 17:04:33 +00:00
|
|
|
id: imageIconContainer
|
2020-08-17 15:52:41 +00:00
|
|
|
visible: !chatColumn.isExtendedInput && (chatsModel.activeChannel.chatType === Constants.chatTypePrivateGroupChat || chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne)
|
|
|
|
source: "../../../img/images_icon.svg"
|
2020-07-20 17:04:33 +00:00
|
|
|
anchors.right: chatSendBtn.visible ? chatSendBtn.left : parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding - chatButtonsContainer.iconPadding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2020-08-17 15:52:41 +00:00
|
|
|
opened: imageDialog.visible
|
|
|
|
close: function () {
|
|
|
|
imageDialog.close()
|
2020-07-20 17:04:33 +00:00
|
|
|
}
|
2020-08-17 15:52:41 +00:00
|
|
|
open: function () {
|
|
|
|
imageDialog.open()
|
2020-07-20 17:04:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
2020-06-29 22:02:19 +00:00
|
|
|
recentStickers: chatsModel.recentStickers
|
2020-06-24 03:23:49 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
##^##*/
|