fix position of reactions in timeline

This commit is contained in:
Carl Schwan
2020-11-08 14:45:17 +01:00
parent 485dd64941
commit e96dab7161
3 changed files with 41 additions and 34 deletions

View File

@@ -120,15 +120,6 @@ RowLayout {
} }
} }
} }
ReactionDelegate {
Layout.fillWidth: true
Layout.topMargin: 0
Layout.bottomMargin: 8
Layout.leftMargin: 16
Layout.rightMargin: 16
}
} }
} }
} }

View File

@@ -18,15 +18,15 @@ Flow {
model: reaction model: reaction
delegate: Control { delegate: Control {
width: Math.min(implicitWidth, 128) width: Math.max(implicitWidth, Kirigami.Units.largeSpacing * 3)
height: width height: Kirigami.Units.largeSpacing * 3
horizontalPadding: 6 horizontalPadding: 6
verticalPadding: 0 verticalPadding: 0
contentItem: Label { contentItem: Label {
height: Kirigami.Units.largeSpacing * 3
text: modelData.reaction + (modelData.count > 1 ? " " + modelData.count : "") text: modelData.reaction + (modelData.count > 1 ? " " + modelData.count : "")
font.pixelSize: 14
font.family: "emoji" font.family: "emoji"
elide: Text.ElideRight elide: Text.ElideRight
} }
@@ -41,24 +41,26 @@ Flow {
hoverEnabled: true hoverEnabled: true
ToolTip.visible: containsMouse ToolTip {
TootTip.font.family: Kirigami.Theme.defaultFont.family + ", emoji" visible: parent.containsMouse
ToolTip.text: { font.family: Kirigami.Theme.defaultFont.family + ", emoji"
var text = ""; text: {
var text = "";
for (var i = 0; i < modelData.authors.length; i++) { for (var i = 0; i < modelData.authors.length; i++) {
if (i === modelData.authors.length - 1 && i !== 0) { if (i === modelData.authors.length - 1 && i !== 0) {
text += i18nc("Seperate the usernames of users", " and ") text += i18nc("Seperate the usernames of users", " and ")
} else if (i !== 0) { } else if (i !== 0) {
text += ", " text += ", "
}
text += modelData.authors[i].displayName
} }
text += modelData.authors[i].displayName text = i18ncp("%1 is the users who reacted and %2 the emoji that was given", "%2 reacted with %3", "%2 reacted with %3", modelData.authors.length, text, modelData.reaction)
return text
} }
text = i18ncp("%1 is the users who reacted and %2 the emoji that was given", "%2 reacted with %3", "%2 reacted with %3", modelData.authors.length, text, modelData.reaction)
return text
} }
onClicked: currentRoom.toggleReaction(eventId, modelData.reaction) onClicked: currentRoom.toggleReaction(eventId, modelData.reaction)

View File

@@ -192,9 +192,16 @@ Kirigami.ScrollablePage {
anchors.fill: parent anchors.fill: parent
onClicked: openMessageContext(author, display, eventId, toolTip); onClicked: openMessageContext(author, display, eventId, toolTip);
} }
innerObject: TextDelegate { innerObject: [
Layout.fillWidth: true TextDelegate {
} Layout.fillWidth: true
},
ReactionDelegate {
Layout.fillWidth: true
Layout.topMargin: 0
Layout.bottomMargin: 8
}
]
} }
} }
} }
@@ -222,11 +229,18 @@ Kirigami.ScrollablePage {
innerObject: MessageDelegate { innerObject: MessageDelegate {
Layout.fillWidth: true Layout.fillWidth: true
innerObject: ImageDelegate { innerObject: [
Layout.maximumWidth: parent.width ImageDelegate {
Layout.preferredWidth: Math.min(320, info.w) Layout.maximumWidth: parent.width
Layout.preferredHeight: Math.min(320, info.h) Layout.preferredWidth: Math.min(320, info.w)
} Layout.preferredHeight: Math.min(320, info.h)
},
ReactionDelegate {
Layout.fillWidth: true
Layout.topMargin: 0
Layout.bottomMargin: 8
}
]
} }
} }
} }