summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorJussi Kuokkanen <jussi.kuokkanen@protonmail.com>2020-09-17 16:51:50 +0300
committerJussi Kuokkanen <jussi.kuokkanen@protonmail.com>2020-09-17 16:51:50 +0300
commit7d72356318084d75dceee3e3983db6c40d129e31 (patch)
tree04902a3d6d5852ba43007d21828f062af0a926fe /resources/qml
parentuse Rectangle for typing users so it doesn't overlap with the timeline (diff)
parentMerge pull request #284 from Nheko-Reborn/hidden-events (diff)
downloadnheko-7d72356318084d75dceee3e3983db6c40d129e31.tar.xz
Merge branch 'master' of https://github.com/Nheko-Reborn/nheko
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/Avatar.qml4
-rw-r--r--resources/qml/TimelineView.qml155
-rw-r--r--resources/qml/delegates/MessageDelegate.qml2
-rw-r--r--resources/qml/delegates/Reply.qml2
4 files changed, 138 insertions, 25 deletions
diff --git a/resources/qml/Avatar.qml b/resources/qml/Avatar.qml

index f934e2f6..a3943806 100644 --- a/resources/qml/Avatar.qml +++ b/resources/qml/Avatar.qml
@@ -14,7 +14,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 @@ -50,6 +50,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 1c16ddc6..71a287bb 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml
@@ -115,6 +115,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 @@ -122,13 +246,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 @@ -167,10 +286,6 @@ Page { ScrollBar.vertical: ScrollBar { id: scrollbar - parent: chat.parent - anchors.top: chat.top - anchors.right: chat.right - anchors.bottom: chat.bottom } spacing: 4 @@ -178,9 +293,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 @@ -189,7 +304,6 @@ Page { anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined width: chat.delegateMaxWidth height: section ? section.height + timelinerow.height : timelinerow.height - color: "transparent" TimelineRow { id: timelinerow @@ -276,7 +390,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 @@ -309,17 +423,13 @@ 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 @@ -397,4 +507,5 @@ Page { } } } + } } diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml
index 56b8040e..90e52442 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) } } diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml
index f9fd3f11..36a6d373 100644 --- a/resources/qml/delegates/Reply.qml +++ b/resources/qml/delegates/Reply.qml
@@ -37,7 +37,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