2021-07-17 20:31:38 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2021-09-25 06:27:57 +03:00
|
|
|
import ".."
|
|
|
|
import "../ui"
|
2021-05-30 04:09:21 +03:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
2021-08-04 03:27:50 +03:00
|
|
|
import QtQuick.Window 2.13
|
2021-05-30 04:09:21 +03:00
|
|
|
import im.nheko 1.0
|
|
|
|
|
|
|
|
ApplicationWindow {
|
|
|
|
id: roomMembersRoot
|
|
|
|
|
|
|
|
property MemberList members
|
2021-08-14 00:58:26 +03:00
|
|
|
property Room room
|
2021-05-30 04:09:21 +03:00
|
|
|
|
2021-07-21 20:13:34 +03:00
|
|
|
title: qsTr("Members of %1").arg(members.roomName)
|
2021-05-30 04:09:21 +03:00
|
|
|
height: 650
|
|
|
|
width: 420
|
|
|
|
minimumHeight: 420
|
2021-07-21 01:04:19 +03:00
|
|
|
palette: Nheko.colors
|
|
|
|
color: Nheko.colors.window
|
2021-08-19 17:55:54 +03:00
|
|
|
flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint
|
2021-08-04 03:27:50 +03:00
|
|
|
Component.onCompleted: Nheko.reparent(roomMembersRoot)
|
2021-05-30 04:09:21 +03:00
|
|
|
|
|
|
|
Shortcut {
|
|
|
|
sequence: StandardKey.Cancel
|
|
|
|
onActivated: roomMembersRoot.close()
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
2021-07-20 17:10:43 +03:00
|
|
|
anchors.margins: Nheko.paddingMedium
|
2021-07-19 17:07:54 +03:00
|
|
|
spacing: Nheko.paddingMedium
|
2021-05-30 04:09:21 +03:00
|
|
|
|
|
|
|
Avatar {
|
|
|
|
id: roomAvatar
|
|
|
|
|
|
|
|
width: 130
|
|
|
|
height: width
|
2021-09-01 04:53:12 +03:00
|
|
|
roomid: members.roomId
|
2021-05-30 04:09:21 +03:00
|
|
|
displayName: members.roomName
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
url: members.avatarUrl.replace("mxc://", "image://MxcImage/")
|
2021-07-22 01:56:20 +03:00
|
|
|
onClicked: TimelineManager.openRoomSettings(members.roomId)
|
2021-05-30 04:09:21 +03:00
|
|
|
}
|
|
|
|
|
2021-07-21 01:27:16 +03:00
|
|
|
ElidedLabel {
|
2021-07-20 19:53:16 +03:00
|
|
|
font.pixelSize: fontMetrics.font.pixelSize * 2
|
2021-07-21 20:13:34 +03:00
|
|
|
fullText: qsTr("%n people in %1", "Summary above list of members", members.memberCount).arg(members.roomName)
|
2021-05-30 04:09:21 +03:00
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2021-07-21 02:45:28 +03:00
|
|
|
elideWidth: parent.width - Nheko.paddingMedium
|
2021-05-30 04:09:21 +03:00
|
|
|
}
|
|
|
|
|
2021-06-11 03:13:12 +03:00
|
|
|
ImageButton {
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2021-11-14 04:23:10 +03:00
|
|
|
image: ":/icons/icons/ui/add-square-button.svg"
|
2021-06-11 03:13:12 +03:00
|
|
|
hoverEnabled: true
|
|
|
|
ToolTip.visible: hovered
|
|
|
|
ToolTip.text: qsTr("Invite more people")
|
2021-07-22 01:56:20 +03:00
|
|
|
onClicked: TimelineManager.openInviteUsers(members.roomId)
|
2021-06-11 03:13:12 +03:00
|
|
|
}
|
|
|
|
|
2021-05-30 04:09:21 +03:00
|
|
|
ScrollView {
|
2021-07-17 23:48:06 +03:00
|
|
|
palette: Nheko.colors
|
2021-07-20 17:10:43 +03:00
|
|
|
padding: Nheko.paddingMedium
|
2021-05-30 04:09:21 +03:00
|
|
|
ScrollBar.horizontal.visible: false
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.minimumHeight: 200
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: memberList
|
|
|
|
|
|
|
|
clip: true
|
2021-07-20 17:10:43 +03:00
|
|
|
spacing: Nheko.paddingMedium
|
2021-05-30 04:09:21 +03:00
|
|
|
boundsBehavior: Flickable.StopAtBounds
|
|
|
|
model: members
|
|
|
|
|
|
|
|
ScrollHelper {
|
|
|
|
flickable: parent
|
|
|
|
anchors.fill: parent
|
|
|
|
enabled: !Settings.mobileMode
|
|
|
|
}
|
|
|
|
|
|
|
|
delegate: RowLayout {
|
2021-08-14 00:58:26 +03:00
|
|
|
id: del
|
|
|
|
|
|
|
|
width: ListView.view.width
|
2021-07-19 17:07:54 +03:00
|
|
|
spacing: Nheko.paddingMedium
|
2021-05-30 04:09:21 +03:00
|
|
|
|
|
|
|
Avatar {
|
2021-08-14 00:58:26 +03:00
|
|
|
id: avatar
|
|
|
|
|
2021-07-17 23:48:06 +03:00
|
|
|
width: Nheko.avatarSize
|
|
|
|
height: Nheko.avatarSize
|
2021-05-30 04:09:21 +03:00
|
|
|
userid: model.mxid
|
|
|
|
url: model.avatarUrl.replace("mxc://", "image://MxcImage/")
|
|
|
|
displayName: model.displayName
|
2021-07-17 23:48:06 +03:00
|
|
|
onClicked: Rooms.currentRoom.openUserProfile(model.mxid)
|
2021-05-30 04:09:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
2021-07-20 17:10:43 +03:00
|
|
|
spacing: Nheko.paddingSmall
|
2021-05-30 04:09:21 +03:00
|
|
|
|
2021-08-14 00:58:26 +03:00
|
|
|
ElidedLabel {
|
|
|
|
fullText: model.displayName
|
2021-07-17 23:48:06 +03:00
|
|
|
color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window)
|
2021-08-14 00:58:26 +03:00
|
|
|
font.pixelSize: fontMetrics.font.pixelSize
|
|
|
|
elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
|
2021-05-30 04:09:21 +03:00
|
|
|
}
|
|
|
|
|
2021-08-14 00:58:26 +03:00
|
|
|
ElidedLabel {
|
|
|
|
fullText: model.mxid
|
2021-07-17 23:48:06 +03:00
|
|
|
color: Nheko.colors.buttonText
|
2021-08-14 00:58:26 +03:00
|
|
|
font.pixelSize: Math.ceil(fontMetrics.font.pixelSize * 0.9)
|
|
|
|
elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
|
2021-05-30 04:09:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2021-07-19 21:31:08 +03:00
|
|
|
|
2021-05-30 04:09:21 +03:00
|
|
|
}
|
2021-07-19 21:31:08 +03:00
|
|
|
|
2021-08-14 00:58:26 +03:00
|
|
|
EncryptionIndicator {
|
|
|
|
id: encryptInd
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
visible: room.isEncrypted
|
|
|
|
encrypted: room.isEncrypted
|
|
|
|
trust: encrypted ? model.trustlevel : Crypto.Unverified
|
|
|
|
ToolTip.text: {
|
|
|
|
if (!encrypted)
|
|
|
|
return qsTr("This room is not encrypted!");
|
|
|
|
|
|
|
|
switch (trust) {
|
|
|
|
case Crypto.Verified:
|
|
|
|
return qsTr("This user is verified.");
|
|
|
|
case Crypto.TOFU:
|
|
|
|
return qsTr("This user isn't verified, but is still using the same master key from the first time you met.");
|
|
|
|
default:
|
|
|
|
return qsTr("This user has unverified devices!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-30 04:09:21 +03:00
|
|
|
}
|
2021-06-12 01:53:32 +03:00
|
|
|
|
2021-07-21 02:57:36 +03:00
|
|
|
footer: Item {
|
|
|
|
width: parent.width
|
|
|
|
visible: (members.numUsersLoaded < members.memberCount) && members.loadingMoreMembers
|
2021-07-19 19:32:09 +03:00
|
|
|
// use the default height if it's visible, otherwise no height at all
|
2021-07-21 02:57:36 +03:00
|
|
|
height: membersLoadingSpinner.height
|
|
|
|
anchors.margins: Nheko.paddingMedium
|
|
|
|
|
|
|
|
Spinner {
|
|
|
|
id: membersLoadingSpinner
|
|
|
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
height: visible ? 35 : 0
|
|
|
|
}
|
|
|
|
|
2021-06-12 01:53:32 +03:00
|
|
|
}
|
2021-07-19 21:31:08 +03:00
|
|
|
|
2021-05-30 04:09:21 +03:00
|
|
|
}
|
2021-07-19 21:31:08 +03:00
|
|
|
|
2021-05-30 04:09:21 +03:00
|
|
|
}
|
2021-07-19 21:31:08 +03:00
|
|
|
|
2021-05-30 04:09:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
footer: DialogButtonBox {
|
|
|
|
standardButtons: DialogButtonBox.Ok
|
|
|
|
onAccepted: roomMembersRoot.close()
|
|
|
|
}
|
2021-07-19 21:31:08 +03:00
|
|
|
|
2021-05-30 04:09:21 +03:00
|
|
|
}
|