summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-09-24 21:36:43 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-09-24 21:36:43 +0200
commit4802c340091a5ce18cf444792eed45f461cd6f6b (patch)
tree6c3ff6843df6bc719e97d246a7a1cc70494b7dd5 /resources/qml
parentSimplify outbound session setup (diff)
parentTranslated using Weblate (French) (diff)
downloadnheko-4802c340091a5ce18cf444792eed45f461cd6f6b.tar.xz
Merge remote-tracking branch 'origin/master' into cross-signing
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/Avatar.qml4
-rw-r--r--resources/qml/TimelineView.qml185
-rw-r--r--resources/qml/delegates/FileMessage.qml2
-rw-r--r--resources/qml/delegates/MessageDelegate.qml8
-rw-r--r--resources/qml/delegates/Reply.qml2
5 files changed, 162 insertions, 39 deletions
diff --git a/resources/qml/Avatar.qml b/resources/qml/Avatar.qml

index e687e170..67c3e008 100644 --- a/resources/qml/Avatar.qml +++ b/resources/qml/Avatar.qml
@@ -16,7 +16,7 @@ Rectangle { Label { anchors.fill: parent - text: chat.model.escapeEmoji(String.fromCodePoint(displayName.codePointAt(0))) + text: TimelineManager.escapeEmoji(String.fromCodePoint(displayName.codePointAt(0))) textFormat: Text.RichText font.pixelSize: avatar.height/2 verticalAlignment: Text.AlignVCenter @@ -52,6 +52,8 @@ Rectangle { anchors.bottom: avatar.bottom anchors.right: avatar.right + visible: !!userid + height: avatar.height / 6 width: height radius: Settings.avatarCircles ? height / 2 : height / 4 diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 30158e3a..e6562211 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml
@@ -147,6 +147,130 @@ Page { z: 3 } + ColumnLayout { + anchors.fill: parent + Rectangle { + id: topBar + + Layout.fillWidth: true + implicitHeight: topLayout.height + 16 + z: 3 + + color: colors.base + + MouseArea { + anchors.fill: parent + onClicked: TimelineManager.openRoomSettings(); + } + + GridLayout { + id: topLayout + + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 8 + anchors.verticalCenter: parent.verticalCenter + + //Layout.margins: 8 + + ImageButton { + id: backToRoomsButton + + Layout.column: 0 + Layout.row: 0 + Layout.rowSpan: 2 + Layout.alignment: Qt.AlignVCenter + + visible: TimelineManager.isNarrowView + + image: ":/icons/icons/ui/angle-pointing-to-left.png" + + ToolTip.visible: hovered + ToolTip.text: qsTr("Back to room list") + + onClicked: TimelineManager.backToRooms() + } + + Avatar { + Layout.column: 1 + Layout.row: 0 + Layout.rowSpan: 2 + Layout.alignment: Qt.AlignVCenter + + width: avatarSize + height: avatarSize + + url: chat.model ? chat.model.roomAvatarUrl.replace("mxc://", "image://MxcImage/") : "" + displayName: chat.model ? chat.model.roomName : qsTr("No room selected") + + MouseArea { + anchors.fill: parent + onClicked: TimelineManager.openRoomSettings(); + } + } + + Label { + Layout.fillWidth: true + Layout.column: 2 + Layout.row: 0 + + font.pointSize: fontMetrics.font.pointSize * 1.1 + + text: chat.model ? chat.model.roomName : qsTr("No room selected") + + MouseArea { + anchors.fill: parent + onClicked: TimelineManager.openRoomSettings(); + } + } + MatrixText { + Layout.fillWidth: true + Layout.column: 2 + Layout.row: 1 + Layout.maximumHeight: fontMetrics.lineSpacing * 2 // show 2 lines + clip: true + + text: chat.model ? chat.model.roomTopic : "" + } + + ImageButton { + id: roomOptionsButton + + Layout.column: 3 + Layout.row: 0 + Layout.rowSpan: 2 + Layout.alignment: Qt.AlignVCenter + + image: ":/icons/icons/ui/vertical-ellipsis.png" + + ToolTip.visible: hovered + ToolTip.text: qsTr("Room options") + + onClicked: roomOptionsMenu.popup(roomOptionsButton) + + Menu { + id: roomOptionsMenu + MenuItem { + text: qsTr("Invite users") + onTriggered: TimelineManager.openInviteUsersDialog(); + } + MenuItem { + text: qsTr("Members") + onTriggered: TimelineManager.openMemberListDialog(); + } + MenuItem { + text: qsTr("Leave room") + onTriggered: TimelineManager.openLeaveRoomDialog(); + } + MenuItem { + text: qsTr("Settings") + onTriggered: TimelineManager.openRoomSettings(); + } + } + } + } + } + ListView { id: chat @@ -154,13 +278,8 @@ Page { cacheBuffer: 400 - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.bottom: chatFooter.top - width: parent.width - - anchors.leftMargin: 4 - anchors.rightMargin: scrollbar.width + Layout.fillWidth: true + Layout.fillHeight: true model: TimelineManager.timeline @@ -199,10 +318,6 @@ Page { ScrollBar.vertical: ScrollBar { id: scrollbar - parent: chat.parent - anchors.top: chat.top - anchors.right: chat.right - anchors.bottom: chat.bottom } spacing: 4 @@ -210,9 +325,9 @@ Page { onCountChanged: if (atYEnd) model.currentIndex = 0 // Mark last event as read, since we are at the bottom - property int delegateMaxWidth: (Settings.timelineMaxWidth > 100 && (parent.width - Settings.timelineMaxWidth) > 32) ? Settings.timelineMaxWidth : (parent.width - 32) + property int delegateMaxWidth: (Settings.timelineMaxWidth > 100 && (parent.width - Settings.timelineMaxWidth) > scrollbar.width*2) ? Settings.timelineMaxWidth : (parent.width - scrollbar.width*2) - delegate: Rectangle { + delegate: Item { // This would normally be previousSection, but our model's order is inverted. property bool sectionBoundary: (ListView.nextSection != "" && ListView.nextSection !== ListView.section) || model.index === chat.count - 1 @@ -221,7 +336,6 @@ Page { anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined width: chat.delegateMaxWidth height: section ? section.height + timelinerow.height : timelinerow.height - color: "transparent" TimelineRow { id: timelinerow @@ -314,7 +428,7 @@ Page { Label { id: userName - text: chat.model.escapeEmoji(modelData.userName) + text: TimelineManager.escapeEmoji(modelData.userName) color: TimelineManager.userColor(modelData.userId, colors.window) textFormat: Text.RichText @@ -339,33 +453,35 @@ Page { } } - Rectangle { + Item { id: chatFooter - height: Math.max(fontMetrics.height * 1.2, footerContent.height) - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom + implicitHeight: Math.max(fontMetrics.height * 1.2, footerContent.height) + Layout.fillWidth: true z: 3 - color: "transparent" - Column { id: footerContent anchors.left: parent.left anchors.right: parent.right - - Label { - id: typingDisplay - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: 10 - anchors.rightMargin: 10 - - color: colors.text - text: chat.model ? chat.model.formatTypingUsers(chat.model.typingUsers, colors.window) : "" - textFormat: Text.RichText - } + anchors.bottom: parent.bottom + Rectangle { + id: typingRect + anchors.left: parent.left + anchors.right: parent.right + color: (chat.model && chat.model.typingUsers.length > 0) ? colors.window : "transparent" + height: typingDisplay.height + Label { + id: typingDisplay + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.right: parent.right + anchors.rightMargin: 10 + color: colors.text + text: chat.model ? chat.model.formatTypingUsers(chat.model.typingUsers, colors.window) : "" + textFormat: Text.RichText + } + } Rectangle { anchors.left: parent.left @@ -412,4 +528,5 @@ Page { } } } + } } diff --git a/resources/qml/delegates/FileMessage.qml b/resources/qml/delegates/FileMessage.qml
index 158daf45..7a2588f3 100644 --- a/resources/qml/delegates/FileMessage.qml +++ b/resources/qml/delegates/FileMessage.qml
@@ -41,7 +41,7 @@ Item { Text { id: filename Layout.fillWidth: true - text: model.data.body + text: model.data.filename textFormat: Text.PlainText elide: Text.ElideRight color: colors.text diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml
index ff025730..a5cb2ae7 100644 --- a/resources/qml/delegates/MessageDelegate.qml +++ b/resources/qml/delegates/MessageDelegate.qml
@@ -36,7 +36,7 @@ Item { DelegateChoice { roleValue: MtxEvent.EmoteMessage NoticeMessage { - formatted: chat.model.escapeEmoji(modelData.userName) + " " + model.data.formattedBody + formatted: TimelineManager.escapeEmoji(modelData.userName) + " " + model.data.formattedBody color: TimelineManager.userColor(modelData.userId, colors.window) } } @@ -99,7 +99,11 @@ Item { DelegateChoice { roleValue: MtxEvent.CallInvite NoticeMessage { - text: qsTr("%1 placed a %2 call.").arg(model.data.userName).arg(model.data.callType) + text: switch(model.data.callType) { + case "voice": return qsTr("%1 placed a voice call.").arg(model.data.userName) + case "video": return qsTr("%1 placed a video call.").arg(model.data.userName) + default: return qsTr("%1 placed a call.").arg(model.data.userName) + } } } DelegateChoice { diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml
index d4fffb06..43fc2814 100644 --- a/resources/qml/delegates/Reply.qml +++ b/resources/qml/delegates/Reply.qml
@@ -39,7 +39,7 @@ Item { Text { id: userName - text: chat.model ? chat.model.escapeEmoji(reply.modelData.userName) : "" + text: TimelineManager.escapeEmoji(reply.modelData.userName) color: replyComponent.userColor textFormat: Text.RichText