Add HUserAvatar and HRoomAvatar components

This commit is contained in:
miruka
2019-07-07 00:24:23 -04:00
parent 064fb6e9a2
commit 683ee3e1cf
14 changed files with 55 additions and 59 deletions

View File

@@ -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

View 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
}

View File

@@ -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
}
}

View 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
//}
}