// SPDX-FileCopyrightText: 2022 Tobias Fella // SPDX-FileCopyrightText: 2026 Matvey Shcherbinin // SPDX-License-Identifier: GPL-2.0-or-later // // Adapted from NeoChat's src/chatbar/EmojiDelegate.qml. // // one thing is gone: the Image half, which drew Matrix custom emoji and // stickers from an mxc:// URI. import QtQuick import QtQuick.Controls as QQC2 import org.kde.kirigami as Kirigami import koutnet.app QQC2.ItemDelegate { id: root // the shortcode, and the name the skin tone variants are filed under property string name // the CLDR name, which is the part a person can actually read - Telegram // puts the name of the emoji under the cursor, not its codepoint property string description property string emoji property bool showTones: false readonly property string readableName: description !== "" ? description : name QQC2.ToolTip.text: root.readableName QQC2.ToolTip.visible: hovered && root.readableName !== "" QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay Accessible.name: root.readableName // no padding of its own: the grid leaves the room between the emoji instead, // and a cell that pads itself again leaves the glyph small inside its own // highlight padding: 0 contentItem: Item { QQC2.Label { anchors.fill: parent text: root.emoji horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font.family: "Noto Color Emoji, Segoe UI Emoji, Apple Color Emoji, emoji" // a share of the cell rather than the cell less a fixed margin, which // came out of a cell a quarter of the size font.pixelSize: Math.round(height * 0.8) elide: Text.ElideNone wrapMode: Text.NoWrap textFormat: Text.PlainText Kirigami.Icon { width: parent.height * 0.28 height: width source: "arrow-down-symbolic" anchors.bottom: parent.bottom anchors.right: parent.right visible: root.showTones } } } background: Rectangle { Kirigami.Theme.colorSet: Kirigami.Theme.ColorSet.View color: root.checked ? ThemePalette.accent : ThemePalette.surface radius: Kirigami.Units.cornerRadius Rectangle { radius: Kirigami.Units.cornerRadius anchors.fill: parent color: ThemePalette.accent opacity: root.hovered && !root.pressed ? 0.2 : 0 } } }