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
|
property bool hasImageAttachment: hasAttachment && attachmentMimetype.valid
|
||||||
&& FileType.supportedImageFormats.includes(attachmentMimetype.preferredSuffix)
|
&& FileType.supportedImageFormats.includes(attachmentMimetype.preferredSuffix)
|
||||||
|
|
||||||
|
signal fancyEffectsReasonFound(string fancyEffect)
|
||||||
|
|
||||||
position: ToolBar.Footer
|
position: ToolBar.Footer
|
||||||
|
|
||||||
function addText(text) {
|
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
|
// This use an hack to define: https://doc.qt.io/qt-5/qml-var.html#property-value-initialization-semantics
|
||||||
property var userAutocompleted: ({})
|
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() {
|
function postMessage() {
|
||||||
|
checkForFancyEffectsReason()
|
||||||
roomManager.actionsHandler.postMessage(inputField.text.trim(), attachmentPath,
|
roomManager.actionsHandler.postMessage(inputField.text.trim(), attachmentPath,
|
||||||
replyEventID, editEventId, inputField.userAutocompleted);
|
replyEventID, editEventId, inputField.userAutocompleted);
|
||||||
clearAttachment();
|
clearAttachment();
|
||||||
|
|||||||
@@ -601,6 +601,33 @@ Kirigami.ScrollablePage {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
enabled: Config.showFancyEffects
|
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
|
Kirigami.Theme.colorSet: Kirigami.Theme.View
|
||||||
|
|||||||
Reference in New Issue
Block a user