Fancy effects: add fancy effects support for chatTextInput
This commit is contained in:
committed by
Carl Schwan
parent
c2aab690b6
commit
5ab44f1897
@@ -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();
|
||||
|
||||
@@ -601,6 +601,33 @@ Kirigami.ScrollablePage {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
enabled: Config.showFancyEffects
|
||||
|
||||
function processFancyEffectsReason(fancyEffect) {
|
||||
console.log("onFancyEffectsReasonFound", fancyEffect)
|
||||
if (fancyEffect === "snowflake") {
|
||||
fancyEffectsContainer.showSnowEffect()
|
||||
}
|
||||
if (fancyEffect === "fireworks") {
|
||||
fancyEffectsContainer.showFireworksEffect()
|
||||
}
|
||||
if (fancyEffect === "confetti") {
|
||||
fancyEffectsContainer.showConfettiEffect()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: messageEventModel
|
||||
onFancyEffectsReasonFound: {
|
||||
fancyEffectsContainer.processFancyEffectsReason(fancyEffect)
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: chatTextInput
|
||||
onFancyEffectsReasonFound: {
|
||||
fancyEffectsContainer.processFancyEffectsReason(fancyEffect)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.View
|
||||
|
||||
Reference in New Issue
Block a user