summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2020-08-26 21:52:35 +0000
committerGitHub <noreply@github.com>2020-08-26 21:52:35 +0000
commitb58e370c032509df69c968db97f8b65f6e450550 (patch)
tree3165b2aaaed3bc6362b75b5a87d797dbaf8037fb /resources
parentMerge pull request #263 from trilene/voip (diff)
parentAdd some log messages, that migrations are in progress (diff)
downloadnheko-b58e370c032509df69c968db97f8b65f6e450550.tar.xz
Merge pull request #251 from Nheko-Reborn/new-event-store
New event store
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/MatrixText.qml1
-rw-r--r--resources/qml/Reactions.qml18
-rw-r--r--resources/qml/ScrollHelper.qml2
-rw-r--r--resources/qml/TimelineRow.qml31
-rw-r--r--resources/qml/TimelineView.qml68
-rw-r--r--resources/qml/delegates/ImageMessage.qml4
-rw-r--r--resources/qml/delegates/MessageDelegate.qml12
-rw-r--r--resources/qml/delegates/PlayableMediaMessage.qml2
-rw-r--r--resources/qml/delegates/TextMessage.qml2
-rw-r--r--resources/qml/emoji/EmojiButton.qml3
-rw-r--r--resources/qml/emoji/EmojiPicker.qml24
11 files changed, 93 insertions, 74 deletions
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) } }