diff --git a/resources/qml/MatrixText.qml b/resources/qml/MatrixText.qml
index d56143dd..1da223d5 100644
--- a/resources/qml/MatrixText.qml
+++ b/resources/qml/MatrixText.qml
@@ -6,6 +6,7 @@ TextEdit {
readOnly: true
wrapMode: Text.Wrap
selectByMouse: true
+ activeFocusOnPress: false
color: colors.text
onLinkActivated: {
diff --git a/resources/qml/Reactions.qml b/resources/qml/Reactions.qml
index c06dc826..c1091756 100644
--- a/resources/qml/Reactions.qml
+++ b/resources/qml/Reactions.qml
@@ -30,11 +30,11 @@ Flow {
implicitHeight: contentItem.childrenRect.height
ToolTip.visible: hovered
- ToolTip.text: model.users
+ ToolTip.text: modelData.users
onClicked: {
- console.debug("Picked " + model.key + "in response to " + reactionFlow.eventId + " in room " + reactionFlow.roomId + ". selfReactedEvent: " + model.selfReactedEvent)
- timelineManager.reactToMessage(reactionFlow.roomId, reactionFlow.eventId, model.key, model.selfReactedEvent)
+ console.debug("Picked " + modelData.key + "in response to " + reactionFlow.eventId + " in room " + reactionFlow.roomId + ". selfReactedEvent: " + modelData.selfReactedEvent)
+ timelineManager.queueReactionMessage(reactionFlow.eventId, modelData.key)
}
@@ -49,13 +49,13 @@ Flow {
font.family: settings.emojiFont
elide: Text.ElideRight
elideWidth: 150
- text: model.key
+ text: modelData.key
}
Text {
anchors.baseline: reactionCounter.baseline
id: reactionText
- text: textMetrics.elidedText + (textMetrics.elidedText == model.key ? "" : "…")
+ text: textMetrics.elidedText + (textMetrics.elidedText == modelData.key ? "" : "…")
font.family: settings.emojiFont
color: reaction.hovered ? colors.highlight : colors.text
maximumLineCount: 1
@@ -65,13 +65,13 @@ Flow {
id: divider
height: Math.floor(reactionCounter.implicitHeight * 1.4)
width: 1
- color: (reaction.hovered || model.selfReactedEvent !== '') ? colors.highlight : colors.text
+ color: (reaction.hovered || modelData.selfReactedEvent !== '') ? colors.highlight : colors.text
}
Text {
anchors.verticalCenter: divider.verticalCenter
id: reactionCounter
- text: model.counter
+ text: modelData.count
font: reaction.font
color: reaction.hovered ? colors.highlight : colors.text
}
@@ -82,8 +82,8 @@ Flow {
implicitWidth: reaction.implicitWidth
implicitHeight: reaction.implicitHeight
- border.color: (reaction.hovered || model.selfReactedEvent !== '') ? colors.highlight : colors.text
- color: model.selfReactedEvent !== '' ? Qt.hsla(highlightHue, highlightSat, highlightLight, 0.20) : colors.base
+ border.color: (reaction.hovered || modelData.selfReactedEvent !== '') ? colors.highlight : colors.text
+ color: modelData.selfReactedEvent !== '' ? Qt.hsla(highlightHue, highlightSat, highlightLight, 0.20) : colors.base
border.width: 1
radius: reaction.height / 2.0
}
diff --git a/resources/qml/ScrollHelper.qml b/resources/qml/ScrollHelper.qml
index e72fcbd2..ba7c2648 100644
--- a/resources/qml/ScrollHelper.qml
+++ b/resources/qml/ScrollHelper.qml
@@ -106,6 +106,6 @@ MouseArea {
//How long the scrollbar will remain visible
interval: 500
// Hide the scrollbars
- onTriggered: flickable.cancelFlick();
+ onTriggered: { flickable.cancelFlick(); flickable.movementEnded(); }
}
}
diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml
index dfee62dc..a38a4d34 100644
--- a/resources/qml/TimelineRow.qml
+++ b/resources/qml/TimelineRow.qml
@@ -8,22 +8,25 @@ import im.nheko 1.0
import "./delegates"
import "./emoji"
-MouseArea {
+Item {
anchors.left: parent.left
anchors.right: parent.right
height: row.height
- propagateComposedEvents: true
- preventStealing: true
- hoverEnabled: true
- acceptedButtons: Qt.LeftButton | Qt.RightButton
- onClicked: {
- if (mouse.button === Qt.RightButton)
- messageContextMenu.show(model.id, model.type, model.isEncrypted, row)
- }
- onPressAndHold: {
- if (mouse.source === Qt.MouseEventNotSynthesized)
- messageContextMenu.show(model.id, model.type, model.isEncrypted, row)
+ MouseArea {
+ anchors.fill: parent
+ propagateComposedEvents: true
+ preventStealing: true
+ hoverEnabled: true
+
+ acceptedButtons: Qt.AllButtons
+ onClicked: {
+ if (mouse.button === Qt.RightButton)
+ messageContextMenu.show(model.id, model.type, model.isEncrypted, row)
+ }
+ onPressAndHold: {
+ messageContextMenu.show(model.id, model.type, model.isEncrypted, row, mapToItem(timelineRoot, mouse.x, mouse.y))
+ }
}
Rectangle {
color: (settings.messageHoverHighlight && parent.containsMouse) ? colors.base : "transparent"
@@ -45,7 +48,7 @@ MouseArea {
// fancy reply, if this is a reply
Reply {
visible: model.replyTo
- modelData: chat.model.getDump(model.replyTo)
+ modelData: chat.model.getDump(model.replyTo, model.id)
userColor: timelineManager.userColor(modelData.userId, colors.window)
}
@@ -90,7 +93,6 @@ MouseArea {
ToolTip.visible: hovered
ToolTip.text: qsTr("React")
emojiPicker: emojiPopup
- room_id: model.roomId
event_id: model.id
}
ImageButton {
@@ -128,6 +130,7 @@ MouseArea {
Label {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: model.timestamp.toLocaleTimeString("HH:mm")
+ width: Math.max(implicitWidth, text.length*fontMetrics.maximumCharacterWidth)
color: inactiveColors.text
MouseArea{
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 6af0372b..dd9c4029 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -11,6 +11,8 @@ import "./delegates"
import "./emoji"
Page {
+ id: timelineRoot
+
property var colors: currentActivePalette
property var systemInactive: SystemPalette { colorGroup: SystemPalette.Disabled }
property var inactiveColors: currentInactivePalette ? currentInactivePalette : systemInactive
@@ -25,34 +27,39 @@ Page {
id: fontMetrics
}
- EmojiPicker {
- id: emojiPopup
- width: 7 * 52 + 20
- height: 6 * 52
- colors: palette
- model: EmojiProxyModel {
- category: EmojiCategory.People
- sourceModel: EmojiModel {}
- }
- }
+ EmojiPicker {
+ id: emojiPopup
+ width: 7 * 52 + 20
+ height: 6 * 52
+ colors: palette
+ model: EmojiProxyModel {
+ category: EmojiCategory.People
+ sourceModel: EmojiModel {}
+ }
+ }
Menu {
id: messageContextMenu
modal: true
- function show(eventId_, eventType_, isEncrypted_, showAt) {
+ function show(eventId_, eventType_, isEncrypted_, showAt_, position) {
eventId = eventId_
eventType = eventType_
isEncrypted = isEncrypted_
- popup(showAt)
+
+ if (position)
+ popup(position, showAt_)
+ else
+ popup(showAt_)
}
property string eventId
property int eventType
property bool isEncrypted
+
MenuItem {
text: qsTr("React")
- onClicked: chat.model.reactAction(messageContextMenu.eventId)
+ onClicked: emojiPopup.show(messageContextMenu.parent, messageContextMenu.eventId)
}
MenuItem {
text: qsTr("Reply")
@@ -87,8 +94,6 @@ Page {
}
}
- id: timelineRoot
-
Rectangle {
anchors.fill: parent
color: colors.window
@@ -113,7 +118,7 @@ Page {
ListView {
id: chat
- visible: timelineManager.timeline != null
+ visible: !!timelineManager.timeline
cacheBuffer: 400
@@ -181,7 +186,7 @@ Page {
id: wrapper
property Item section
- anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined
width: chat.delegateMaxWidth
height: section ? section.height + timelinerow.height : timelinerow.height
color: "transparent"
@@ -205,14 +210,13 @@ Page {
}
}
- Binding {
- target: chat.model
- property: "currentIndex"
- when: y + height + 2 * chat.spacing > chat.contentY + chat.height && y < chat.contentY + chat.height
- value: index
- delayed: true
+ Connections {
+ target: chat
+ function onMovementEnded() {
+ if (y + height + 2 * chat.spacing > chat.contentY + chat.height && y < chat.contentY + chat.height)
+ chat.model.currentIndex = index;
+ }
}
-
}
section {
@@ -296,13 +300,13 @@ Page {
}
}
- footer: BusyIndicator {
- anchors.horizontalCenter: parent.horizontalCenter
- running: chat.model && chat.model.paginationInProgress
- height: 50
- width: 50
- z: 3
- }
+ footer: BusyIndicator {
+ anchors.horizontalCenter: parent.horizontalCenter
+ running: chat.model && chat.model.paginationInProgress
+ height: 50
+ width: 50
+ z: 3
+ }
}
Rectangle {
@@ -354,7 +358,7 @@ Page {
anchors.rightMargin: 20
anchors.bottom: parent.bottom
- modelData: chat.model ? chat.model.getDump(chat.model.reply) : {}
+ modelData: chat.model ? chat.model.getDump(chat.model.reply, chat.model.id) : {}
userColor: timelineManager.userColor(modelData.userId, colors.window)
}
diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml
index 62d9de60..3885ddae 100644
--- a/resources/qml/delegates/ImageMessage.qml
+++ b/resources/qml/delegates/ImageMessage.qml
@@ -9,8 +9,8 @@ Item {
property double divisor: model.isReply ? 4 : 2
property bool tooHigh: tempHeight > timelineRoot.height / divisor
- height: tooHigh ? timelineRoot.height / divisor : tempHeight
- width: tooHigh ? (timelineRoot.height / divisor) / model.data.proportionalHeight : tempWidth
+ height: Math.round(tooHigh ? timelineRoot.height / divisor : tempHeight)
+ width: Math.round(tooHigh ? (timelineRoot.height / divisor) / model.data.proportionalHeight : tempWidth)
Image {
id: blurhash
diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml
index ed18b2e5..56b8040e 100644
--- a/resources/qml/delegates/MessageDelegate.qml
+++ b/resources/qml/delegates/MessageDelegate.qml
@@ -67,6 +67,12 @@ Item {
}
}
DelegateChoice {
+ roleValue: MtxEvent.Redaction
+ Pill {
+ text: qsTr("redacted")
+ }
+ }
+ DelegateChoice {
roleValue: MtxEvent.Encryption
Pill {
text: qsTr("Encryption enabled")
@@ -109,6 +115,12 @@ Item {
}
}
DelegateChoice {
+ roleValue: MtxEvent.CallCandidates
+ NoticeMessage {
+ text: qsTr("Negotiating call...")
+ }
+ }
+ DelegateChoice {
// TODO: make a more complex formatter for the power levels.
roleValue: MtxEvent.PowerLevels
NoticeMessage {
diff --git a/resources/qml/delegates/PlayableMediaMessage.qml b/resources/qml/delegates/PlayableMediaMessage.qml
index bab524eb..8d2fa8a8 100644
--- a/resources/qml/delegates/PlayableMediaMessage.qml
+++ b/resources/qml/delegates/PlayableMediaMessage.qml
@@ -9,7 +9,7 @@ Rectangle {
id: bg
radius: 10
color: colors.dark
- height: content.height + 24
+ height: Math.round(content.height + 24)
width: parent ? parent.width : undefined
Column {
diff --git a/resources/qml/delegates/TextMessage.qml b/resources/qml/delegates/TextMessage.qml
index b3c45c36..cc2d2da0 100644
--- a/resources/qml/delegates/TextMessage.qml
+++ b/resources/qml/delegates/TextMessage.qml
@@ -4,7 +4,7 @@ MatrixText {
property string formatted: model.data.formattedBody
text: "<style type=\"text/css\">a { color:"+colors.link+";}</style>" + formatted.replace("<pre>", "<pre style='white-space: pre-wrap'>")
width: parent ? parent.width : undefined
- height: isReply ? Math.min(chat.height / 8, implicitHeight) : undefined
+ height: isReply ? Math.round(Math.min(timelineRoot.height / 8, implicitHeight)) : undefined
clip: true
font.pointSize: (settings.enlargeEmojiOnlyMessages && model.data.isOnlyEmoji > 0 && model.data.isOnlyEmoji < 4) ? settings.fontSize * 3 : settings.fontSize
}
diff --git a/resources/qml/emoji/EmojiButton.qml b/resources/qml/emoji/EmojiButton.qml
index f8f75e3e..c5eee4e4 100644
--- a/resources/qml/emoji/EmojiButton.qml
+++ b/resources/qml/emoji/EmojiButton.qml
@@ -8,11 +8,10 @@ import "../"
ImageButton {
property var colors: currentActivePalette
property var emojiPicker
- property string room_id
property string event_id
image: ":/icons/icons/ui/smile.png"
id: emojiButton
- onClicked: emojiPicker.visible ? emojiPicker.close() : emojiPicker.show(emojiButton, room_id, event_id)
+ onClicked: emojiPicker.visible ? emojiPicker.close() : emojiPicker.show(emojiButton, event_id)
}
diff --git a/resources/qml/emoji/EmojiPicker.qml b/resources/qml/emoji/EmojiPicker.qml
index ac67af2a..f75221d5 100644
--- a/resources/qml/emoji/EmojiPicker.qml
+++ b/resources/qml/emoji/EmojiPicker.qml
@@ -10,17 +10,17 @@ import "../"
Popup {
- function show(showAt, room_id, event_id) {
- console.debug("Showing emojiPicker for " + event_id + "in room " + room_id)
- parent = showAt
- x = Math.round((showAt.width - width) / 2)
- y = showAt.height
- emojiPopup.room_id = room_id
- emojiPopup.event_id = event_id
- open()
- }
+ function show(showAt, event_id) {
+ console.debug("Showing emojiPicker for " + event_id)
+ if (showAt){
+ parent = showAt
+ x = Math.round((showAt.width - width) / 2)
+ y = showAt.height
+ }
+ emojiPopup.event_id = event_id
+ open()
+ }
- property string room_id
property string event_id
property var colors
property alias model: gridView.model
@@ -102,9 +102,9 @@ Popup {
}
// TODO: maybe add favorites at some point?
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)
emojiPopup.close()
- timelineManager.queueReactionMessage(emojiPopup.room_id, emojiPopup.event_id, model.unicode)
+ timelineManager.queueReactionMessage(emojiPopup.event_id, model.unicode)
}
}
|