2019-07-13 19:39:01 +10:00
|
|
|
import QtQuick 2.12
|
2019-07-07 14:24:23 +10:00
|
|
|
|
|
|
|
HAvatar {
|
2019-11-04 04:48:12 +11:00
|
|
|
name: displayName || userId.substring(1) // no leading @
|
2019-07-10 12:48:59 +10:00
|
|
|
|
2019-07-07 14:24:23 +10:00
|
|
|
|
2019-11-04 04:48:12 +11:00
|
|
|
property string userId
|
|
|
|
property string displayName
|
2019-11-30 19:59:02 +11:00
|
|
|
property int powerLevel: 0
|
|
|
|
|
|
|
|
readonly property bool admin: powerLevel >= 100
|
|
|
|
readonly property bool moderator: powerLevel >= 50 && ! admin
|
|
|
|
|
|
|
|
|
|
|
|
HLoader {
|
|
|
|
active: admin || moderator
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.topMargin: -16 / 2
|
|
|
|
anchors.leftMargin: anchors.topMargin
|
|
|
|
z: 100
|
|
|
|
|
|
|
|
sourceComponent: HIcon {
|
2019-12-05 00:08:38 +11:00
|
|
|
small: true
|
2019-11-30 19:59:02 +11:00
|
|
|
svgName: "user-power-" + (admin ? "100" : "50")
|
|
|
|
colorize: admin ?
|
|
|
|
theme.chat.roomSidePane.member.adminIcon :
|
|
|
|
theme.chat.roomSidePane.member.moderatorIcon
|
|
|
|
|
|
|
|
HoverHandler { id: powerIconHover }
|
|
|
|
|
|
|
|
HToolTip {
|
|
|
|
visible: powerIconHover.hovered
|
|
|
|
text: admin ?
|
|
|
|
qsTr("Admin (%1 power)").arg(powerLevel) :
|
|
|
|
qsTr("Moderator (%1 power)").arg(powerLevel)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-07 14:24:23 +10:00
|
|
|
}
|