summary refs log tree commit diff
path: root/resources/qml/components/UserListRow.qml
blob: 2047f7006b85b5f62c20b0800caf0102e9c6c285 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

import ".."
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import im.nheko 1.0

ItemDelegate {
    property alias bgColor: background.color
    property alias userid: avatar.userid
    property alias displayName: avatar.displayName
    property string avatarUrl
    implicitHeight: layout.implicitHeight + Nheko.paddingSmall * 2
    background: Rectangle {id: background}
    GridLayout {
        id: layout
        anchors.centerIn: parent
        width: parent.width - Nheko.paddingSmall * 2
        rows: 2
        columns: 2
        rowSpacing: Nheko.paddingSmall
        columnSpacing: Nheko.paddingMedium

        Avatar {
            id: avatar
            Layout.rowSpan: 2
            Layout.preferredWidth: Nheko.avatarSize
            Layout.preferredHeight: Nheko.avatarSize
            Layout.alignment: Qt.AlignLeft
            url: avatarUrl.replace("mxc://", "image://MxcImage/")
            enabled: false
        }
        Label {
            Layout.fillWidth: true
            text: displayName
            color: TimelineManager.userColor(userid, palette.window)
            font.pointSize: fontMetrics.font.pointSize
        }

        Label {
            Layout.fillWidth: true
            Layout.alignment: Qt.AlignTop
            text: userid
            color: palette.buttonText
            font.pointSize: fontMetrics.font.pointSize * 0.9
        }
    }
}