mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
parent
a1fed44b50
commit
1994ea634e
1 changed files with 50 additions and 5 deletions
|
@ -106,21 +106,66 @@ Item {
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: Settings.recentReactions
|
model: Settings.recentReactions
|
||||||
|
|
||||||
delegate: TextButton {
|
|
||||||
required property string modelData
|
|
||||||
|
|
||||||
visible: room ? room.permissions.canSend(MtxEvent.Reaction) : false
|
visible: room ? room.permissions.canSend(MtxEvent.Reaction) : false
|
||||||
|
|
||||||
Layout.preferredHeight: fontMetrics.height
|
delegate: AbstractButton {
|
||||||
font.family: Settings.emojiFont
|
id: button
|
||||||
|
|
||||||
|
required property string modelData
|
||||||
|
|
||||||
|
property color highlightColor: Nheko.colors.highlight
|
||||||
|
property color buttonTextColor: Nheko.colors.buttonText
|
||||||
|
property bool showImage: modelData.startsWith("mxc://")
|
||||||
|
|
||||||
|
//Layout.preferredHeight: fontMetrics.height
|
||||||
|
Layout.alignment: Qt.AlignBottom
|
||||||
|
|
||||||
|
focusPolicy: Qt.NoFocus
|
||||||
|
width: showImage ? 16 : buttonText.implicitWidth
|
||||||
|
height: showImage ? 16 : buttonText.implicitHeight
|
||||||
|
implicitWidth: showImage ? 16 : buttonText.implicitWidth
|
||||||
|
implicitHeight: showImage ? 16 : buttonText.implicitHeight
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: buttonText
|
||||||
|
|
||||||
|
visible: !button.showImage
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
padding: 0
|
||||||
|
text: button.modelData
|
||||||
|
color: button.hovered ? button.highlightColor : button.buttonTextColor
|
||||||
|
font.family: Settings.emojiFont
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: buttonImg
|
||||||
|
|
||||||
|
// Workaround, can't get icon.source working for now...
|
||||||
|
anchors.fill: parent
|
||||||
|
source: button.showImage ? (button.modelData.replace("mxc://", "image://MxcImage/") + "?scale") : ""
|
||||||
|
sourceSize.height: button.height
|
||||||
|
sourceSize.width: button.width
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
}
|
||||||
|
|
||||||
|
CursorShape {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
}
|
||||||
|
|
||||||
|
Ripple {
|
||||||
|
color: Qt.rgba(buttonTextColor.r, buttonTextColor.g, buttonTextColor.b, 0.5)
|
||||||
|
}
|
||||||
|
|
||||||
text: modelData
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
room.input.reaction(row.model.eventId, modelData);
|
room.input.reaction(row.model.eventId, modelData);
|
||||||
TimelineManager.focusMessageInput();
|
TimelineManager.focusMessageInput();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageButton {
|
ImageButton {
|
||||||
|
|
Loading…
Reference in a new issue