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-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-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-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-07-02 18:25:30 +00:00
|
|
|
radius: Style.current.radius
|
2020-07-22 20:16:06 +00:00
|
|
|
color: hovered ? Style.current.secondaryBackground : Style.current.transparent
|
2020-07-02 18:25:30 +00:00
|
|
|
|
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
|
2020-07-22 20:16:06 +00:00
|
|
|
color: emojiIconContainer.hovered || emojiPopup.opened ? Style.current.blue : Style.current.darkGrey
|
2020-07-02 18:25:30 +00:00
|
|
|
}
|
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
|
2020-07-20 17:04:33 +00:00
|
|
|
visible: !chatColumn.isExtendedInput && txtData.length == 0
|
2020-07-02 18:25:30 +00:00
|
|
|
width: emojiIcon.width + chatButtonsContainer.iconPadding * 2
|
|
|
|
height: emojiIcon.height + chatButtonsContainer.iconPadding * 2
|
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
|
|
|
|
radius: Style.current.radius
|
2020-07-22 20:16:06 +00:00
|
|
|
color: hovered ? Style.current.secondaryBackground : Style.current.transparent
|
2020-07-02 18:25:30 +00:00
|
|
|
|
|
|
|
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
|
2020-07-22 20:16:06 +00:00
|
|
|
color: stickerIconContainer.hovered || stickersPopup.opened ? Style.current.blue : Style.current.darkGrey
|
2020-07-02 18:25:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-20 17:04:33 +00:00
|
|
|
Rectangle {
|
|
|
|
property bool hovered: false
|
|
|
|
visible: !chatColumn.isExtendedInput && (chatsModel.activeChannel.chatType === Constants.chatTypePrivateGroupChat || chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne)
|
|
|
|
id: imageIconContainer
|
|
|
|
width: emojiIcon.width + chatButtonsContainer.iconPadding * 2
|
|
|
|
height: emojiIcon.height + chatButtonsContainer.iconPadding * 2
|
|
|
|
anchors.right: chatSendBtn.visible ? chatSendBtn.left : parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding - chatButtonsContainer.iconPadding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
radius: Style.current.radius
|
2020-07-22 20:16:06 +00:00
|
|
|
color: hovered ? Style.current.secondaryBackground : Style.current.transparent
|
2020-07-20 17:04:33 +00:00
|
|
|
|
|
|
|
Image {
|
|
|
|
id: imageIcon
|
|
|
|
width: 20
|
|
|
|
height: 20
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
source: "../../../img/images_icon.svg"
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: imageIcon
|
|
|
|
source: imageIcon
|
2020-07-22 20:16:06 +00:00
|
|
|
color: imageIconContainer.hovered ? Style.current.blue : Style.current.darkGrey
|
2020-07-20 17:04:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: {
|
|
|
|
imageIconContainer.hovered = true
|
|
|
|
}
|
|
|
|
onExited: {
|
|
|
|
imageIconContainer.hovered = false
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
imageDialog.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
|
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
|
|
|
}
|
|
|
|
##^##*/
|