mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Remove signals in favor of direct function calls
This commit is contained in:
parent
75cdc1eee2
commit
0078c72a37
4 changed files with 6 additions and 16 deletions
|
@ -5,8 +5,6 @@ import QtQuick.Controls 2.2
|
||||||
// adding new reactions via the emoji picker
|
// adding new reactions via the emoji picker
|
||||||
Flow {
|
Flow {
|
||||||
id: reactionFlow
|
id: reactionFlow
|
||||||
// Signal for when a reaction is picked / unpicked
|
|
||||||
signal picked(string room_id, string event_id, string key, string selfReactedEvent)
|
|
||||||
|
|
||||||
// highlight colors for selfReactedEvent background
|
// highlight colors for selfReactedEvent background
|
||||||
property real highlightHue: colors.highlight.hslHue
|
property real highlightHue: colors.highlight.hslHue
|
||||||
|
@ -36,7 +34,7 @@ Flow {
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.debug("Picked " + model.key + "in response to " + reactionFlow.eventId + " in room " + reactionFlow.roomId + ". selfReactedEvent: " + model.selfReactedEvent)
|
console.debug("Picked " + model.key + "in response to " + reactionFlow.eventId + " in room " + reactionFlow.roomId + ". selfReactedEvent: " + model.selfReactedEvent)
|
||||||
reactionFlow.picked(reactionFlow.roomId, reactionFlow.eventId, model.key, model.selfReactedEvent)
|
timelineManager.reactToMessage(reactionFlow.roomId, reactionFlow.eventId, model.key, model.selfReactedEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +55,7 @@ Flow {
|
||||||
Text {
|
Text {
|
||||||
anchors.baseline: reactionCounter.baseline
|
anchors.baseline: reactionCounter.baseline
|
||||||
id: reactionText
|
id: reactionText
|
||||||
text: textMetrics.elidedText + (textMetrics.elidedText == textMetrics.text ? "" : "…")
|
text: textMetrics.elidedText + (textMetrics.elidedText == model.key ? "" : "…")
|
||||||
font.family: settings.emojiFont
|
font.family: settings.emojiFont
|
||||||
color: reaction.hovered ? colors.highlight : colors.text
|
color: reaction.hovered ? colors.highlight : colors.text
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
|
|
|
@ -63,9 +63,6 @@ MouseArea {
|
||||||
reactions: model.reactions
|
reactions: model.reactions
|
||||||
roomId: model.roomId
|
roomId: model.roomId
|
||||||
eventId: model.id
|
eventId: model.id
|
||||||
Component.onCompleted: {
|
|
||||||
reactionRow.picked.connect(timelineManager.reactToMessage)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,6 @@ Page {
|
||||||
category: Emoji.Category.People
|
category: Emoji.Category.People
|
||||||
sourceModel: EmojiModel {}
|
sourceModel: EmojiModel {}
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
|
||||||
emojiPopup.picked.connect(timelineManager.queueReactionMessage)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import "../"
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
|
|
||||||
function show(showAt, room_id, event_id) {
|
function show(showAt, room_id, event_id) {
|
||||||
console.debug("Showing emojiPicker for " + event_id + "in room " + room_id)
|
console.debug("Showing emojiPicker for " + event_id + "in room " + room_id)
|
||||||
parent = showAt
|
parent = showAt
|
||||||
x = Math.round((showAt.width - width) / 2)
|
x = Math.round((showAt.width - width) / 2)
|
||||||
|
@ -18,8 +18,7 @@ Popup {
|
||||||
emojiPopup.room_id = room_id
|
emojiPopup.room_id = room_id
|
||||||
emojiPopup.event_id = event_id
|
emojiPopup.event_id = event_id
|
||||||
open()
|
open()
|
||||||
}
|
}
|
||||||
signal picked(string room_id, string event_id, string key)
|
|
||||||
|
|
||||||
property string room_id
|
property string room_id
|
||||||
property string event_id
|
property string event_id
|
||||||
|
@ -42,8 +41,6 @@ Popup {
|
||||||
focus: true
|
focus: true
|
||||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
||||||
|
|
||||||
onPicked: emojiPopup.close()
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: columnView
|
id: columnView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -106,7 +103,8 @@ Popup {
|
||||||
// TODO: maybe add favorites at some point?
|
// TODO: maybe add favorites at some point?
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.debug("Picked " + model.unicode + "in response to " + emojiPopup.event_id + " in room " + emojiPopup.room_id)
|
console.debug("Picked " + model.unicode + "in response to " + emojiPopup.event_id + " in room " + emojiPopup.room_id)
|
||||||
emojiPopup.picked(emojiPopup.room_id, emojiPopup.event_id, model.unicode)
|
emojiPopup.close()
|
||||||
|
timelineManager.queueReactionMessage(emojiPopup.room_id, emojiPopup.event_id, model.unicode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue