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

105 lines
2.9 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
2020-02-12 23:15:54 +11:00
import SortFilterProxyModel 0.2
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
2019-05-13 03:17:42 +10:00
2020-03-10 20:38:28 +11:00
model: HSortFilterProxyModel {
2020-02-12 23:15:54 +11:00
sourceModel: ModelStore.get(chat.userId, chat.roomId, "members")
filters: ExpressionFilter {
expression: utils.filterMatches(
filterField.text, model.display_name,
)
}
}
2019-07-07 19:25:03 +10:00
delegate: MemberDelegate {
width: memberList.width
}
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
}