2020-09-29 09:06:57 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2021-02-11 15:50:59 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2020-09-29 09:06:57 +00:00
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtMultimedia 5.13
|
|
|
|
import QtQuick.Dialogs 1.3
|
|
|
|
import "../../imports"
|
|
|
|
import "../../shared"
|
|
|
|
import "../../app/AppLayouts/Chat/ChatColumn/samples"
|
2020-10-20 17:38:48 +00:00
|
|
|
import "../../app/AppLayouts/Chat/ChatColumn"
|
2020-09-29 09:06:57 +00:00
|
|
|
|
|
|
|
import "./emojiList.js" as EmojiJSON
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: control
|
|
|
|
signal sendTransactionCommandButtonClicked()
|
|
|
|
signal receiveTransactionCommandButtonClicked()
|
|
|
|
signal stickerSelected(string hashId, string packId)
|
2020-12-07 14:59:24 +00:00
|
|
|
signal sendMessage(var event)
|
2020-09-29 09:06:57 +00:00
|
|
|
|
|
|
|
property bool emojiEvent: false;
|
|
|
|
property bool paste: false;
|
|
|
|
property bool isColonPressed: false;
|
|
|
|
property bool isReply: false
|
|
|
|
property bool isImage: false
|
|
|
|
|
2020-12-04 12:14:18 +00:00
|
|
|
property var recentStickers
|
|
|
|
property var stickerPackList
|
2020-09-29 09:06:57 +00:00
|
|
|
|
|
|
|
property int extraHeightFactor: calculateExtraHeightFactor()
|
2020-12-10 11:53:39 +00:00
|
|
|
property int messageLimit: control.isStatusUpdateInput ? 300 : 2000
|
|
|
|
property int messageLimitVisible: control.isStatusUpdateInput ? 50 : 200
|
2020-09-29 09:06:57 +00:00
|
|
|
|
|
|
|
property int chatType
|
|
|
|
|
2020-12-03 21:58:36 +00:00
|
|
|
property string chatInputPlaceholder: qsTr("Type a message.")
|
2020-12-02 09:10:22 +00:00
|
|
|
|
2020-09-29 09:06:57 +00:00
|
|
|
property alias textInput: messageInputField
|
2020-12-04 11:11:49 +00:00
|
|
|
property bool isStatusUpdateInput: chatType === Constants.chatTypeStatusUpdate
|
2020-09-29 09:06:57 +00:00
|
|
|
|
2020-12-07 14:59:24 +00:00
|
|
|
property var fileUrls: []
|
|
|
|
property alias messageSound: sendMessageSound
|
|
|
|
|
2020-12-07 15:14:50 +00:00
|
|
|
property alias suggestionsList: suggestions
|
2021-02-03 20:13:05 +00:00
|
|
|
property alias suggestions: suggestionsBox
|
2020-12-07 15:14:50 +00:00
|
|
|
|
2020-09-29 09:06:57 +00:00
|
|
|
height: {
|
|
|
|
if (extendedArea.visible) {
|
2020-12-10 11:53:39 +00:00
|
|
|
return messageInput.height + extendedArea.height + (control.isStatusUpdateInput ? 0 : Style.current.bigPadding)
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
if (messageInput.height > messageInput.defaultInputFieldHeight) {
|
|
|
|
if (messageInput.height >= messageInput.maxInputFieldHeight) {
|
2020-12-10 11:53:39 +00:00
|
|
|
return messageInput.maxInputFieldHeight + (control.isStatusUpdateInput ? 0 : Style.current.bigPadding)
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
2020-12-10 11:53:39 +00:00
|
|
|
return messageInput.height + (control.isStatusUpdateInput ? 0 : Style.current.bigPadding)
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
2020-12-10 11:53:39 +00:00
|
|
|
return control.isStatusUpdateInput ? 56 : 64
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
|
|
color: Style.current.background
|
|
|
|
|
|
|
|
Audio {
|
|
|
|
id: sendMessageSound
|
|
|
|
source: "../../sounds/send_message.wav"
|
|
|
|
volume: appSettings.volume
|
2020-10-15 15:04:53 +00:00
|
|
|
muted: !appSettings.notificationSoundsEnabled
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function calculateExtraHeightFactor() {
|
|
|
|
const factor = (messageInputField.length / 500) + 1;
|
|
|
|
return (factor > 5) ? 5 : factor;
|
|
|
|
}
|
|
|
|
|
|
|
|
function insertInTextInput(start, text) {
|
|
|
|
// Repace new lines with entities because `insert` gets rid of them
|
|
|
|
messageInputField.insert(start, text.replace(/\n/g, "<br/>"));
|
|
|
|
}
|
|
|
|
|
2020-12-07 14:59:24 +00:00
|
|
|
property var interpretMessage: function (msg) {
|
2020-11-16 20:21:06 +00:00
|
|
|
if (msg.startsWith("/shrug")) {
|
|
|
|
return msg.replace("/shrug", "") + " ¯\\\\\\_(ツ)\\_/¯"
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
2020-11-16 20:21:06 +00:00
|
|
|
if (msg.startsWith("/tableflip")) {
|
|
|
|
return msg.replace("/tableflip", "") + " (╯°□°)╯︵ ┻━┻"
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return msg
|
|
|
|
}
|
|
|
|
|
2020-11-17 03:07:01 +00:00
|
|
|
function isUploadFilePressed(event) {
|
|
|
|
return (event.key === Qt.Key_U) && (event.modifiers & Qt.ControlModifier) && imageBtn.visible && !imageDialog.visible
|
|
|
|
}
|
|
|
|
|
2021-01-21 15:58:36 +00:00
|
|
|
function checkTextInsert() {
|
|
|
|
if (emojiSuggestions.visible) {
|
|
|
|
emojiSuggestions.addEmoji();
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
if (suggestionsBox.visible) {
|
|
|
|
suggestionsBox.selectCurrentItem();
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2020-11-18 17:14:29 +00:00
|
|
|
function onKeyPress(event){
|
2020-09-29 09:06:57 +00:00
|
|
|
if (event.modifiers === Qt.NoModifier && (event.key === Qt.Key_Enter || event.key === Qt.Key_Return)) {
|
2021-01-21 15:58:36 +00:00
|
|
|
if (checkTextInsert()) {
|
2020-10-20 17:38:48 +00:00
|
|
|
event.accepted = true;
|
|
|
|
return
|
|
|
|
}
|
2021-01-21 15:58:36 +00:00
|
|
|
|
2020-12-07 14:59:24 +00:00
|
|
|
if (control.isStatusUpdateInput) {
|
|
|
|
return // Status update require the send button to be clicked
|
|
|
|
}
|
2020-09-29 09:06:57 +00:00
|
|
|
if (messageInputField.length < messageLimit) {
|
2020-12-07 14:59:24 +00:00
|
|
|
control.sendMessage(event)
|
|
|
|
control.hideExtendedArea();
|
2020-09-29 09:06:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(event) event.accepted = true
|
|
|
|
messageTooLongDialog.open()
|
|
|
|
}
|
|
|
|
|
2021-01-21 15:58:36 +00:00
|
|
|
if (event.key === Qt.Key_Tab) {
|
|
|
|
if (checkTextInsert()) {
|
|
|
|
event.accepted = true;
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-10 19:54:21 +00:00
|
|
|
const message = control.extrapolateCursorPosition();
|
|
|
|
|
2020-11-17 03:07:01 +00:00
|
|
|
// handle new line in blockquote
|
2020-12-10 19:54:21 +00:00
|
|
|
if ((event.key === Qt.Key_Enter || event.key === Qt.Key_Return) && (event.modifiers & Qt.ShiftModifier) && message.data.startsWith(">")) {
|
2020-11-17 03:07:01 +00:00
|
|
|
if(message.data.startsWith(">") && !message.data.endsWith("\n\n")) {
|
|
|
|
let newMessage = ""
|
|
|
|
if (message.data.endsWith("\n> ")) {
|
|
|
|
newMessage = message.data.substr(0, message.data.lastIndexOf("> ")) + "\n\n"
|
|
|
|
} else {
|
|
|
|
newMessage = message.data + "\n> ";
|
|
|
|
}
|
|
|
|
messageInputField.remove(0, messageInputField.cursorPosition);
|
|
|
|
insertInTextInput(0, Emoji.parse(newMessage));
|
|
|
|
}
|
|
|
|
event.accepted = true
|
|
|
|
}
|
|
|
|
// handle backspace when entering an existing blockquote
|
|
|
|
if ((event.key === Qt.Key_Backspace || event.key === Qt.Key_Delete)) {
|
|
|
|
if(message.data.startsWith(">") && message.data.endsWith("\n\n")) {
|
|
|
|
const newMessage = message.data.substr(0, message.data.lastIndexOf("\n")) + "> ";
|
|
|
|
messageInputField.remove(0, messageInputField.cursorPosition);
|
|
|
|
insertInTextInput(0, Emoji.parse(newMessage));
|
|
|
|
event.accepted = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-29 09:06:57 +00:00
|
|
|
if ((event.key === Qt.Key_V) && (event.modifiers & Qt.ControlModifier)) {
|
|
|
|
paste = true;
|
|
|
|
}
|
|
|
|
|
2020-11-17 03:07:01 +00:00
|
|
|
// ⌘⇧U
|
|
|
|
if (isUploadFilePressed(event)) {
|
|
|
|
imageBtn.clicked()
|
|
|
|
event.accepted = true
|
|
|
|
}
|
|
|
|
|
2020-09-29 09:06:57 +00:00
|
|
|
if (event.key === Qt.Key_Down) {
|
2020-10-20 17:38:48 +00:00
|
|
|
suggestionsBox.listView.incrementCurrentIndex()
|
2020-10-20 15:32:03 +00:00
|
|
|
return emojiSuggestions.listView.incrementCurrentIndex()
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
if (event.key === Qt.Key_Up) {
|
2020-10-20 17:38:48 +00:00
|
|
|
suggestionsBox.listView.decrementCurrentIndex()
|
2020-10-20 15:32:03 +00:00
|
|
|
return emojiSuggestions.listView.decrementCurrentIndex()
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
2020-11-18 17:14:29 +00:00
|
|
|
if (event.key === Qt.Key_Escape) {
|
|
|
|
suggestionsBox.hide()
|
|
|
|
}
|
2020-09-29 09:06:57 +00:00
|
|
|
|
|
|
|
isColonPressed = (event.key === Qt.Key_Colon) && (event.modifiers & Qt.ShiftModifier);
|
|
|
|
}
|
|
|
|
|
2020-11-17 03:07:01 +00:00
|
|
|
function wrapSelection(wrapWith) {
|
|
|
|
if (messageInputField.selectionStart - messageInputField.selectionEnd === 0) return
|
|
|
|
insertInTextInput(messageInputField.selectionStart, wrapWith);
|
|
|
|
insertInTextInput(messageInputField.selectionEnd, wrapWith);
|
|
|
|
messageInputField.deselect()
|
|
|
|
}
|
2020-09-29 09:06:57 +00:00
|
|
|
|
|
|
|
function onRelease(event) {
|
|
|
|
// the text doesn't get registered to the textarea fast enough
|
|
|
|
// we can only get it in the `released` event
|
|
|
|
if (paste) {
|
|
|
|
paste = false;
|
2021-02-08 18:23:03 +00:00
|
|
|
const posBeforeEnd = messageInputField.length - messageInputField.cursorPosition;
|
2021-02-08 17:27:24 +00:00
|
|
|
const deparsedEmoji = Emoji.deparse(messageInputField.text);
|
|
|
|
const plainText = chatsModel.plainText(deparsedEmoji);
|
|
|
|
messageInputField.text = Emoji.parse(plainText.replace(/\n/g, "<br />"));
|
2021-02-08 18:23:03 +00:00
|
|
|
messageInputField.cursorPosition = messageInputField.length - posBeforeEnd;
|
2021-02-08 12:38:55 +00:00
|
|
|
|
2020-09-29 09:06:57 +00:00
|
|
|
interrogateMessage();
|
|
|
|
}
|
|
|
|
|
2020-11-18 17:14:29 +00:00
|
|
|
if (event.key !== Qt.Key_Escape) {
|
|
|
|
emojiEvent = emojiHandler(event);
|
|
|
|
if (!emojiEvent) {
|
|
|
|
emojiSuggestions.close()
|
|
|
|
}
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function interrogateMessage() {
|
|
|
|
const text = chatsModel.plainText(Emoji.deparse(messageInputField.text));
|
2021-02-08 12:38:55 +00:00
|
|
|
|
2020-09-29 09:06:57 +00:00
|
|
|
var words = text.split(' ');
|
|
|
|
|
2020-11-19 17:53:53 +00:00
|
|
|
let madeChanges = false
|
|
|
|
let transform = true;
|
2020-09-29 09:06:57 +00:00
|
|
|
for (var i = 0; i < words.length; i++) {
|
2020-11-19 17:53:53 +00:00
|
|
|
transform = true;
|
2020-09-29 09:06:57 +00:00
|
|
|
if (words[i].charAt(0) === ':') {
|
|
|
|
for (var j = 0; j < words[i].length; j++) {
|
|
|
|
if (Utils.isSpace(words[i].charAt(j)) === true || Utils.isPunct(words[i].charAt(j)) === true) {
|
|
|
|
transform = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (transform) {
|
2020-11-19 17:53:53 +00:00
|
|
|
madeChanges = true
|
2020-09-29 09:06:57 +00:00
|
|
|
const codePoint = Emoji.getEmojiUnicode(words[i]);
|
|
|
|
words[i] = words[i].replace(words[i], (codePoint !== undefined) ? Emoji.fromCodePoint(codePoint) : words[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-19 17:53:53 +00:00
|
|
|
if (madeChanges) {
|
|
|
|
messageInputField.remove(0, messageInputField.length);
|
2020-11-17 03:07:01 +00:00
|
|
|
insertInTextInput(0, Emoji.parse(words.join(' ')));
|
2020-11-19 17:53:53 +00:00
|
|
|
}
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// since emoji length is not 1 we need to match that position that TextArea returns
|
|
|
|
// to the actual position in the string.
|
|
|
|
function extrapolateCursorPosition() {
|
|
|
|
// we need only the message part to be html
|
|
|
|
const text = chatsModel.plainText(Emoji.deparse(messageInputField.text));
|
2020-11-17 03:07:01 +00:00
|
|
|
const plainText = Emoji.parse(text);
|
2020-09-29 09:06:57 +00:00
|
|
|
|
|
|
|
var bracketEvent = false;
|
|
|
|
var length = 0;
|
|
|
|
|
|
|
|
for (var i = 0; i < plainText.length;) {
|
|
|
|
if (length >= messageInputField.cursorPosition) break;
|
|
|
|
|
|
|
|
if (!bracketEvent && plainText.charAt(i) !== '<') {
|
|
|
|
i++;
|
|
|
|
length++;
|
|
|
|
} else if (!bracketEvent && plainText.charAt(i) === '<') {
|
|
|
|
bracketEvent = true;
|
|
|
|
i++;
|
|
|
|
} else if (bracketEvent && plainText.charAt(i) !== '>') {
|
|
|
|
i++;
|
|
|
|
} else if (bracketEvent && plainText.charAt(i) === '>') {
|
|
|
|
bracketEvent = false;
|
|
|
|
i++;
|
|
|
|
length++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let textBeforeCursor = Emoji.deparseFromParse(plainText.substr(0, i));
|
|
|
|
return {
|
|
|
|
cursor: countEmojiLengths(plainText.substr(0, i)) + messageInputField.cursorPosition,
|
|
|
|
data: Emoji.deparseFromParse(textBeforeCursor),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function emojiHandler(event) {
|
|
|
|
let message = extrapolateCursorPosition();
|
|
|
|
pollEmojiEvent(message);
|
|
|
|
|
|
|
|
// state machine to handle different forms of the emoji event state
|
|
|
|
if (!emojiEvent && isColonPressed) {
|
|
|
|
return (message.data.length <= 1 || Utils.isSpace(message.data.charAt(message.cursor - 1))) ? true : false;
|
|
|
|
} else if (emojiEvent && isColonPressed) {
|
|
|
|
const index = message.data.lastIndexOf(':', message.cursor - 2);
|
|
|
|
if (index >= 0 && message.cursor > 0) {
|
|
|
|
const shortname = message.data.substr(index, message.cursor);
|
|
|
|
const codePoint = Emoji.getEmojiUnicode(shortname);
|
|
|
|
if (codePoint !== undefined) {
|
|
|
|
replaceWithEmoji(message, shortname, codePoint);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
} else if (emojiEvent && isKeyValid(event.key) && !isColonPressed) {
|
|
|
|
// popup
|
|
|
|
const index2 = message.data.lastIndexOf(':', message.cursor - 1);
|
|
|
|
if (index2 >= 0 && message.cursor > 0) {
|
|
|
|
const emojiPart = message.data.substr(index2, message.cursor);
|
|
|
|
if (emojiPart.length > 2) {
|
|
|
|
const emojis = EmojiJSON.emoji_json.filter(function (emoji) {
|
|
|
|
return emoji.name.includes(emojiPart) ||
|
|
|
|
emoji.shortname.includes(emojiPart) ||
|
|
|
|
emoji.aliases.some(a => a.includes(emojiPart))
|
|
|
|
})
|
|
|
|
|
|
|
|
emojiSuggestions.openPopup(emojis, emojiPart)
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else if (emojiEvent && !isKeyValid(event.key) && !isColonPressed) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function countEmojiLengths(value) {
|
|
|
|
const match = Emoji.getEmojis(value);
|
|
|
|
var length = 0;
|
|
|
|
|
|
|
|
if (match && match.length > 0) {
|
|
|
|
for (var i = 0; i < match.length; i++) {
|
|
|
|
length += Emoji.deparseFromParse(match[i]).length;
|
|
|
|
}
|
|
|
|
length = length - match.length;
|
|
|
|
}
|
|
|
|
return length;
|
|
|
|
}
|
|
|
|
|
|
|
|
function replaceWithEmoji(message, shortname, codePoint) {
|
|
|
|
const encodedCodePoint = Emoji.getEmojiCodepoint(codePoint)
|
|
|
|
const newMessage = message.data
|
|
|
|
.replace(shortname, encodedCodePoint)
|
|
|
|
.replace(/ /g, " ");
|
|
|
|
messageInputField.remove(0, messageInputField.cursorPosition);
|
2020-11-17 03:07:01 +00:00
|
|
|
insertInTextInput(0, Emoji.parse(newMessage));
|
2020-09-29 09:06:57 +00:00
|
|
|
emojiSuggestions.close()
|
|
|
|
emojiEvent = false
|
|
|
|
}
|
|
|
|
|
|
|
|
// check if user has placed cursor near valid emoji colon token
|
|
|
|
function pollEmojiEvent(message) {
|
|
|
|
const index = message.data.lastIndexOf(':', message.cursor);
|
|
|
|
if (index >= 0) {
|
|
|
|
emojiEvent = validSubstr(message.data.substr(index, message.cursor - index));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function validSubstr(substr) {
|
|
|
|
for(var i = 0; i < substr.length; i++) {
|
|
|
|
var c = substr.charAt(i);
|
|
|
|
if (Utils.isSpace(c) === true || Utils.isPunct(c) === true)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function isKeyValid(key) {
|
|
|
|
if (key === Qt.Key_Space || key === Qt.Key_Tab ||
|
|
|
|
(key >= Qt.Key_Exclam && key <= Qt.Key_Slash) ||
|
|
|
|
(key >= Qt.Key_Semicolon && key <= Qt.Key_Question) ||
|
|
|
|
(key >= Qt.Key_BracketLeft && key <= Qt.Key_hyphen))
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function hideExtendedArea() {
|
|
|
|
isImage = false;
|
|
|
|
isReply = false;
|
2020-12-07 14:59:24 +00:00
|
|
|
control.fileUrls = []
|
2020-09-29 09:06:57 +00:00
|
|
|
imageArea.imageSource = "";
|
|
|
|
replyArea.userName = ""
|
|
|
|
replyArea.identicon = ""
|
|
|
|
replyArea.message = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
function showImageArea(imagePath) {
|
|
|
|
isImage = true;
|
|
|
|
isReply = false;
|
2020-12-07 14:59:24 +00:00
|
|
|
control.fileUrls = imageDialog.fileUrls
|
|
|
|
imageArea.imageSource = control.fileUrls[0]
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function showReplyArea(userName, message, identicon) {
|
|
|
|
isReply = true
|
|
|
|
replyArea.userName = userName
|
|
|
|
replyArea.message = message
|
|
|
|
replyArea.identicon = identicon
|
2020-11-23 15:49:30 +00:00
|
|
|
messageInputField.forceActiveFocus();
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
|
2020-12-07 15:14:50 +00:00
|
|
|
ListModel {
|
|
|
|
id: suggestions
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-29 09:06:57 +00:00
|
|
|
FileDialog {
|
|
|
|
id: imageDialog
|
|
|
|
//% "Please choose an image"
|
|
|
|
title: qsTrId("please-choose-an-image")
|
|
|
|
folder: shortcuts.pictures
|
|
|
|
nameFilters: [
|
|
|
|
//% "Image files (*.jpg *.jpeg *.png)"
|
|
|
|
qsTrId("image-files----jpg---jpeg---png-")
|
|
|
|
]
|
|
|
|
onAccepted: {
|
|
|
|
imageBtn.highlighted = false
|
2020-12-10 11:53:39 +00:00
|
|
|
imageBtn2.highlighted = false
|
2020-09-29 09:06:57 +00:00
|
|
|
control.showImageArea()
|
|
|
|
messageInputField.forceActiveFocus();
|
|
|
|
}
|
|
|
|
onRejected: {
|
|
|
|
imageBtn.highlighted = false
|
2020-12-10 11:53:39 +00:00
|
|
|
imageBtn2.highlighted = false
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MessageDialog {
|
|
|
|
id: messageTooLongDialog
|
|
|
|
//% "Your message is too long."
|
|
|
|
title: qsTrId("your-message-is-too-long.")
|
|
|
|
icon: StandardIcon.Critical
|
|
|
|
//% "Please make your message shorter. We have set the limit to 2000 characters to be courteous of others."
|
|
|
|
text: qsTrId("please-make-your-message-shorter.-we-have-set-the-limit-to-2000-characters-to-be-courteous-of-others.")
|
|
|
|
standardButtons: StandardButton.Ok
|
|
|
|
}
|
|
|
|
|
2020-10-20 15:32:03 +00:00
|
|
|
StatusEmojiSuggestionPopup {
|
2020-09-29 09:06:57 +00:00
|
|
|
id: emojiSuggestions
|
|
|
|
}
|
|
|
|
|
2020-10-20 17:38:48 +00:00
|
|
|
SuggestionBox {
|
|
|
|
id: suggestionsBox
|
|
|
|
model: suggestions
|
|
|
|
x : messageInput.x
|
|
|
|
y: -height - Style.current.smallPadding
|
|
|
|
width: messageInput.width
|
|
|
|
filter: messageInputField.text
|
|
|
|
cursorPosition: messageInputField.cursorPosition
|
2020-11-19 20:07:27 +00:00
|
|
|
property: "ensName, localNickname, alias"
|
2020-10-20 17:38:48 +00:00
|
|
|
onItemSelected: function (item, lastAtPosition, lastCursorPosition) {
|
|
|
|
let hasEmoji = Emoji.hasEmoji(messageInputField.text)
|
|
|
|
let currentText = hasEmoji ?
|
|
|
|
chatsModel.plainText(Emoji.deparse(messageInputField.text)) :
|
|
|
|
chatsModel.plainText(messageInputField.text);
|
|
|
|
|
2021-02-08 17:51:31 +00:00
|
|
|
var properties = "ensName, alias"; // Ignore localNickname
|
|
|
|
|
|
|
|
let aliasName = item[properties.split(",").map(p => p.trim()).find(p => !!item[p])]
|
2020-11-18 16:57:02 +00:00
|
|
|
aliasName = aliasName.replace(/(\.stateofus)?\.eth/, "")
|
2020-10-20 17:38:48 +00:00
|
|
|
let nameLen = aliasName.length + 2 // We're doing a +2 here because of the `@` and the trailing whitespace
|
|
|
|
let position = 0;
|
|
|
|
let text = ""
|
|
|
|
if (currentText === "@") {
|
|
|
|
position = nameLen
|
|
|
|
text = "@" + aliasName + " "
|
|
|
|
} else {
|
|
|
|
let left = currentText.substring(0, lastAtPosition)
|
|
|
|
let right = currentText.substring(hasEmoji ? lastCursorPosition + 2 : lastCursorPosition)
|
|
|
|
text = `${left} @${aliasName} ${right}`
|
|
|
|
}
|
|
|
|
|
2020-11-17 03:07:01 +00:00
|
|
|
messageInputField.text = hasEmoji ? Emoji.parse(text) : text
|
2020-10-20 17:38:48 +00:00
|
|
|
messageInputField.cursorPosition = lastAtPosition + aliasName.length + 2
|
|
|
|
suggestionsBox.suggestionsModel.clear()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-29 09:06:57 +00:00
|
|
|
StatusChatCommandsPopup {
|
|
|
|
id: chatCommandsPopup
|
|
|
|
x: 8
|
|
|
|
y: -height
|
|
|
|
onSendTransactionCommandButtonClicked: {
|
|
|
|
control.sendTransactionCommandButtonClicked()
|
|
|
|
chatCommandsPopup.close()
|
|
|
|
}
|
|
|
|
onReceiveTransactionCommandButtonClicked: {
|
|
|
|
control.receiveTransactionCommandButtonClicked()
|
|
|
|
chatCommandsPopup.close()
|
|
|
|
}
|
|
|
|
onClosed: {
|
|
|
|
chatCommandsBtn.highlighted = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusEmojiPopup {
|
|
|
|
id: emojiPopup
|
|
|
|
width: 360
|
|
|
|
height: 440
|
|
|
|
x: parent.width - width - Style.current.halfPadding
|
|
|
|
y: -height
|
|
|
|
emojiSelected: function (text, atCursor) {
|
|
|
|
insertInTextInput(atCursor ? messageInputField.cursorPosition : messageInputField.length, text)
|
|
|
|
emojiBtn.highlighted = false
|
|
|
|
messageInputField.forceActiveFocus();
|
|
|
|
}
|
|
|
|
onClosed: {
|
|
|
|
emojiBtn.highlighted = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusStickersPopup {
|
|
|
|
id: stickersPopup
|
|
|
|
x: parent.width - width - Style.current.halfPadding
|
|
|
|
y: -height
|
2020-12-04 12:14:18 +00:00
|
|
|
enabled: !!control.recentStickers && !!control.stickerPackList
|
2020-09-29 09:06:57 +00:00
|
|
|
recentStickers: control.recentStickers
|
|
|
|
stickerPackList: control.stickerPackList
|
|
|
|
onStickerSelected: {
|
|
|
|
control.stickerSelected(hashId, packId)
|
|
|
|
messageInputField.forceActiveFocus();
|
|
|
|
}
|
|
|
|
onClosed: {
|
|
|
|
stickersBtn.highlighted = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusIconButton {
|
|
|
|
id: chatCommandsBtn
|
|
|
|
icon.name: "chat-commands"
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 4
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: 16
|
2020-12-10 11:53:39 +00:00
|
|
|
visible: control.chatType === Constants.chatTypeOneToOne && !control.isStatusUpdateInput
|
2020-09-29 09:06:57 +00:00
|
|
|
onClicked: {
|
|
|
|
highlighted = true
|
|
|
|
chatCommandsPopup.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusIconButton {
|
|
|
|
id: imageBtn
|
|
|
|
icon.name: "images_icon"
|
|
|
|
icon.height: 18
|
|
|
|
icon.width: 20
|
|
|
|
anchors.left: chatCommandsBtn.visible ? chatCommandsBtn.right : parent.left
|
|
|
|
anchors.leftMargin: chatCommandsBtn.visible ? 2 : 4
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: 16
|
2020-12-10 11:53:39 +00:00
|
|
|
visible: control.chatType !== Constants.chatTypePublic && !control.isStatusUpdateInput
|
2020-09-29 09:06:57 +00:00
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
highlighted = true
|
|
|
|
imageDialog.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: messageInput
|
2020-12-10 11:53:39 +00:00
|
|
|
property int maxInputFieldHeight: control.isStatusUpdateInput ? 123 : 112
|
|
|
|
property int defaultInputFieldHeight: control.isStatusUpdateInput ? 56 : 40
|
2020-09-29 09:06:57 +00:00
|
|
|
anchors.left: imageBtn.visible ? imageBtn.right : parent.left
|
|
|
|
anchors.leftMargin: imageBtn.visible ? 5 : Style.current.smallPadding
|
2020-12-04 11:11:49 +00:00
|
|
|
anchors.top: control.isStatusUpdateInput ? parent.top : undefined
|
|
|
|
anchors.bottom: !control.isStatusUpdateInput ? parent.bottom : undefined
|
|
|
|
anchors.bottomMargin: control.isStatusUpdateInput ? 0 : 12
|
2020-09-29 09:06:57 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.smallPadding
|
|
|
|
height: scrollView.height
|
|
|
|
color: Style.current.inputBackground
|
2020-12-10 11:53:39 +00:00
|
|
|
radius: control.isStatusUpdateInput ? 36 :
|
2021-01-14 20:16:04 +00:00
|
|
|
height > defaultInputFieldHeight + 1 || extendedArea.visible ? 16 : 32
|
2020-09-29 09:06:57 +00:00
|
|
|
|
|
|
|
Rectangle {
|
2020-12-04 11:11:49 +00:00
|
|
|
id: extendedArea
|
|
|
|
visible: isImage || isReply
|
|
|
|
height: {
|
|
|
|
if (visible) {
|
|
|
|
if (isImage) {
|
|
|
|
return imageArea.height + Style.current.halfPadding
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isReply) {
|
|
|
|
return replyArea.height + replyArea.anchors.topMargin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
anchors.left: messageInput.left
|
|
|
|
anchors.right: messageInput.right
|
|
|
|
anchors.bottom: control.isStatusUpdateInput ? undefined : messageInput.top
|
|
|
|
anchors.top: control.isStatusUpdateInput ? messageInput.bottom : undefined
|
|
|
|
anchors.topMargin: control.isStatusUpdateInput ? -Style.current.halfPadding : 0
|
|
|
|
color: Style.current.inputBackground
|
|
|
|
radius: control.isStatusUpdateInput ? 36 : 16
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
color: parent.color
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.left: parent.left
|
|
|
|
height: control.isStatusUpdateInput ? 64 : 30
|
|
|
|
anchors.top: control.isStatusUpdateInput ? parent.top : undefined
|
|
|
|
anchors.topMargin: control.isStatusUpdateInput ? -24 : 0
|
|
|
|
anchors.bottom: control.isStatusUpdateInput ? undefined : parent.bottom
|
|
|
|
anchors.bottomMargin: control.isStatusUpdateInput ? 0 : -height/2
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusChatInputImageArea {
|
|
|
|
id: imageArea
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: control.isStatusUpdateInput ? profileImage.width + Style.current.padding : Style.current.halfPadding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: control.isStatusUpdateInput ? actions.width + 2* Style.current.padding : Style.current.halfPadding
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: control.isStatusUpdateInput ? 0 : Style.current.halfPadding
|
|
|
|
visible: isImage
|
|
|
|
onImageRemoved: {
|
2020-12-07 14:59:24 +00:00
|
|
|
control.fileUrls = []
|
2020-12-04 11:11:49 +00:00
|
|
|
isImage = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusChatInputReplyArea {
|
|
|
|
id: replyArea
|
|
|
|
visible: isReply
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 2
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 2
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 2
|
|
|
|
onCloseButtonClicked: {
|
|
|
|
isReply = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusImageIdenticon {
|
|
|
|
id: profileImage
|
|
|
|
source: profileModel.profile.identicon
|
2020-09-29 09:06:57 +00:00
|
|
|
anchors.left: parent.left
|
2020-12-04 11:11:49 +00:00
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
2020-09-29 09:06:57 +00:00
|
|
|
anchors.top: parent.top
|
2020-12-04 11:11:49 +00:00
|
|
|
anchors.topMargin: Style.current.halfPadding
|
|
|
|
visible: control.isStatusUpdateInput
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ScrollView {
|
|
|
|
id: scrollView
|
|
|
|
anchors.bottom: parent.bottom
|
2020-12-04 11:11:49 +00:00
|
|
|
anchors.left: profileImage.visible ? profileImage.right : parent.left
|
2020-09-29 09:06:57 +00:00
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
|
|
|
anchors.right: actions.left
|
2020-12-04 11:11:49 +00:00
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
2020-09-29 09:06:57 +00:00
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
|
|
height: {
|
2020-10-26 17:10:14 +00:00
|
|
|
if (messageInputField.implicitHeight <= messageInput.defaultInputFieldHeight) {
|
2020-09-29 09:06:57 +00:00
|
|
|
return messageInput.defaultInputFieldHeight
|
|
|
|
}
|
2020-10-26 17:10:14 +00:00
|
|
|
if (messageInputField.implicitHeight >= messageInput.maxInputFieldHeight) {
|
2020-09-29 09:06:57 +00:00
|
|
|
return messageInput.maxInputFieldHeight
|
|
|
|
}
|
2020-10-26 17:10:14 +00:00
|
|
|
return messageInputField.implicitHeight
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TextArea {
|
|
|
|
id: messageInputField
|
|
|
|
textFormat: Text.RichText
|
|
|
|
verticalAlignment: TextEdit.AlignVCenter
|
|
|
|
font.pixelSize: 15
|
|
|
|
font.family: Style.current.fontRegular.name
|
|
|
|
wrapMode: TextArea.Wrap
|
2020-12-29 18:18:50 +00:00
|
|
|
height: parent.height
|
2020-12-10 11:53:39 +00:00
|
|
|
placeholderText: qsTr("Type a message")
|
2020-09-29 09:06:57 +00:00
|
|
|
placeholderTextColor: Style.current.secondaryText
|
|
|
|
selectByMouse: true
|
|
|
|
color: Style.current.textColor
|
|
|
|
topPadding: Style.current.smallPadding
|
|
|
|
bottomPadding: 12
|
2020-11-18 17:14:29 +00:00
|
|
|
Keys.onPressed: onKeyPress(event)
|
2020-09-29 09:06:57 +00:00
|
|
|
Keys.onReleased: onRelease(event) // gives much more up to date cursorPosition
|
2020-11-17 03:07:01 +00:00
|
|
|
Keys.onShortcutOverride: event.accepted = isUploadFilePressed(event)
|
2020-09-29 09:06:57 +00:00
|
|
|
leftPadding: 0
|
|
|
|
background: Rectangle {
|
|
|
|
color: "transparent"
|
|
|
|
}
|
2021-01-22 19:44:01 +00:00
|
|
|
selectionColor: Style.current.primarySelectionColor
|
2021-02-11 15:50:59 +00:00
|
|
|
persistentSelection: true
|
|
|
|
onReleased: function (event) {
|
|
|
|
if (messageInputField.selectedText.trim() !== "") {
|
|
|
|
let x = event.x - (textFormatMenu.width / 2)
|
|
|
|
textFormatMenu.popup(x, -messageInputField.height-2)
|
2021-02-15 12:45:08 +00:00
|
|
|
messageInputField.forceActiveFocus();
|
2021-02-11 15:50:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusTextFormatMenu {
|
|
|
|
id: textFormatMenu
|
|
|
|
Action {
|
|
|
|
icon.name: "format-text-bold"
|
|
|
|
icon.width: 12
|
|
|
|
icon.height: 16
|
|
|
|
onTriggered: wrapSelection("**")
|
|
|
|
text: qsTr("Bold")
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
icon.name: "format-text-italic"
|
|
|
|
icon.width: 12
|
|
|
|
icon.height: 16
|
|
|
|
onTriggered: wrapSelection("*")
|
|
|
|
text: qsTr("Italic")
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
icon.name: "format-text-strike-through"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 18
|
|
|
|
onTriggered: wrapSelection("~~")
|
|
|
|
text: qsTr("Strikethrough")
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
icon.name: "format-text-code"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 18
|
|
|
|
onTriggered: wrapSelection("`")
|
|
|
|
text: qsTr("Code")
|
|
|
|
}
|
|
|
|
}
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
2021-02-15 12:45:08 +00:00
|
|
|
|
|
|
|
Shortcut {
|
|
|
|
enabled: messageInputField.activeFocus
|
|
|
|
sequence: StandardKey.Bold
|
|
|
|
onActivated: wrapSelection("**")
|
2020-11-17 03:07:01 +00:00
|
|
|
}
|
2021-02-15 12:45:08 +00:00
|
|
|
Shortcut {
|
|
|
|
enabled: messageInputField.activeFocus
|
|
|
|
sequence: StandardKey.Italic
|
|
|
|
onActivated: wrapSelection("*")
|
2020-11-17 03:07:01 +00:00
|
|
|
}
|
2021-02-15 12:45:08 +00:00
|
|
|
Shortcut {
|
|
|
|
enabled: messageInputField.activeFocus
|
|
|
|
sequence: "Ctrl+Shift+Alt+C"
|
|
|
|
onActivated: wrapSelection("```")
|
2020-11-17 03:07:01 +00:00
|
|
|
}
|
2021-02-15 12:45:08 +00:00
|
|
|
Shortcut {
|
|
|
|
enabled: messageInputField.activeFocus
|
|
|
|
sequence: "Ctrl+Shift+C"
|
|
|
|
onActivated: wrapSelection("`")
|
2020-11-17 03:07:01 +00:00
|
|
|
}
|
2021-02-15 12:45:08 +00:00
|
|
|
Shortcut {
|
|
|
|
enabled: messageInputField.activeFocus
|
|
|
|
sequence: "Ctrl+Alt+-"
|
|
|
|
onActivated: wrapSelection("~~")
|
2020-11-17 03:07:01 +00:00
|
|
|
}
|
2021-02-15 12:45:08 +00:00
|
|
|
Shortcut {
|
|
|
|
enabled: messageInputField.activeFocus
|
|
|
|
sequence: "Ctrl+Shift+X"
|
|
|
|
onActivated: wrapSelection("~~")
|
2020-11-17 03:07:01 +00:00
|
|
|
}
|
2021-02-15 12:45:08 +00:00
|
|
|
Shortcut {
|
|
|
|
enabled: messageInputField.activeFocus
|
|
|
|
sequence: "Ctrl+Meta+Space"
|
|
|
|
onActivated: emojiBtn.clicked()
|
2020-11-17 03:07:01 +00:00
|
|
|
}
|
2021-02-15 12:45:08 +00:00
|
|
|
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
color: parent.color
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.right: parent.right
|
2020-12-04 11:11:49 +00:00
|
|
|
visible: !control.isStatusUpdateInput
|
2020-09-29 09:06:57 +00:00
|
|
|
height: parent.height / 2
|
|
|
|
width: 32
|
|
|
|
radius: Style.current.radius
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: messageLengthLimit
|
|
|
|
property int remainingChars: messageLimit - messageInputField.length
|
|
|
|
text: remainingChars.toString()
|
|
|
|
visible: remainingChars <= control.messageLimitVisible
|
|
|
|
color: (remainingChars <= 0) ? Style.current.danger : Style.current.textColor
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: actions.top
|
2020-12-10 11:53:39 +00:00
|
|
|
anchors.rightMargin: control.isStatusUpdateInput ? Style.current.padding : Style.current.radius
|
2020-09-29 09:06:57 +00:00
|
|
|
leftPadding: Style.current.halfPadding
|
|
|
|
rightPadding: Style.current.halfPadding
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: actions
|
2020-12-10 11:53:39 +00:00
|
|
|
width: control.isStatusUpdateInput ?
|
|
|
|
imageBtn2.width + sendBtn.anchors.leftMargin + sendBtn.width :
|
|
|
|
emojiBtn.width + stickersBtn.anchors.leftMargin + stickersBtn.width
|
|
|
|
anchors.bottom: control.isStatusUpdateInput && extendedArea.visible ? extendedArea.bottom : parent.bottom
|
|
|
|
anchors.bottomMargin: control.isStatusUpdateInput ? Style.current.smallPadding+2: 4
|
2020-09-29 09:06:57 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.radius
|
|
|
|
height: emojiBtn.height
|
|
|
|
|
2020-12-10 11:53:39 +00:00
|
|
|
StatusIconButton {
|
|
|
|
id: imageBtn2
|
|
|
|
icon.name: "images_icon"
|
|
|
|
icon.height: 18
|
|
|
|
icon.width: 20
|
|
|
|
anchors.right: sendBtn.left
|
|
|
|
anchors.rightMargin: 2
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
visible: control.isStatusUpdateInput
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
highlighted = true
|
|
|
|
imageDialog.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
id: sendBtn
|
|
|
|
icon.source: "../../app/img/send.svg"
|
|
|
|
icon.width: 16
|
|
|
|
icon.height: 18
|
2021-01-29 10:00:37 +00:00
|
|
|
borderRadius: 16
|
2020-12-10 11:53:39 +00:00
|
|
|
text: qsTr("Send")
|
2021-01-29 10:00:37 +00:00
|
|
|
type: "secondary"
|
2020-12-10 11:53:39 +00:00
|
|
|
flat: true
|
2021-01-29 10:00:37 +00:00
|
|
|
showBorder: true
|
|
|
|
forceBgColorOnHover: true
|
2020-12-10 11:53:39 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
visible: imageBtn2.visible
|
2020-12-17 10:08:30 +00:00
|
|
|
highlighted: chatsModel.plainText(Emoji.deparse(messageInputField.text)).length > 0 || isImage
|
|
|
|
enabled: highlighted && messageInputField.length < messageLimit
|
|
|
|
onClicked: function (event) {
|
|
|
|
control.sendMessage(event)
|
|
|
|
control.hideExtendedArea();
|
|
|
|
}
|
2020-12-10 11:53:39 +00:00
|
|
|
}
|
|
|
|
|
2020-09-29 09:06:57 +00:00
|
|
|
StatusIconButton {
|
|
|
|
id: emojiBtn
|
2020-12-10 11:53:39 +00:00
|
|
|
visible: !imageBtn2.visible
|
2020-09-29 09:06:57 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
icon.name: "emojiBtn"
|
|
|
|
type: "secondary"
|
|
|
|
onClicked: {
|
|
|
|
stickersPopup.close()
|
|
|
|
if (emojiPopup.opened) {
|
|
|
|
emojiPopup.close()
|
|
|
|
highlighted = false
|
|
|
|
} else {
|
|
|
|
emojiPopup.open()
|
|
|
|
highlighted = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusIconButton {
|
|
|
|
id: stickersBtn
|
|
|
|
anchors.left: emojiBtn.right
|
|
|
|
anchors.leftMargin: 2
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
icon.name: "stickers_icon"
|
2020-12-10 11:53:39 +00:00
|
|
|
visible: profileModel.network.current === Constants.networkMainnet && emojiBtn.visible
|
2020-11-23 19:14:48 +00:00
|
|
|
width: visible ? 32 : 0
|
2020-09-29 09:06:57 +00:00
|
|
|
type: "secondary"
|
|
|
|
onClicked: {
|
|
|
|
emojiPopup.close()
|
|
|
|
if (stickersPopup.opened) {
|
|
|
|
stickersPopup.close()
|
|
|
|
highlighted = false
|
|
|
|
} else {
|
|
|
|
stickersPopup.open()
|
|
|
|
highlighted = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|