Add power icons for room members

This commit is contained in:
miruka 2019-11-30 04:59:02 -04:00
parent a35526a0b5
commit a01de1f3d6
5 changed files with 44 additions and 3 deletions

View File

@ -0,0 +1,3 @@
<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="m3 16-3-10 7.104 4 4.896-8 4.896 8 7.104-4-3 10zm0 2v4h18v-4z"/>
</svg>

After

Width:  |  Height:  |  Size: 169 B

View File

@ -0,0 +1,3 @@
<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="m12 .587 3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z"/>
</svg>

After

Width:  |  Height:  |  Size: 224 B

View File

@ -6,4 +6,36 @@ HAvatar {
property string userId
property string displayName
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 {
dimension: 16
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)
}
}
}
}

View File

@ -10,6 +10,7 @@ HTileDelegate {
userId: model.user_id
displayName: model.display_name
mxc: model.avatar_url
powerLevel: model.power_level
}
title.text: model.display_name || model.user_id

View File

@ -299,9 +299,11 @@ chat:
color background: colors.mediumBackground
member:
color background: "transparent"
color name: colors.text
color subtitle: colors.dimText
color background: "transparent"
color name: colors.text
color subtitle: colors.dimText
color adminIcon: hsluv(60, colors.saturation * 2.25, 60)
color moderatorIcon: adminIcon
inviteButton:
color background: colors.inputBackground