Fancy effects: add fancy effects support for chatTextInput

This commit is contained in:
Alexey Andreyev
2021-02-08 21:01:25 +03:00
committed by Carl Schwan
parent c2aab690b6
commit 5ab44f1897
2 changed files with 50 additions and 0 deletions

View File

@@ -38,6 +38,8 @@ ToolBar {
property bool hasImageAttachment: hasAttachment && attachmentMimetype.valid
&& FileType.supportedImageFormats.includes(attachmentMimetype.preferredSuffix)
signal fancyEffectsReasonFound(string fancyEffect)
position: ToolBar.Footer
function addText(text) {
@@ -474,7 +476,28 @@ ToolBar {
// This use an hack to define: https://doc.qt.io/qt-5/qml-var.html#property-value-initialization-semantics
property var userAutocompleted: ({})
function checkForFancyEffectsReason() {
var inputFieldText = inputField.text.trim()
console.log(inputFieldText)
if (inputFieldText.includes('\u{2744}')) {
root.fancyEffectsReasonFound("snowflake")
}
if (inputFieldText.includes('\u{1F386}')) {
root.fancyEffectsReasonFound("fireworks")
}
if (inputFieldText.includes('\u{1F387}')) {
root.fancyEffectsReasonFound("fireworks")
}
if (inputFieldText.includes('\u{1F389}')) {
root.fancyEffectsReasonFound("confetti")
}
if (inputFieldText.includes('\u{1F38A}')) {
root.fancyEffectsReasonFound("confetti")
}
}
function postMessage() {
checkForFancyEffectsReason()
roomManager.actionsHandler.postMessage(inputField.text.trim(), attachmentPath,
replyEventID, editEventId, inputField.userAutocompleted);
clearAttachment();