2020-10-20 15:32:03 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtGraphicalEffects 1.12
|
|
|
|
import QtQuick.Dialogs 1.3
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-10-20 15:32:03 +00:00
|
|
|
import "../../shared"
|
|
|
|
|
|
|
|
StatusInputListPopup {
|
|
|
|
property string shortname
|
|
|
|
|
|
|
|
id: emojiSuggestions
|
|
|
|
getImageSource: function (modelData) {
|
2020-11-17 03:07:01 +00:00
|
|
|
return `../../imports/twemoji/72x72/${modelData.unicode}.png`
|
2020-10-20 15:32:03 +00:00
|
|
|
}
|
|
|
|
getText: function (modelData) {
|
|
|
|
return modelData.shortname
|
|
|
|
}
|
|
|
|
onClicked: function (index) {
|
|
|
|
emojiSuggestions.addEmoji(index)
|
|
|
|
}
|
|
|
|
|
|
|
|
function openPopup(emojisParam, shortnameParam) {
|
|
|
|
modelList = emojisParam
|
|
|
|
shortname = shortnameParam
|
|
|
|
emojiSuggestions.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
function addEmoji(index) {
|
|
|
|
if (index === undefined) {
|
|
|
|
index = listView.currentIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
const message = extrapolateCursorPosition();
|
|
|
|
const unicode = emojiSuggestions.modelList[index].unicode_alternates || emojiSuggestions.modelList[index].unicode
|
|
|
|
replaceWithEmoji(message, emojiSuggestions.shortname, unicode)
|
|
|
|
}
|
|
|
|
}
|