Add HUserAvatar and HRoomAvatar components
This commit is contained in:
@@ -3,7 +3,7 @@ import "../Base"
|
||||
import "../utils.js" as Utils
|
||||
|
||||
Rectangle {
|
||||
property var name: null
|
||||
property string name: ""
|
||||
property var imageUrl: null
|
||||
property int dimension: theme.avatar.size
|
||||
property bool hidden: false
|
||||
|
10
src/qml/Base/HRoomAvatar.qml
Normal file
10
src/qml/Base/HRoomAvatar.qml
Normal file
@@ -0,0 +1,10 @@
|
||||
import QtQuick 2.7
|
||||
|
||||
HAvatar {
|
||||
property string roomId: ""
|
||||
|
||||
readonly property var roomInfo: rooms.getWhere({"roomId": roomId}, 1)[0]
|
||||
readonly property var dname: roomInfo.displayName
|
||||
name: dname[0] == "#" && dname.length > 1 ? dname.substring(1) : dname
|
||||
imageUrl: roomInfo.avatarUrl
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
import QtQuick 2.7
|
||||
|
||||
HAvatar {
|
||||
HImage {
|
||||
id: status
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
source: "../../icons/status.svg"
|
||||
sourceSize.width: 12
|
||||
}
|
||||
}
|
17
src/qml/Base/HUserAvatar.qml
Normal file
17
src/qml/Base/HUserAvatar.qml
Normal file
@@ -0,0 +1,17 @@
|
||||
import QtQuick 2.7
|
||||
|
||||
HAvatar {
|
||||
property string userId: ""
|
||||
|
||||
readonly property var userInfo: userId ? users.getUser(userId) : ({})
|
||||
name: userInfo.displayName || userId.substring(1) // no leading @
|
||||
imageUrl: userInfo.avatarUrl
|
||||
|
||||
//HImage {
|
||||
//id: status
|
||||
//anchors.right: parent.right
|
||||
//anchors.bottom: parent.bottom
|
||||
//source: "../../icons/status.svg"
|
||||
//sourceSize.width: 12
|
||||
//}
|
||||
}
|
Reference in New Issue
Block a user