You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nheko/resources/qml/RoomMembers.qml

139 lines
4.1 KiB

3 years ago
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
3 years ago
import "./ui"
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtQuick.Window 2.12
import im.nheko 1.0
ApplicationWindow {
id: roomMembersRoot
property MemberList members
title: qsTr("Members of ") + members.roomName
x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
height: 650
width: 420
minimumHeight: 420
palette: Nheko.colors
color: Nheko.colors.window
Shortcut {
sequence: StandardKey.Cancel
onActivated: roomMembersRoot.close()
}
ColumnLayout {
anchors.fill: parent
anchors.margins: Nheko.paddingMedium
spacing: Nheko.paddingMedium
Avatar {
id: roomAvatar
width: 130
height: width
displayName: members.roomName
Layout.alignment: Qt.AlignHCenter
url: members.avatarUrl.replace("mxc://", "image://MxcImage/")
3 years ago
onClicked: Rooms.currentRoom.openRoomSettings(members.roomId)
}
3 years ago
ElidedLabel {
font.pixelSize: fontMetrics.font.pixelSize * 2
3 years ago
fullText: members.memberCount + (members.memberCount === 1 ? qsTr(" person in ") : qsTr(" people in ")) + members.roomName
Layout.alignment: Qt.AlignHCenter
}
4 years ago
ImageButton {
Layout.alignment: Qt.AlignHCenter
image: ":/icons/icons/ui/add-square-button.png"
hoverEnabled: true
ToolTip.visible: hovered
ToolTip.text: qsTr("Invite more people")
3 years ago
onClicked: Rooms.currentRoom.openInviteUsersDialog()
4 years ago
}
ScrollView {
3 years ago
palette: Nheko.colors
padding: Nheko.paddingMedium
ScrollBar.horizontal.visible: false
Layout.fillHeight: true
Layout.minimumHeight: 200
Layout.fillWidth: true
ListView {
id: memberList
clip: true
spacing: Nheko.paddingMedium
boundsBehavior: Flickable.StopAtBounds
model: members
ScrollHelper {
flickable: parent
anchors.fill: parent
enabled: !Settings.mobileMode
}
delegate: RowLayout {
spacing: Nheko.paddingMedium
Avatar {
3 years ago
width: Nheko.avatarSize
height: Nheko.avatarSize
userid: model.mxid
url: model.avatarUrl.replace("mxc://", "image://MxcImage/")
displayName: model.displayName
3 years ago
onClicked: Rooms.currentRoom.openUserProfile(model.mxid)
}
ColumnLayout {
spacing: Nheko.paddingSmall
Label {
text: model.displayName
3 years ago
color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window)
font.pointSize: fontMetrics.font.pointSize
}
Label {
text: model.mxid
3 years ago
color: Nheko.colors.buttonText
font.pointSize: fontMetrics.font.pointSize * 0.9
}
Item {
Layout.fillHeight: true
Layout.fillWidth: true
}
3 years ago
}
3 years ago
}
footer: Spinner {
visible: members.numUsersLoaded < members.memberCount && members.loadingMoreMembers
// use the default height if it's visible, otherwise no height at all
height: visible ? undefined : 0
anchors.centerIn: parent
}
3 years ago
}
3 years ago
}
3 years ago
}
footer: DialogButtonBox {
standardButtons: DialogButtonBox.Ok
onAccepted: roomMembersRoot.close()
}
3 years ago
}