moment/src/qml/Base/HRoomAvatar.qml

24 lines
666 B
QML
Raw Normal View History

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