moment/src/gui/Pages/Chat/RoomPane/MemberView.qml

110 lines
3.2 KiB
QML
Raw Normal View History

2019-12-19 22:46:16 +11:00
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../../.."
2019-12-18 19:53:08 +11:00
import "../../../Base"
2019-05-13 03:17:42 +10:00
HColumnLayout {
readonly property alias keybindFocusItem: filterField
2019-05-14 03:15:03 +10:00
HListView {
2019-05-13 03:17:42 +10:00
id: memberList
clip: true
add: null // See the XXX comment in HListView.qml
2019-05-13 03:17:42 +10:00
model: HStringFilterModel {
sourceModel: ModelStore.get(chat.userId, chat.roomId, "members")
field: "display_name"
filter: filterField.text
delegate: MemberDelegate {
id: member
width: memberList.width
ListView.onAdd: ParallelAnimation {
HNumberAnimation {
target: member; property: "opacity"; from: 0; to: 1;
}
HNumberAnimation {
target: member; property: "scale"; from: 0; to: 1;
}
}
}
}
Layout.fillWidth: true
Layout.fillHeight: true
2020-03-13 16:09:04 +11:00
Rectangle {
anchors.fill: parent
z: -100
color: theme.chat.roomPane.listView.background
}
2019-05-13 03:17:42 +10:00
}
2020-03-13 16:09:04 +11:00
Rectangle {
color: theme.chat.roomPane.bottomBar.background
Layout.fillWidth: true
Layout.minimumHeight: theme.baseElementsHeight
Layout.maximumHeight: Layout.minimumHeight
2020-03-13 16:09:04 +11:00
HRowLayout {
anchors.fill: parent
2020-03-13 16:09:04 +11:00
HTextField {
id: filterField
saveName: "memberFilterField"
saveId: chat.roomId
2019-08-22 02:17:12 +10:00
2020-03-13 16:09:04 +11:00
backgroundColor:
theme.chat.roomPane.bottomBar.filterMembers.background
bordered: false
opacity: width >= 16 * theme.uiScale ? 1 : 0
2019-12-05 00:08:38 +11:00
2020-03-13 16:09:04 +11:00
Layout.fillWidth: true
Layout.fillHeight: true
// FIXME: fails to display sometimes for some reason if
// declared normally
Component.onCompleted: placeholderText = qsTr("Filter members")
2020-03-13 16:09:04 +11:00
Behavior on opacity { HNumberAnimation {} }
}
HButton {
id: inviteButton
icon.name: "room-send-invite"
backgroundColor:
theme.chat.roomPane.bottomBar.inviteButton.background
enabled: chat.roomInfo.can_invite
toolTip.text:
enabled ?
qsTr("Invite members to this room") :
qsTr("No permission to invite members to this room")
onClicked: utils.makePopup(
"Popups/InviteToRoomPopup.qml",
chat,
{
userId: chat.userId,
roomId: chat.roomId,
roomName: chat.roomInfo.display_name,
invitingAllowed:
Qt.binding(() => inviteButton.enabled),
},
)
Layout.fillHeight: true
2020-03-29 03:40:11 +11:00
HShortcut {
sequences: window.settings.keys.inviteToRoom
onActivated: inviteButton.clicked()
}
2020-03-13 16:09:04 +11:00
}
}
}
2019-05-13 03:17:42 +10:00
}