moment/src/qml/Base/HRoomAvatar.qml
2019-07-09 22:48:59 -04:00

24 lines
666 B
QML

// Copyright 2019 miruka
// This file is part of harmonyqml, licensed under LGPLv3.
import QtQuick 2.7
HAvatar {
property string roomId: ""
// roomInfo ? → Avoid error messages when a room is forgotten
readonly property var roomInfo: rooms.getWhere({"roomId": roomId}, 1)[0]
readonly property var dname: roomInfo ? roomInfo.displayName : ""
name:
dname[0] == "#" && dname.length > 1 ? dname.substring(1) : dname
imageUrl:
roomInfo.avatarUrl ?
("image://python/crop/" + roomInfo.avatarUrl) : null
toolTipImageUrl:
roomInfo.avatarUrl ?
("image://python/scale/" + roomInfo.avatarUrl) : null
}