2019-12-19 07:46:16 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-07-13 05:39:01 -04:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
2019-12-02 16:29:29 -04:00
|
|
|
import "../../.."
|
2019-12-18 04:53:08 -04:00
|
|
|
import "../../../Base"
|
2019-05-12 13:17:42 -04:00
|
|
|
|
2019-05-12 21:36:08 -04:00
|
|
|
HColumnLayout {
|
2019-05-13 13:15:03 -04:00
|
|
|
HListView {
|
2019-05-12 13:17:42 -04:00
|
|
|
id: memberList
|
2019-09-02 13:24:25 -04:00
|
|
|
clip: true
|
2019-05-12 13:17:42 -04:00
|
|
|
|
2019-12-02 16:29:29 -04:00
|
|
|
model: ModelStore.get(chat.userId, chat.roomId, "members")
|
|
|
|
// model: HSortFilterProxy {
|
|
|
|
// model: ModelStore.get(chat.userId, chat.roomId, "members")
|
|
|
|
|
|
|
|
// comparator: (a, b) =>
|
|
|
|
// // Sort by power level, then by display name or user ID (no @)
|
|
|
|
// [
|
|
|
|
// a.invited,
|
|
|
|
// b.power_level,
|
|
|
|
// (a.display_name || a.id.substring(1)).toLocaleLowerCase(),
|
|
|
|
// ] < [
|
|
|
|
// b.invited,
|
|
|
|
// a.power_level,
|
|
|
|
// (b.display_name || b.id.substring(1)).toLocaleLowerCase(),
|
|
|
|
// ]
|
|
|
|
|
|
|
|
// filter: (item, index) => utils.filterMatchesAny(
|
|
|
|
// filterField.text, item.display_name, item.id,
|
|
|
|
// )
|
|
|
|
// }
|
2019-07-07 05:25:03 -04:00
|
|
|
|
2019-08-21 04:39:07 -04:00
|
|
|
delegate: MemberDelegate {
|
|
|
|
width: memberList.width
|
|
|
|
}
|
2019-05-12 21:36:08 -04:00
|
|
|
|
2019-12-02 16:29:29 -04:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2019-05-12 13:17:42 -04:00
|
|
|
}
|
2019-05-16 15:39:44 -04:00
|
|
|
|
2019-08-22 09:27:26 -04:00
|
|
|
HRowLayout {
|
|
|
|
Layout.minimumHeight: theme.baseElementsHeight
|
|
|
|
Layout.maximumHeight: Layout.minimumHeight
|
2019-05-16 15:39:44 -04:00
|
|
|
|
2019-08-22 09:27:26 -04:00
|
|
|
HTextField {
|
|
|
|
id: filterField
|
2019-12-10 16:29:49 -04:00
|
|
|
saveName: "memberFilterField"
|
|
|
|
saveId: chat.roomId
|
|
|
|
|
2019-08-22 09:27:26 -04:00
|
|
|
placeholderText: qsTr("Filter members")
|
2019-12-10 14:57:54 -04:00
|
|
|
backgroundColor: theme.chat.roomPane.filterMembers.background
|
2019-08-22 09:27:26 -04:00
|
|
|
bordered: false
|
2019-12-15 14:56:40 -04:00
|
|
|
opacity: width >= 16 * theme.uiScale ? 1 : 0
|
2019-08-21 12:17:12 -04:00
|
|
|
|
2019-12-02 16:29:29 -04:00
|
|
|
onTextChanged: memberList.model.reFilter()
|
2019-08-22 09:27:26 -04:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2019-12-04 09:08:38 -04:00
|
|
|
|
2019-12-16 04:42:41 -04:00
|
|
|
Behavior on opacity { HNumberAnimation {} }
|
2019-08-22 09:27:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
HButton {
|
2019-12-11 12:42:59 -04:00
|
|
|
id: inviteButton
|
2019-08-22 09:27:26 -04:00
|
|
|
icon.name: "room-send-invite"
|
2019-12-10 14:57:54 -04:00
|
|
|
backgroundColor: theme.chat.roomPane.inviteButton.background
|
2019-12-13 09:52:04 -04:00
|
|
|
enabled: chat.roomInfo.can_invite
|
2019-12-11 12:42:59 -04:00
|
|
|
|
|
|
|
toolTip.text:
|
|
|
|
enabled ?
|
|
|
|
qsTr("Invite members to this room") :
|
2019-12-22 07:21:47 -08:00
|
|
|
qsTr("No permission to invite members to this room")
|
2019-12-11 12:42:59 -04:00
|
|
|
|
|
|
|
topPadding: 0 // XXX
|
|
|
|
bottomPadding: 0
|
|
|
|
|
2019-12-17 17:59:53 -04:00
|
|
|
onClicked: utils.makePopup(
|
2019-12-11 12:42:59 -04:00
|
|
|
"Popups/InviteToRoomPopup.qml",
|
|
|
|
chat,
|
|
|
|
{
|
|
|
|
userId: chat.userId,
|
|
|
|
roomId: chat.roomId,
|
2019-12-13 17:08:59 -04:00
|
|
|
roomName: chat.roomInfo.display_name,
|
2019-12-11 12:42:59 -04:00
|
|
|
invitingAllowed: Qt.binding(() => inviteButton.enabled),
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
// onEnabledChanged: if (openedPopup && ! enabled)
|
2019-08-22 09:27:26 -04:00
|
|
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
2019-05-16 15:39:44 -04:00
|
|
|
}
|
2019-05-12 13:17:42 -04:00
|
|
|
}
|