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

51 lines
1.5 KiB
QML
Raw Normal View History

2019-12-19 07:46:16 -04:00
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
2019-12-27 09:06:42 -04:00
import Clipboard 0.1
2019-12-18 04:53:08 -04:00
import "../../../Base"
2019-05-12 13:17:42 -04:00
HTileDelegate {
2019-05-12 13:17:42 -04:00
id: memberDelegate
2020-03-13 01:09:04 -04:00
backgroundColor: theme.chat.roomPane.listView.member.background
contentOpacity:
2020-03-13 01:09:04 -04:00
model.invited ? theme.chat.roomPane.listView.member.invitedOpacity : 1
2019-05-12 13:17:42 -04:00
image: HUserAvatar {
userId: model.id
displayName: model.display_name
mxc: model.avatar_url
2019-11-30 04:59:02 -04:00
powerLevel: model.power_level
shiftMembershipIconPosition: ! roomPane.collapsed
invited: model.invited
compact: memberDelegate.compact
2019-05-12 13:17:42 -04:00
}
title.text: model.display_name || model.id
2019-11-30 05:12:00 -04:00
title.color:
memberDelegate.hovered ?
utils.nameColor(model.display_name || model.id.substring(1)) :
2020-03-13 01:09:04 -04:00
theme.chat.roomPane.listView.member.name
subtitle.text: model.display_name ? model.id : ""
2020-03-13 01:09:04 -04:00
subtitle.color: theme.chat.roomPane.listView.member.subtitle
2019-11-30 05:12:00 -04:00
2019-12-12 08:32:50 -04:00
contextMenu: HMenu {
HMenuItem {
icon.name: "copy-user-id"
text: qsTr("Copy user ID")
onTriggered: Clipboard.text = model.id
2019-12-12 08:32:50 -04:00
}
}
2019-11-30 05:12:00 -04:00
Behavior on title.color { HColorAnimation {} }
Behavior on contentOpacity { HNumberAnimation {} }
Behavior on spacing { HNumberAnimation {} }
Binding on spacing {
value: (roomPane.minimumSize - loadedImage.width) / 2
when: loadedImage &&
roomPane.width < loadedImage.width + theme.spacing * 2
}
2019-05-12 13:17:42 -04:00
}