Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
sudo apt-get update -qq
sudo apt-get install -y -q qt6-declarative-dev-tools qml6-module-qttest qml6-module-qtquick qml6-module-qtquick-window qml6-module-qtqml-workerscript
python3 scripts/test-read-ui.py
- name: Composer emoji keyboard regression
run: |
sudo apt-get install -y -q qml6-module-qtquick-controls qml6-module-qtquick-templates
python3 scripts/test-composer-emoji-ui.py
- name: OTP desktop adapter (no desktop needed)
run: |
python3 -m py_compile otp-desktop.py
Expand Down
54 changes: 53 additions & 1 deletion BlipView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ FocusScope {
readonly property color dim: appearance.muted
/** An editor owns the keyboard — the host's key catcher must stand down. */
readonly property bool editorActive:
messageMenu.visible || contactMenu.visible || contactReview.opened || composeField.activeFocus || searchField.activeFocus || newField.activeFocus || bubbleFocused
emojiPopup.visible || messageMenu.visible || contactMenu.visible || contactReview.opened || composeField.activeFocus || searchField.activeFocus || newField.activeFocus || bubbleFocused
readonly property alias composeEditor: composeField
readonly property real contentHeightHint: listContent.implicitHeight
/** The view wants keyboard navigation focus back (list mode). */
Expand Down Expand Up @@ -4178,6 +4178,13 @@ FocusScope {
}
}

Button {
text: "☺"
Layout.alignment: Qt.AlignBottom
enabled: root.online && root.inThread
Accessible.name: "Choose emoji"
onClicked: root.openEmojiPicker()
}
// send button — the blue arrow circle (lit when text OR a file is queued)
Rectangle {
Layout.alignment: Qt.AlignBottom
Expand Down Expand Up @@ -4270,6 +4277,51 @@ FocusScope {
root.pendingTapback = TapbackActions.pendingTapback(chat, String(message.guid), kind, current)
if (!hostWidget.runTapback(chat, argv)) root.pendingTapback = null
}
function openEmojiPicker() {
if (emojiPopup.visible) { emojiPopup.close(); return }
emojiPopup.open()
}
function insertComposerEmoji(emoji) {
var start = composeField.selectionStart
var end = composeField.selectionEnd
var at = start !== end ? start : composeField.cursorPosition
if (start !== end) composeField.remove(start, end)
composeField.insert(at, emoji)
composeField.cursorPosition = at + emoji.length
emojiPopup.close()
composeField.forceActiveFocus()
}
Popup {
id: emojiPopup
parent: root
width: Math.min(Style.space(340), root.width - Style.space(16))
height: Math.min(emojiPicker.implicitHeight + padding * 2, root.height - Style.space(16))
x: Math.max(Style.space(8), root.width - width - Style.space(18))
y: Math.max(Style.space(8), root.height - height - composeSlot.height - Style.space(28))
padding: Style.space(8)
focus: true
onClosed: if (root.inThread) composeField.forceActiveFocus()
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
background: Rectangle {
color: appearance.background
border.color: Qt.alpha(root.foreground, 0.18)
border.width: 1
radius: Style.space(16)
}
contentItem: ComposerEmojiPicker {
id: emojiPicker
font.family: root.fontFamily
font.pixelSize: root.fontBodySmall
palette.text: root.foreground
palette.windowText: root.foreground
palette.base: appearance.background
palette.window: appearance.background
palette.highlight: root.accent
onEmojiChosen: function(emoji) {
root.insertComposerEmoji(emoji)
}
}
}
MessageMenu {
id: messageMenu
objectName: "blipMessageMenu"
Expand Down
123 changes: 123 additions & 0 deletions ComposerEmojiPicker.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import QtQuick
import QtQuick.Controls
import "EmojiPicker.mjs" as EmojiPicker

// Reusable picker: reactions emit a kind, composer insertion emits the glyph.
// Search/category/identity policy lives in tapback-actions.ts. GridView only
// instantiates visible cells, even with the complete Unicode catalogue open.
Control {
id: picker
objectName: "blipReactionPicker"
implicitWidth: 302
implicitHeight: column.implicitHeight
padding: 0
property bool busy: false
property string currentKind: ""
signal emojiChosen(string emoji)
function choose(kind) {
if (!picker.busy && kind.indexOf("emoji:") === 0) picker.emojiChosen(kind.slice(6))
}
contentItem: Column {
id: column
spacing: 8
Column {
width: parent.width
visible: true
height: visible ? implicitHeight : 0
spacing: 8
TextField {
id: search
objectName: "reactionEmojiSearch"
width: parent.width
placeholderText: "Search or paste an emoji"
font: picker.font
palette: picker.palette
color: picker.palette.windowText
placeholderTextColor: Qt.alpha(picker.palette.windowText, 0.45)
background: Rectangle {
radius: 8
color: Qt.alpha(picker.palette.windowText, 0.06)
border.width: 1
border.color: search.activeFocus ? picker.palette.highlight : Qt.alpha(picker.palette.windowText, 0.12)
}
maximumLength: 160
selectByMouse: true
Accessible.name: "Search emoji"
Keys.onDownPressed: { grid.currentIndex = 0; grid.forceActiveFocus() }
onAccepted: if (grid.count > 0) picker.choose(grid.model[0].kind)
onTextChanged: grid.currentIndex = -1
}
ComboBox {
id: categories
width: parent.width
model: EmojiPicker.EMOJI_GROUPS
font: picker.font
palette.buttonText: picker.palette.windowText
palette.button: picker.palette.window
palette.text: picker.palette.windowText
palette.base: picker.palette.window
palette.window: picker.palette.window
palette.highlight: picker.palette.highlight
background: Rectangle {
radius: 8
color: Qt.alpha(picker.palette.windowText, 0.06)
border.color: Qt.alpha(picker.palette.windowText, 0.12)
}
Accessible.name: "Emoji category"
}
GridView {
id: grid
objectName: "reactionEmojiGrid"
width: parent.width
height: 220
clip: true
cellWidth: width / 7
cellHeight: 42
model: EmojiPicker.searchReactionEmoji(search.text, categories.currentText || "All")
currentIndex: -1
keyNavigationEnabled: true
boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
Keys.onReturnPressed: if (currentIndex >= 0) picker.choose(model[currentIndex].kind)
Keys.onEnterPressed: if (currentIndex >= 0) picker.choose(model[currentIndex].kind)
Keys.onEscapePressed: search.forceActiveFocus()
delegate: ToolButton {
required property var modelData
required property int index
width: grid.cellWidth
height: grid.cellHeight
enabled: !picker.busy
hoverEnabled: true
Accessible.name: modelData.name
ToolTip.visible: hovered
ToolTip.text: modelData.name
background: Rectangle {
radius: 8
color: parent.modelData.kind === picker.currentKind ? Qt.alpha(picker.palette.highlight, 0.3)
: parent.hovered ? Qt.alpha(picker.palette.windowText, 0.10) : "transparent"
border.width: grid.activeFocus && grid.currentIndex === parent.index ? 2 : 0
border.color: picker.palette.highlight
}
contentItem: Text {
text: parent.modelData.emoji
textFormat: Text.PlainText
font.pixelSize: 25
color: picker.palette.windowText
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: picker.choose(modelData.kind)
}
Text {
anchors.centerIn: parent
visible: grid.count === 0
text: "No matching emoji"
textFormat: Text.PlainText
color: picker.palette.windowText
font: picker.font
}
}

}
}
}
Loading
Loading